From 69e4fed9b16412e8b84ee03dec1845d78569b23d Mon Sep 17 00:00:00 2001 From: BrendanTCC Date: Thu, 25 Nov 2021 13:14:46 +1100 Subject: [PATCH] aaaaaa --- wpset | 114 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 56 insertions(+), 58 deletions(-) diff --git a/wpset b/wpset index bc95866..ad782af 100755 --- a/wpset +++ b/wpset @@ -9,55 +9,53 @@ source $CONF source /etc/wpdl/parse # updater if [ "$1" = "-u" ]; then + # root check + ROOT=$(whoami) + if [ "$ROOT" != "root" ]; then + echo "ERR_ROOT_PRIVS_REQUIRE" + echo "(try re-running this script with sudo.)" + exit + fi + # contact tildegit to check for a new release + parse + # compare versions + WPSET_REMOTEVER=$(echo "$DOWNLOAD_VERSION") + WPSET_LOCALVER=$(wpset -v) + if [ "$WPSET_REMOTEVER" == "$WPSET_LOCALVER" ]; then -# root check -ROOT=$(whoami) -if [ "$ROOT" != "root" ]; then -echo "ERR_ROOT_PRIVS_REQUIRE" -echo "(try re-running this script with sudo.)" -exit -fi -# contact tildegit to check for a new release -parse -# compare versions -WPSET_REMOTEVER=$(echo "$DOWNLOAD_VERSION") -WPSET_LOCALVER=$(wpset -v) + # tell user that there's nothing to do + echo "you are already running the latest available version of wallman." + exit -if [ "$WPSET_REMOTEVER" == "$WPSET_LOCALVER" ]; then + else + # download the update + cd /home/$USER/ + FOLDER_CHECK=$(ls | grep brendotools-wallman) + if [ "$FOLDER_CHECK" != "" ]; then + rm -rf brendotools-wallman* + fi + git clone https://tildegit.org/BrendanTCC/brendotools-wallman/ + cd brendotools-wallman + git checkout tags/$DOWNLOAD_VERSION -# tell user that there's nothing to do -echo "you are already running the latest available version of wallman." -exit - -else -# download the update -cd /home/$USER/ -FOLDER_CHECK=$(ls | grep brendotools-wallman) -if [ "$FOLDER_CHECK" != "" ]; then -rm -rf brendotools-wallman* -fi -git clone https://tildegit.org/BrendanTCC/brendotools-wallman/ -cd brendotools-wallman -git checkout tags/$DOWNLOAD_VERSION - -# set the version because GOOD GOD I'M A LAZY CUNT -echo wpset | sed "s/VERSION\=\"\"/VERSION\=\"$DOWNLOAD_VERSION\"" -# install the update -mv wpset /bin/wpset -chmod +x /bin/wpset -mv parse /etc/wpdl/parse -chmod +x /etc/wpdl/parse -cd /home/$USER/ -rm -rf brendotools-wallman/ -echo "done." -WPSET_LOCALVER=$(wpset -v) -if [ "$WPSET_LOCALVER" == "$WPSET_REMOTEVER" ]; then -echo "success! wpset version updated to $WPSET_LOCALVER." -else -echo "something's gone wrong. wpset version is '$WPSET_LOCALVER' when it should be $WPSET_REMOTEVER.\ -try manually moving the file and running wpset -v." -fi + # set the version because GOOD GOD I'M A LAZY CUNT + echo wpset | sed "s/VERSION\=\"\"/VERSION\=\"$DOWNLOAD_VERSION\"" + # install the update + mv wpset /bin/wpset + chmod +x /bin/wpset + mv parse /etc/wpdl/parse + chmod +x /etc/wpdl/parse + cd /home/$USER/ + rm -rf brendotools-wallman/ + echo "done." + WPSET_LOCALVER=$(wpset -v) + if [ "$WPSET_LOCALVER" == "$WPSET_REMOTEVER" ]; then + echo "success! wpset version updated to $WPSET_LOCALVER." + else + echo "something's gone wrong. wpset version is '$WPSET_LOCALVER' when it should be $WPSET_REMOTEVER.\ + try manually moving the file and running wpset -v." + fi fi # version @@ -113,18 +111,18 @@ else # wallpaper lookup WPLIST=$(wplist | grep $1) -if [ "$WPLIST" = "$1" ]; then - # download the actual script - curl -s sftp://$SSH_HOST/home/$SSH_USER/bin/wpdl -u $SSH_USER: -o wpdl - chmod +x wpdl - clear - $PWD/wpdl $* - rm wpdl - [ -e wp.list ] && rm $PWD/wp.list -else - clear - echo "could not find the wallpaper you requested, here's a list of what's available:" - wplist + if [ "$WPLIST" = "$1" ]; then + # download the actual script + curl -s sftp://$SSH_HOST/home/$SSH_USER/bin/wpdl -u $SSH_USER: -o wpdl + chmod +x wpdl + clear + $PWD/wpdl $* + rm wpdl + [ -e wp.list ] && rm $PWD/wp.list + else + clear + echo "could not find the wallpaper you requested, here's a list of what's available:" + wplist + fi fi fi -fi \ No newline at end of file