Compare commits

...

23 Commits

Author SHA1 Message Date
Brendan Webb 69e4fed9b1 aaaaaa 2021-11-25 13:14:46 +11:00
Brendan Webb bf630f1d4b i mean it seems to be less of a clusterfuck 2021-08-27 12:06:22 +10:00
Brendan Webb 8164fff194 more works on wpset-update. 2021-08-27 11:48:21 +10:00
Brendan Webb fc0aca957f last attempt at fixing before bed 2021-08-26 22:52:55 +10:00
Brendan Webb 958017264b WHY ISN'T THIS HOOK WORKING 2021-08-26 22:45:18 +10:00
Brendan Webb 079f270c96 fix parsing bug with tag notes 2021-08-26 22:30:22 +10:00
Brendan Webb ce71357803 fix parsing bug with tag notes 2021-08-26 22:24:25 +10:00
Brendan Webb ae2407a9ff added comment to make debugging stuff more obv 2021-08-26 22:18:20 +10:00
Brendan Webb 15be4b3ca9 add debug arg to parser 2021-08-26 22:15:46 +10:00
Brendan Webb f2204c4196 still trying to test a thing 2021-08-26 22:05:10 +10:00
Brendan Webb c15894c8bd add a thing to readme.md so i can test a thing 2021-08-26 22:00:52 +10:00
Brendan Webb 3b079b97eb a whole bunch of shit happened. open the full commit to learn more.
- added "releasenotes_not_for_push" to .gitignore
- new file: parse (for parsing responses from tildegit)
- hopefully fix update mechanism in wpset
- hopefully unfuck updater on wpset-setup's end
2021-08-26 21:55:29 +10:00
Brendan Webb 00aad7f03c haha i forgot this 2021-08-24 13:09:18 +10:00
Brendan Webb ce2790124d switch to having the updater directly in wpset 2021-08-24 12:01:36 +10:00
Brendan Webb 6f5339e0de please for the love of all things mighty, WORK 2021-08-22 17:38:08 +10:00
Brendan Webb f544ee169f hopefully this does the trick 2021-08-22 17:34:13 +10:00
Brendan Webb 812e0167f9 oops, forgot to close the update if statement 2021-08-22 17:27:43 +10:00
Brendan Webb dd8c9cca00 i fucking hate zips
but at the same time i don't understand tarballs
what can i dOoOoOoO
2021-08-22 17:25:55 +10:00
Brendan Webb fc5a3a21a6 fix a typo i somehow missed THIS WHOLE TIME 2021-08-22 17:24:23 +10:00
Brendan Webb f90e7d0d3d another update to hopefully fix shit 2021-08-22 17:22:08 +10:00
Brendan Webb 888b22f1aa update wpset-update to try something 2021-08-22 17:17:52 +10:00
Brendan Webb 0f1a3d93ff started work on a semi-sane updater.
my brain hurts.
2021-08-22 17:09:36 +10:00
Brendan Webb 09ed35989b add todo file to gitignore 2021-08-21 21:35:40 +10:00
6 changed files with 164 additions and 42 deletions

4
.gitignore vendored
View File

@ -1,2 +1,4 @@
brendotools-wallman*
brendotools-wallman.zip
brendotools-wallman.zip
to-do.md
releasenotes_not_for_push

View File

@ -2,4 +2,12 @@
## brendo's stupidly over-engineered wallpaper manager.
### documentation coming... eventually.
### documentation coming... eventually.
### at least i hopefully fixed the update mechanism...
### i'm a fucking moron
this is entirely so i can see if i fixed a broken hook
yeah the hook didn't work

20
parse Normal file
View File

