Floorp browser fetcher script with .pet package making - need feedback

Issues and / or general discussion relating to Puppy

Moderator: Forum moderators

Post Reply
User avatar
FloraMae
Posts: 68
Joined: Thu May 02, 2024 3:13 am
Has thanked: 9 times
Been thanked: 14 times

Floorp browser fetcher script with .pet package making - need feedback

Post by FloraMae »

So, here is a script to fetch the latest Floorp browser and make a .pet for it.

The goal is to test automating the making of .pet packages of programs (in this case Floorp browser). The goal is to run via cron to create/update a pet package easily. You could add something to the bottom to automate uploading/sharing of new.pet if desired. This contains a basic version checking.

The feedback I need is on things like, is this the way to make a .pet? Can this be done better? Anything I might be missing? And also if this works on other puppies.

UPDATE: Decided to do a Google Drive folder to hold scripts and tests if anyone wants to try it out:
https://drive.google.com/drive/folders/ ... 4CUTEeBvPr

Code: Select all

#!/bin/bash
########################################################################
##
## Floorp browser fetch for Puppy with .pet making
##
## Tested: Bookwormpup64
##
## Requires: bash, curl, jq, grep, head
##
## Version: 1.1
##
########################################################################

## Basic deps check
APPARRAY=(curl jq grep head)
function check_deps(){
    for APP in "${APPARRAY[@]}"
    do
        which $APP > /dev/null 2>&1
        rc=$?
        if [ $rc == 0 ]; then
            continue
        fi

		echo "deps not satisfied, please open script to verify"
        exit 1
    done
}

check_deps

## Get version number
ver=$(curl --silent "https://api.github.com/repos/Floorp-Projects/Floorp/releases/latest" | jq --raw-output '.assets[] .browser_download_url' | grep 'linux-x86_64' | head -n1 | cut -d/ -f8)
verl=$(cat ./version)

## Do we need to update?
if [ "$ver" == "$verl" ]; then
   echo 'No new version detected, exiting'
   exit 0
fi

## Updating version file
echo "$ver" > ./version

## Get the latest url release
url=$(curl --silent "https://api.github.com/repos/Floorp-Projects/Floorp/releases/latest" | jq --raw-output '.assets[] .browser_download_url' | grep 'linux-x86_64' | head -n1)

## Get it
wget -O './floorp.tar.bz2' "$url" -q --show-progress

#### Experimental pet making
mkdir -p "floorp-$ver/opt"
tar -xvf floorp.tar.bz2 -C "./floorp-$ver/opt"

mkdir -p "./floorp-$ver/usr"
mkdir -p "./floorp-$ver/usr/bin"
mkdir -p "./floorp-$ver/usr/share"
mkdir -p "./floorp-$ver/usr/share/applications"

cp "./floorp-$ver/opt/floorp/browser/chrome/icons/default/default128.png" "./floorp-$ver"

cat <<EOT >> "./floorp-$ver/usr/share/applications/floorp.desktop"
[Desktop Entry]
Encoding=UTF-8
Name=Floorp web browser
Icon=default128.png
Comment=Floorp web browser
Exec=floorp
Terminal=false
Type=Application
Categories=X-Internet-browser
GenericName=Floorp web browser

EOT

ln -s /opt/floorp/floorp "./floorp-$ver/usr/bin/floorp"

## make the pet
dir2pet -s -i="noarch" -n -c=Internet -x "floorp-$ver"

## Cleanup
rm -rf "./floorp-$ver"
rm ./floorp.tar.bz2
Last edited by FloraMae on Thu May 16, 2024 11:08 pm, edited 1 time in total.
User avatar
FloraMae
Posts: 68
Joined: Thu May 02, 2024 3:13 am
Has thanked: 9 times
Been thanked: 14 times

Re: Floorp browser fetcher script with .pet package making - need feedback

Post by FloraMae »

Update of script, see first post.

User avatar
MochiMoppel
Posts: 1131
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 18 times
Been thanked: 366 times

Re: Floorp browser fetcher script with .pet package making - need feedback

Post by MochiMoppel »

FloraMae wrote: Thu May 16, 2024 2:36 pm

UPDATE: Decided to do a Google Drive folder to hold scripts and tests if anyone wants to try it out:
https://drive.google.com/drive/folders/ ... 4CUTEeBvPr

So what is the latest version? In BW64 the script Version: 1.1 you posted here in the forum created an empty .pet package and a malformed 49M floorp-v11.13.0.tar archive.
I will not fetch any scripts from Google Drive.

Code: Select all

Creating package...
tar: ./floorp-v11.13.0.tar: Wrote only 2048 of 10240 bytes
tar: Error is not recoverable: exiting now
xz: ./floorp-v11.13.0.tar.xz: Write error: No space left on device

