Compare commits

...

13 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
6 changed files with 150 additions and 84 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
brendotools-wallman*
brendotools-wallman.zip
to-do.md
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

100
wpset
View File

@ -1,40 +1,61 @@
#!/bin/bash
# setting USER variable
USER=$(logname)
# WPDL
VERSION="0.1-rev83"
VERSION=""
CONF="/home/$USER/.config/wpdl.conf"
source $CONF
source /etc/wpdl/parse
# updater
if [ "$1" = "-u" ]; then
# 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
# 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)
# compare versions
WPSET_REMOTEVER=$(echo "$DOWNLOAD_VERSION")
WPSET_LOCALVER=$(wpset -v)
if [ "$WPSET_REMOTEVER" == "$WPSET_LOCALVER" ]; then
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
# 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
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."
# 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
@ -90,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,7 +1,6 @@
#!/bin/bash
# version
VERSION="1.0"
source parse
git checkout tags/$DOWNLOAD_VERSION
# setting USER variable
USER=$(logname)
@ -9,17 +8,13 @@ USER=$(logname)
# root check
ROOT=$(whoami)
if [ "$ROOT" != "root" ]; then
echo "ERR_ROOT_PRIVS_REQUIRE"
echo "an error occurred while checking for root permissions: DONT_HAVE_EM_CHIEF"
echo "(try re-running this script with sudo.)"
exit
fi
if [ "$1" = "-u" ]; then
mv wpset /bin/wpset
chmod +x /bin/wpset
cd /home/$USER/
rm -rf brendotools-wallman*
echo "done."
exit
fi
# location where config file will reside.
@ -57,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,41 +1,58 @@
#!/bin/bash
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
}
# root check
ROOT=$(whoami)
if [ "$ROOT" != "root" ]; then
sudo bash wpset-update process
exit
fi
if [ "$1" == "process" ]; then
process
fi
# 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
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
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."
process
fi
rm $WPSET_REL
echo "wpset-update is now deprecated. it's now built directly into wpset."