@ -0,0 +1,20 @@
#!/bin/bash
function parse() {
WPSET_REL=$(mktemp /tmp/wpset-releases-XXXXX.json)
curl -s https://tildegit.org/api/v1/repos/BrendanTCC/brendotools-wallman/tags -o $WPSET_REL
DOWNLOAD_VERSION=$(cat $WPSET_REL | jq .[0].name | sed s/\"//g)
DOWNLOAD_NOTES=$(cat $WPSET_REL | jq .[0].message | sed s/\"//g | sed 's/\\n/\
/g')
rm $WPSET_REL
}
# everything below this comment is entirely for debugging parsing.
# haha im lazy
function debug() {
parse
echo "newest tag found: $DOWNLOAD_VERSION"
echo "tag message:"
echo "$DOWNLOAD_NOTES"
}
if [ "$1" == "debug" ]; then
debug
fi

83
wpset
View File

@ -1,18 +1,66 @@
#!/bin/bash
# setting USER variable
USER=$(logname)
# WPDL
VERSION="0.1-rev81"
VERSION=""
CONF="/home/$USER/.config/wpdl.conf"
source $CONF
source /etc/wpdl/parse
# updater
if [ "$1" = "-u" ]; then
curl sftp://$HOST_DISP/home/$SSH_USER/bin/wpset-update -u $SSH_USER: | bash
exit
# 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
# 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
fi
# version
if [ "$1" = "-v" ]; then
echo "v$VERSION"
echo "$VERSION"
exit
fi
@ -63,17 +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

View File

@ -1,17 +1,21 @@
#!/bin/bash
source parse
git checkout tags/$DOWNLOAD_VERSION
# version
VERSION="1.0"
# setting USER variable
USER=$(logname)
# root check
ROOT=$(whoami)
if [ "$ROOT" != "root" ]; then
echo "sorry, root privileges are required to continue."
echo "an error occurred while checking for root permissions: DONT_HAVE_EM_CHIEF"
echo "(try re-running this script with sudo.)"
exit
fi
# setting USER variable
USER=$(logname)
if [ "$1" = "-u" ]; then
exit
fi
# location where config file will reside.
# DO NOT CHANGE AS THIS IS HARD-CODED INTO
@ -48,5 +52,8 @@ echo "LASTWP_LOC=\"\$WALL_LOC/.lastwp\"" >> $CONFIG
echo "LAST=\$(cat /home/$USER/wallpaper/.lastwp)" >> $CONFIG
chown $USER:$USER $CONFIG
echo "done! now let's chuck wpset in /bin/..."
echo wpset | sed "s/VERSION\=\"\"/VERSION\=\"$DOWNLOAD_VERSION\""
mv wpset /bin/wpset
mkdir -p /etc/wpdl
mv parse /etc/wpdl/parse
echo "done! goodbye."

View File

@ -1,22 +1,58 @@
#!/bin/bash
CONF="/home/$USER/.config/wpdl.conf"
source $CONF
WPSET_REMOTEVER=$(curl sftp://$SSH_HOST/home/$SSH_USER/bin/wpset -u $SSH_USER: | grep -m1 VERSION | sed "s/VERSION\=//g" | sed s/\"//g)
WPSET_LOCALVER=$(wpset -v)
clear
function process() {
# 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
exit
}
if [ "$WPSET_REMOTEVER" == "$WPSET_LOCALVER" ]; then
echo "no updates to install, latest version already installed"
# root check
ROOT=$(whoami)
if [ "$ROOT" != "root" ]; then
sudo bash wpset-update process
exit
else
PASSWD=$(pass system/sudo)
curl sftp://$SSH_HOST/home/$SSH_USER/bin/wpset -o wpset -u $SSH_USER:
echo "$PASSWD" | sudo -S mv wpset /bin/wpset
echo "$PASSWD" | sudo -S chmod +x /bin/wpset
sleep 1
echo "wpset updated."
WPSET_LOCALVER=$(wpset -v)
echo "wpset version is now $WPSET_LOCALVER."
fi
if [ "$1" == "process" ]; then
process
fi
# contact tildegit to see if there's a new release
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
source parse
parse
git checkout tags/$DOWNLOAD_VERSION
# set the version because GOOD GOD I'M A LAZY CUNT
echo wpset | sed "s/VERSION\=\"\"/VERSION\=\"$DOWNLOAD_VERSION\""
# setting USER variable
USER=$(logname)
# root check
ROOT=$(whoami)
if [ "$ROOT" != "root" ]; then
sudo bash /home/$USER/brendotools-wallman/wpset-update process
else
process
fi
rm $WPSET_REL
echo "wpset-update is now deprecated. it's now built directly into wpset."