Cathook automatic updates

This commit is contained in:
TotallyNotElite 2018-11-02 22:10:07 +01:00
parent 96288c5cbe
commit 135c4ec98e
6 changed files with 33 additions and 2 deletions

2
attach
View File

@ -58,3 +58,5 @@ rm $FILENAME
sudo killall -18 steamwebhelper
sudo killall -18 steam
./scripts/auto-updater &

View File

@ -57,6 +57,8 @@ gdb -n -q -batch \
sudo killall -18 steamwebhelper
sudo killall -18 steam
./scripts/auto-updater &
gdb -n -q -batch \
-ex "attach $proc" \
-ex "continue" \

View File

@ -61,3 +61,5 @@ sudo gdb -n -q -batch \
-ex "quit"
sudo rm "/lib/i386-linux-gnu/${FILENAME}"
./scripts/auto-updater &

27
scripts/auto-updater Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env bash
LOCKFILE=/tmp/chupdater.lock
if [ -e ${LOCKFILE} ] && kill -0 `cat ${LOCKFILE}` >/dev/null; then
echo -e "\033[1;31m \n \nAuto Updater: Auto Updater already running in the background\n\033[0m"
exit
fi
# make sure the lockfile is removed when we exit and then claim it
trap "rm -f ${LOCKFILE}; exit" INT TERM EXIT
echo $$ > ${LOCKFILE}
echo -e "\033[1;34 \n \nAuto Updater: Updating cathook in the background\n\033[0m"
sudo -u $(logname) bash -c 'git fetch && git pull origin >/dev/null && git submodule update --init --recursive' || { echo -e "\033[1;31m \n \nAuto Updater: Failed to pull from github!\n\033[0m"; exit 1; }
pushd build >/dev/null || exit 1
sudo cmake --build . --target data >/dev/null || { echo -e "\033[1;31m \n \nAuto Updater:Failed to update /opt/cathook/data directory\n\033[0m"; exit 1; }
sudo -u $(logname) bash -c 'cmake .. >/dev/null && cmake --build . --target cathook >/dev/null' || { echo -e "\033[1;31m \n \nAuto Updater: Failed to compile cathook\n\033[0m"; exit 1; }
rm -f ${LOCKFILE}
popd >/dev/null
echo -e "\n\n\033[1;34mAuto Updater: Cathook updated successfully\033[0m" && exit 0

View File

@ -1,2 +0,0 @@
#!/usr/bin/env bash
printf "\n\n";printf '\e[1;34m%-6s\e' "Your cathook version is out of date! Please reinstall by using \"wget https://raw.githubusercontent.com/nullworks/One-in-all-cathook-install/master/install-all && bash install-all\"";printf "\n\n"