add support for pkexec

This commit is contained in:
TotallyNotElite 2019-08-19 16:32:02 +02:00
parent 5157aa45b7
commit bc58ddeb8a

View File

@ -1,9 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if [ $EUID == 0 ]; then RUNUSER="sudo -u $(logname)"
echo "This script must not be run as root"
exit
fi
# #
# Install git in case this is a install-all only install # Install git in case this is a install-all only install
@ -21,12 +18,12 @@ fi
# Update cathook # Update cathook
# #
if [ ! -d "./.git" ]; then if [ ! -d "./.git" ]; then
git init $RUNUSER git init
git remote add origin https://github.com/nullworks/cathook $RUNUSER git remote add origin https://github.com/nullworks/cathook
fi fi
git fetch --force --depth 1 origin refs/tags/latest:refs/tags/latest && git reset --hard latest # pull changes from github $RUNUSER git fetch --force --depth 1 origin refs/tags/latest:refs/tags/latest && $RUNUSER git reset --hard latest # pull changes from github
git submodule update --depth 1 --init --recursive # update/init submodules $RUNUSER git submodule update --depth 1 --init --recursive # update/init submodules
# install all dependencies and allow non interactive install # install all dependencies and allow non interactive install
./scripts/dependencycheck true ./scripts/dependencycheck true
@ -35,14 +32,13 @@ git submodule update --depth 1 --init --recursive # update/init submodules
# Set config version for update script # Set config version for update script
# #
. ./scripts/config.shlib $RUNUSER bash -c ". ./scripts/config.shlib; cfg_write ./scripts/updater-preferences version 1"
cfg_write ./scripts/updater-preferences version 1
# #
# Build cathook # Build cathook
# #
mkdir -p ./build; pushd build #create a directory for building cathook $RUNUSER mkdir -p ./build; pushd build #create a directory for building cathook
cmake ..;make -j$(grep -c '^processor' /proc/cpuinfo) # create makefile and build using all available threads $RUNUSER cmake ..;$RUNUSER make -j$(grep -c '^processor' /proc/cpuinfo) # create makefile and build using all available threads
sudo make data # create /opt/cathook/data $RUNUSER sudo make data # create /opt/cathook/data
popd; cd .. popd; cd ..