Compare commits

...

3 Commits

3 changed files with 38 additions and 13 deletions

31
wpset
View File

@ -1,13 +1,40 @@
#!/bin/bash #!/bin/bash
# WPDL # WPDL
VERSION="0.1-rev82" VERSION="0.1-rev83"
CONF="/home/$USER/.config/wpdl.conf" CONF="/home/$USER/.config/wpdl.conf"
source $CONF source $CONF
# updater # updater
if [ "$1" = "-u" ]; then if [ "$1" = "-u" ]; then
curl -s https://assets.brendo.org/wpset/update | bash # contact tildegit to see if there's a new release
WPSET_REL=$(mktemp /tmp/wpset-releases-XXXXX.json)
curl -s https://tildegit.org/api/v1/repos/BrendanTCC/brendotools-wallman/releases -o $WPSET_REL
DOWNLOAD_VERSION=$(cat $WPSET_REL | jq .[0].tag_name | sed s/\"//g)
DOWNLOAD_URL=$(cat $WPSET_REL | jq .[0].assets[0].browser_download_url | sed s/\"//g)
DOWNLOAD_FNAME=$(cat $WPSET_REL | jq .[0].assets[0].name | sed s/\"//g)
rm $WPSET_REL
# compare versions
WPSET_REMOTEVER=$(echo "$DOWNLOAD_VERSION")
WPSET_LOCALVER=$(wpset -v)
if [ "$WPSET_REMOTEVER" == "$WPSET_LOCALVER" ]; then
# tell user that there's nothing to do
echo "you are already running the latest available version of wallman."
exit exit
else
# download the update
cd /home/$USER/
wget $DOWNLOAD_URL -o $DOWNLOAD_FNAME
unzip $DOWNLOAD_FNAME
cd brendotools-wallman
mv wpset /bin/wpset
chmod +x /bin/wpset
cd /home/$USER/
rm -rf brendotools-wallman/
echo "done."
fi fi
# version # version

View File

@ -14,16 +14,14 @@ echo "(try re-running this script with sudo.)"
exit exit
fi fi
if [ "$1" = "update" ]; then if [ "$1" = "-u" ]; then
mv wpset /bin/wpset mv wpset /bin/wpset
chmod +x /bin/wpset chmod +x /bin/wpset
cd /home/$USER/
rm -rf brendotools-wallman*
echo "done." echo "done."
fi fi
# location where config file will reside. # location where config file will reside.
# DO NOT CHANGE AS THIS IS HARD-CODED INTO # DO NOT CHANGE AS THIS IS HARD-CODED INTO
# ALL THE SCRIPTS AND ***BY GOD*** WILL IT BE A NIGHTMARE TO CHANGE. # ALL THE SCRIPTS AND ***BY GOD*** WILL IT BE A NIGHTMARE TO CHANGE.

View File

@ -1,18 +1,17 @@
#!/bin/bash #!/bin/bash
# this file will reside at https://assets.brendo.org/wpset/update # contact tildegit to see if there's a new release
# parse json
WPSET_REL=$(mktemp /tmp/wpset-releases-XXXXX.json) WPSET_REL=$(mktemp /tmp/wpset-releases-XXXXX.json)
curl -s https://tildegit.org/api/v1/repos/BrendanTCC/brendotools-wallman/releases -o $WPSET_REL curl -s https://tildegit.org/api/v1/repos/BrendanTCC/brendotools-wallman/releases -o $WPSET_REL
DOWNLOAD_VERSION=$(cat $WPSET_REL | jq .[0].tag_name | sed s/\"//g) DOWNLOAD_VERSION=$(cat $WPSET_REL | jq .[0].tag_name | sed s/\"//g)
DOWNLOAD_URL=$(cat $WPSET_REL | jq .[0].assets[0].browser_download_url | sed s/\"//g) DOWNLOAD_URL=$(cat $WPSET_REL | jq .[0].assets[0].browser_download_url | sed s/\"//g)
DOWNLOAD_FNAME=$(cat $WPSET_REL | jq .[0].assets[0].name | sed s/\"//g) DOWNLOAD_FNAME=$(cat $WPSET_REL | jq .[0].assets[0].name | sed s/\"//g)
DOWNLOAD_FOLDER=$(echo "$DOWNLOAD_FNAME" | sed s/\.zip//) rm $WPSET_REL
# other important shit # other important shit
CONF="/home/$USER/.config/wpdl.conf" CONF="/home/$USER/.config/wpdl.conf"
source $CONF source $CONF
WPSET_REMOTEVER=$(echo "$DOWNLOAD_VERSION") WPSET_REMOTEVER="0.1-rev83"
WPSET_LOCALVER=$(wpset -v) WPSET_LOCALVER=$(wpset -v)
clear clear
@ -30,11 +29,12 @@ unzip $DOWNLOAD_FNAME -d /home/$USER/$DOWNLOAD_FOLDER
cd /home/$USER/$DOWNLOAD_FOLDER cd /home/$USER/$DOWNLOAD_FOLDER
chmod +x /home/$USER/$DOWNLOAD_FOLDER/brendotools-wallman/wpset-setup chmod +x /home/$USER/$DOWNLOAD_FOLDER/brendotools-wallman/wpset-setup
echo "sudo privileges are required to continue. enter your password." echo "sudo privileges are required to continue. enter your password."
sudo /home/$USER/$DOWNLOAD_FOLDER/brendotools-wallman/wpset-setup update sudo mv wpset /bin/wpset
sudo chmod +x /bin/wpset
sleep 1 sleep 1
echo "wpset updated." echo "wpset should have successfully updated."
WPSET_LOCALVER=$(wpset -v) WPSET_LOCALVER=$(wpset -v)
echo "wpset version is now $WPSET_LOCALVER." echo "wpset version is now $WPSET_LOCALVER."
fi fi