Space saving and auto updater enable prompt
This commit is contained in:
parent
2bf8be8ab9
commit
bc074ab3b8
2
.gitignore
vendored
2
.gitignore
vendored
@ -282,3 +282,5 @@ cathook.cbp
|
|||||||
\.kdev4/cathook\.kdev4
|
\.kdev4/cathook\.kdev4
|
||||||
|
|
||||||
cathook\.kdev4
|
cathook\.kdev4
|
||||||
|
|
||||||
|
scripts/updater-preferences
|
||||||
|
@ -41,7 +41,7 @@ and a lot of useful features, including
|
|||||||
## Automatic: (Ubuntu 17.10+/Arch based only)
|
## Automatic: (Ubuntu 17.10+/Arch based only)
|
||||||
Run in terminal:
|
Run in terminal:
|
||||||
|
|
||||||
* `wget https://raw.githubusercontent.com/nullworks/One-in-all-cathook-install/master/install-all && bash install-all`
|
* `wget -O - https://raw.githubusercontent.com/nullworks/One-in-all-cathook-install/master/install-all | bash`
|
||||||
|
|
||||||
## Manual:
|
## Manual:
|
||||||
You need CMake to build cathook, CMake should take care of dependencies
|
You need CMake to build cathook, CMake should take care of dependencies
|
||||||
|
3
attach
3
attach
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
sudo ./scripts/auto-updater
|
||||||
line=$(pidof hl2_linux)
|
line=$(pidof hl2_linux)
|
||||||
arr=($line)
|
arr=($line)
|
||||||
inst=$1
|
inst=$1
|
||||||
@ -58,5 +59,3 @@ rm $FILENAME
|
|||||||
|
|
||||||
sudo killall -18 steamwebhelper
|
sudo killall -18 steamwebhelper
|
||||||
sudo killall -18 steam
|
sudo killall -18 steam
|
||||||
|
|
||||||
sudo ./scripts/auto-updater &
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
sudo ./scripts/auto-updater
|
||||||
line=$(pidof hl2_linux)
|
line=$(pidof hl2_linux)
|
||||||
arr=($line)
|
arr=($line)
|
||||||
inst=$1
|
inst=$1
|
||||||
@ -57,8 +58,6 @@ gdb -n -q -batch \
|
|||||||
sudo killall -18 steamwebhelper
|
sudo killall -18 steamwebhelper
|
||||||
sudo killall -18 steam
|
sudo killall -18 steam
|
||||||
|
|
||||||
sudo ./scripts/auto-updater &
|
|
||||||
|
|
||||||
gdb -n -q -batch \
|
gdb -n -q -batch \
|
||||||
-ex "attach $proc" \
|
-ex "attach $proc" \
|
||||||
-ex "continue" \
|
-ex "continue" \
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
# Thank you LWSS
|
# Thank you LWSS
|
||||||
# https://github.com/LWSS/Fuzion/commit/a53b6c634cde0ed47b08dd587ba40a3806adf3fe
|
# https://github.com/LWSS/Fuzion/commit/a53b6c634cde0ed47b08dd587ba40a3806adf3fe
|
||||||
|
|
||||||
|
sudo ./scripts/auto-updater
|
||||||
line=$(pidof hl2_linux)
|
line=$(pidof hl2_linux)
|
||||||
arr=($line)
|
arr=($line)
|
||||||
inst=$1
|
inst=$1
|
||||||
@ -61,5 +62,3 @@ sudo gdb -n -q -batch \
|
|||||||
-ex "quit"
|
-ex "quit"
|
||||||
|
|
||||||
sudo rm "/lib/i386-linux-gnu/${FILENAME}"
|
sudo rm "/lib/i386-linux-gnu/${FILENAME}"
|
||||||
|
|
||||||
sudo ./scripts/auto-updater &
|
|
||||||
|
@ -5,8 +5,6 @@ if [ $EUID == 0 ]; then
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm ../install-all # remove install file
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Install base Dependencies
|
# Install base Dependencies
|
||||||
#
|
#
|
||||||
@ -21,9 +19,8 @@ fi
|
|||||||
# Update cathook
|
# Update cathook
|
||||||
#
|
#
|
||||||
|
|
||||||
git fetch # fetch github repo for udpates
|
git pull --depth 1 origin # pull changes from github
|
||||||
git pull origin # pull changes from github
|
git submodule update --depth 1 --init --recursive # update/init submodules
|
||||||
git submodule update --init --recursive # update/init submodules
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Build cathook
|
# Build cathook
|
||||||
|
@ -1,29 +1,14 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
if [ ! -f ./scripts/updater-preferences ]; then
|
||||||
LOCKFILE=/tmp/chupdater.lock
|
while true; do
|
||||||
if [ -e ${LOCKFILE} ] && ps -p `cat ${LOCKFILE}` >/dev/null; then
|
read -p "Do you wan't to enable the cathook auto updater? y/n " yn
|
||||||
echo -e "\033[1;31m \n \nAuto Updater: Auto Updater already running in the background\n\033[0m"
|
case $yn in
|
||||||
exit 1
|
[Yy]* ) echo true > ./scripts/updater-preferences; break;;
|
||||||
|
[Nn]* ) echo false > ./scripts/updater-preferences; exit;;
|
||||||
|
* ) echo "Please answer yes or no.";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
if [ `cat ./scripts/updater-preferences` == "true" ]; then
|
||||||
# make sure the lockfile is removed when we exit and then claim it
|
./scripts/run-update &
|
||||||
trap "rm -f ${LOCKFILE}; exit" INT TERM EXIT
|
|
||||||
echo $$ > ${LOCKFILE}
|
|
||||||
|
|
||||||
echo -e "\033[1;34m \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 >/dev/null' || { echo -e "\033[1;31m \n \nAuto Updater: Failed to pull from github!\n\033[0m"; exit 1; }
|
|
||||||
|
|
||||||
pushd build >/dev/null || exit 1
|
|
||||||
|
|
||||||
if [ $(id -u) -eq 0 ]; then
|
|
||||||
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; }
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo -u $LOGNAME bash -c 'cmake .. >/dev/null && nice -n 10 cmake --build . --target cathook -- -j 1 >/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
|
|
||||||
|
29
scripts/run-updater
Executable file
29
scripts/run-updater
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
LOCKFILE=/tmp/chupdater.lock
|
||||||
|
if [ -e ${LOCKFILE} ] && ps -p `cat ${LOCKFILE}` >/dev/null; then
|
||||||
|
echo -e "\033[1;31m \n \nAuto Updater: Auto Updater already running in the background\n\033[0m"
|
||||||
|
exit 1
|
||||||
|
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;34m \n \nAuto Updater: Updating cathook in the background\n\033[0m"
|
||||||
|
|
||||||
|
sudo -u $LOGNAME bash -c 'git pull --depth 1 origin >/dev/null && git submodule update --depth 1 --init --recursive >/dev/null' || { echo -e "\033[1;31m \n \nAuto Updater: Failed to pull from github!\n\033[0m"; exit 1; }
|
||||||
|
|
||||||
|
pushd build >/dev/null || exit 1
|
||||||
|
|
||||||
|
if [ $(id -u) -eq 0 ]; then
|
||||||
|
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; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
sudo -u $LOGNAME bash -c 'cmake .. >/dev/null && nice -n 10 cmake --build . --target cathook -- -j 1 >/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
|
2
update
2
update
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#Get updated source code
|
#Get updated source code
|
||||||
git fetch && git pull origin && git submodule update --init --recursive || { echo -e "\033[1;31m \n \nFailed to pull from github!"; exit 1; }
|
git pull --depth 1 origin && git submodule update --depth 1 --init --recursive || { echo -e "\033[1;31m \n \nFailed to pull from github!"; exit 1; }
|
||||||
#Update cathook
|
#Update cathook
|
||||||
cd build && cmake .. && cmake --build . --target cathook -- -j$(grep -c '^processor' /proc/cpuinfo) || { echo -e "\033[1;31m \n \nFailed to compile cathook"; exit 1; }
|
cd build && cmake .. && cmake --build . --target cathook -- -j$(grep -c '^processor' /proc/cpuinfo) || { echo -e "\033[1;31m \n \nFailed to compile cathook"; exit 1; }
|
||||||
#Update data
|
#Update data
|
||||||
|
Reference in New Issue
Block a user