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