update comments for scripts
This commit is contained in:
parent
c857349218
commit
c78571b128
@ -25,7 +25,7 @@ if [ ! -t 0 ]; then
|
||||
fi
|
||||
|
||||
#
|
||||
# Git check
|
||||
# Git check, migrate users from .zip to git repos
|
||||
#
|
||||
if [ "$PRE_UPDATE" == "true" ]; then
|
||||
if [ ! -x "$(command -v git)" ]; then
|
||||
@ -66,6 +66,7 @@ function migrations() {
|
||||
cfg_write $configfile version $CURR_VERSION
|
||||
fi
|
||||
|
||||
# Hack to fix compile error between version 1 and version 3. Version 2 was set on installs on accident.
|
||||
if [ "$version" == 1 ] || [ "$version" == 2 ]; then
|
||||
cfg_write $configfile version 3
|
||||
if [ -d "./build/CMakeFiles/cathook.dir" ]; then
|
||||
@ -75,7 +76,7 @@ function migrations() {
|
||||
}
|
||||
|
||||
if [ "$PRE_UPDATE" == "true" ] && [ "$INIT" == "true" ]; then
|
||||
# Our job is done here
|
||||
# Our job is done here. We dont want to set a config version here yet.
|
||||
exit
|
||||
fi
|
||||
|
||||
|
@ -12,6 +12,7 @@ set -e
|
||||
|
||||
configfile="./scripts/updater-preferences"
|
||||
|
||||
# Verify that we aren't root
|
||||
if [ $(id -u) -eq 0 ]; then
|
||||
echo -e "\033[1;33m \n \nThis script must'nt be run as root!\n\033[0m"
|
||||
exit 1
|
||||
@ -29,6 +30,7 @@ echo $$ > ${LOCKFILE}
|
||||
|
||||
. ./scripts/config.shlib
|
||||
|
||||
# If the config file doesn't exist, create it
|
||||
if [ ! -e ${configfile} ]; then
|
||||
touch ${configfile}
|
||||
fi
|
||||
@ -49,7 +51,7 @@ if [ ! -x "$(command -v dialog)" ] || [ "$tui" == false ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Run migrations
|
||||
# Run migrations if not a developer
|
||||
exists=true
|
||||
cfg_haskey $configfile update_channel || exists=false
|
||||
if [ "$exists" == true ]; then
|
||||
@ -59,6 +61,7 @@ if [ "$update_channel" != "developer" ]; then
|
||||
./scripts/migrations $tui $INIT true || exit 1
|
||||
fi
|
||||
|
||||
# Ask the user if they want to enable the auto updater
|
||||
exists=true
|
||||
cfg_haskey $configfile autoupdater || exists=false
|
||||
if [ "$dialog" == true ] && [ "$exists" == false ]; then
|
||||
@ -74,6 +77,7 @@ if [ "$dialog" == true ] && [ "$exists" == false ]; then
|
||||
cfg_write $configfile autoupdater $value
|
||||
fi
|
||||
|
||||
# Send notice about auto updater, terminate script if its not enabled
|
||||
exists=true
|
||||
cfg_haskey $configfile autoupdater || exists=false
|
||||
if [ "$AUTO_UPDATER_ENABLED" == "true" ]; then
|
||||
@ -112,7 +116,7 @@ function performupdate() {
|
||||
value=true
|
||||
dialog --keep-tite --title "Updater" --yesno "Unknown update channel or version. Restore to stable update channel and reset version?" 10 25 || value=false
|
||||
if [ "$value" == true ]; then
|
||||
# force init
|
||||
# force reinit
|
||||
./scripts/migrations $tui true false || exit 1
|
||||
fi
|
||||
fi
|
||||
@ -127,14 +131,15 @@ function performupdate() {
|
||||
# Check if all required packages are installed
|
||||
./scripts/dependencycheck
|
||||
|
||||
#submodules
|
||||
# Submodules
|
||||
if [ "$update_channel" == "developer" ]; then
|
||||
git submodule update --init --recursive
|
||||
else
|
||||
git submodule sync
|
||||
git submodule sync > /dev/null
|
||||
git submodule update --depth 1 --init --recursive
|
||||
fi
|
||||
|
||||
# Make sure that the auto updater only uses 1 core for compiling
|
||||
proccount=$(grep -c '^processor' /proc/cpuinfo)
|
||||
if [ "$AUTOUPDATER" == true ]; then
|
||||
proccount=1
|
||||
@ -143,9 +148,10 @@ function performupdate() {
|
||||
#Create build folder in case it doesn't exist
|
||||
mkdir -p ./build
|
||||
# Update cathook
|
||||
cd build && cmake .. && cmake --build . --target cathook -- -j$proccount || { echo -e "\033[1;31m \n \nFailed to compile cathook\n\033[0m"; exit 1; }
|
||||
pushd build && cmake .. && cmake --build . --target cathook -- -j$proccount || { echo -e "\033[1;31m \n \nFailed to compile cathook\n\033[0m"; exit 1; }
|
||||
# Update data
|
||||
cmake --build . --target data || { echo -e "\033[1;31m\nFailed to update /opt/cathook/data directory! Trying with root rights!\n\033[0m"; sudo cmake --build . --target data || { echo -e "\033[1;31m\nFailed to update /opt/cathook/data directory\n\033[0m"; exit 1; } }
|
||||
popd
|
||||
echo -e "\n\033[1;34mCathook updated successfully\n\033[0m"
|
||||
rm -f ${LOCKFILE}
|
||||
}
|
||||
|
Reference in New Issue
Block a user