File ./floorp-v11.13.0.tar.xz created. Now converting to .pet...
stat: cannot statx './floorp-v11.13.0.tar.xz': No such file or directory
md5sum: ./floorp-v11.13.0.tar.xz: No such file or directory

floorp-v11.13.0.pet has been created. Finished.

If you look in floorp-v11.13.0 you will see the new '.specs' file.
Directory floorp-v11.13.0 is now configured correctly as a PET package
and in future you do not need to go through this script again.
You could manually edit the files if required, and create another
.pet package just by doing this:
# tar -c -f floorp-v11.13.0.tar floorp-v11.13.0/
# xz -z -6 -e -T 0 floorp-v11.13.0.tar
# tgz2pet floorp-v11.13.0.tar.xz

dir2pet exited.
User avatar
FloraMae
Posts: 68
Joined: Thu May 02, 2024 3:13 am
Has thanked: 9 times
Been thanked: 14 times

Re: Floorp browser fetcher script with .pet package making - need feedback

Post by FloraMae »

MochiMoppel wrote: Fri May 17, 2024 11:58 am
FloraMae wrote: Thu May 16, 2024 2:36 pm

UPDATE: Decided to do a Google Drive folder to hold scripts and tests if anyone wants to try it out:
https://drive.google.com/drive/folders/ ... 4CUTEeBvPr

So what is the latest version? In BW64 the script Version: 1.1 you posted here in the forum created an empty .pet package and a malformed 49M floorp-v11.13.0.tar archive.
I will not fetch any scripts from Google Drive.

Code: Select all

Creating package...
tar: ./floorp-v11.13.0.tar: Wrote only 2048 of 10240 bytes
tar: Error is not recoverable: exiting now
xz: ./floorp-v11.13.0.tar.xz: Write error: No space left on device

File ./floorp-v11.13.0.tar.xz created. Now converting to .pet...
stat: cannot statx './floorp-v11.13.0.tar.xz': No such file or directory
md5sum: ./floorp-v11.13.0.tar.xz: No such file or directory

floorp-v11.13.0.pet has been created. Finished.

If you look in floorp-v11.13.0 you will see the new '.specs' file.
Directory floorp-v11.13.0 is now configured correctly as a PET package
and in future you do not need to go through this script again.
You could manually edit the files if required, and create another
.pet package just by doing this:
# tar -c -f floorp-v11.13.0.tar floorp-v11.13.0/
# xz -z -6 -e -T 0 floorp-v11.13.0.tar
# tgz2pet floorp-v11.13.0.tar.xz

dir2pet exited.

"xz: ./floorp-v11.13.0.tar.xz: Write error: No space left on device"
Looks like you don't have any space left?

As for "scripts from Google Drive", just go and preview it and it's the same as seeing it on here. It will show the whole script in the preview without even downloading it.

User avatar
MochiMoppel
Posts: 1131
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 18 times
Been thanked: 366 times

Re: Floorp browser fetcher script with .pet package making - need feedback

Post by MochiMoppel »

FloraMae wrote: Fri May 17, 2024 12:14 pm

"xz: ./floorp-v11.13.0.tar.xz: Write error: No space left on device"
Looks like you don't have any space left?

Yes, I've seen that, but it looked as if the preceding tar creation already didn't work, so it made no sense to me. However it turned out that the whole procedure requires more than 750MB (!) free space, much more than I had available. It works now and I presently post from the Floorp browser :thumbup2:

As for "scripts from Google Drive", just go and preview it and it's the same as seeing it on here.

No, it's not the same. Requires extra steps and extra time which I am not prepared to invest. I don't understand why you are unwilling to post the code here.

User avatar
FloraMae
Posts: 68
Joined: Thu May 02, 2024 3:13 am
Has thanked: 9 times
Been thanked: 14 times

Re: Floorp browser fetcher script with .pet package making - need feedback

Post by FloraMae »

MochiMoppel wrote: Sat May 18, 2024 2:24 am
FloraMae wrote: Fri May 17, 2024 12:14 pm

"xz: ./floorp-v11.13.0.tar.xz: Write error: No space left on device"
Looks like you don't have any space left?

Yes, I've seen that, but it looked as if the preceding tar creation already didn't work, so it made no sense to me. However it turned out that the whole procedure requires more than 750MB (!) free space, much more than I had available. It works now and I presently post from the Floorp browser :thumbup2:

As for "scripts from Google Drive", just go and preview it and it's the same as seeing it on here.

No, it's not the same. Requires extra steps and extra time which I am not prepared to invest. I don't understand why you are unwilling to post the code here.

I'm not unwilling, it's just extra steps and extra time ;)

UPDATE: Hint, there is only one difference between what's on here and what's on the google drive and that is the one on the google drive has gupload line because I use that to upload the .pet to the google drive.

Post Reply

Return to “Users”