42 lines
1.2 KiB
Bash
42 lines
1.2 KiB
Bash
#!/bin/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
|
|
|
|
# other important shit
|
|
CONF="/home/$USER/.config/wpdl.conf"
|
|
source $CONF
|
|
WPSET_REMOTEVER="0.1-rev83"
|
|
WPSET_LOCALVER=$(wpset -v)
|
|
clear
|
|
|
|
if [ "$WPSET_REMOTEVER" == "$WPSET_LOCALVER" ]; then
|
|
|
|
echo "no updates to install, latest version already installed"
|
|
exit
|
|
|
|
else
|
|
PASSWD=$(pass system/sudo)
|
|
|
|
# The Parsed (and updater)
|
|
curl -s $DOWNLOAD_URL -o $DOWNLOAD_FNAME
|
|
unzip $DOWNLOAD_FNAME -d /home/$USER/$DOWNLOAD_FOLDER
|
|
cd /home/$USER/$DOWNLOAD_FOLDER
|
|
chmod +x /home/$USER/$DOWNLOAD_FOLDER/brendotools-wallman/wpset-setup
|
|
echo "sudo privileges are required to continue. enter your password."
|
|
sudo mv wpset /bin/wpset
|
|
sudo chmod +x /bin/wpset
|
|
|
|
|
|
sleep 1
|
|
echo "wpset should have successfully updated."
|
|
WPSET_LOCALVER=$(wpset -v)
|
|
echo "wpset version is now $WPSET_LOCALVER."
|
|
fi
|
|
rm $WPSET_REL
|