update scripts

This commit is contained in:
nullifiedcat 2017-12-09 22:49:27 +03:00
parent be535e1d7c
commit 5b917b7752
9 changed files with 121 additions and 30 deletions

View File

@ -1,5 +0,0 @@
/* This config is generated by scripts/configure */
#define CONFIG_FEATURE_aimbot 1
#define CONFIG_FEATURE_esp 0
#define CONFIG_FEATURE_test 1
#define CONFIG_ENABLE_XOVERLAY 1

View File

@ -51,15 +51,24 @@ gauge_deps_headers ()
return 0
}
BAD=0
check_all_deps ()
{
gauge_deps_libraries | whiptail --title "Checking libraries" --gauge "Please wait" 6 78 0
if ! [ ${PIPESTATUS[0]} == 0 ]; then
whiptail --title "Error: missing library" --msgbox "It appears that you don't have library '$(cat $STATUS_MISSING)' installed. Please install it and try again." 8 78
$DIALOG --title "Error: missing library" --msgbox "It appears that you don't have library '$(cat $STATUS_MISSING)' installed. Please install it and try again." 8 78
BAD=1
fi
gauge_deps_headers | whiptail --title "Checking headers" --gauge "Please wait" 6 78 0
if ! [ ${PIPESTATUS[0]} == 0 ]; then
whiptail --title "Error: missing header" --msgbox "It appears that you don't have header '$(cat $STATUS_MISSING)' installed. Please install it and try again." 8 78
$DIALOG --title "Error: missing header" --msgbox "It appears that you don't have header '$(cat $STATUS_MISSING)' installed. Please install it and try again." 8 78
BAD=1
fi
if [ BAD == 1 ]; then
$DIALOG --title "Failure" --msgbox "It looks like you need to install some additional libraries, you can do that from main menu." 8 78
else
$DIALOG --title "Success" --msgbox "You have all the libraries you need to build and use cathook!" 7 68
fi
}

View File

@ -5,4 +5,5 @@
# do not depend on X libraries if Xoverlay is disabled
DEPENDS_LIBRARIES=(ssl m rt GL freetype GLEW png X11 Xext pthread Xfixes);
DEPENDS_HEADERS=("SDL2/SDL.h" "freetype2/freetype/config/ftheader.h" "openssl/err.h" "GL/gl.h" "GL/glew.h");
DEPENDS_HEADERS=("SDL2/SDL.h" "freetype2/freetype/config/ftheader.h" "openssl/err.h" "GL/gl.h" "GL/glew.h");
DEPENDS_PACKAGES=("gcc-6" "g++-6" "gcc-6-multilib" "g++-6-multilib" "libssl-dev:i386" "libsdl2-dev" "libfreetype6-dev" "libfreetype6-dev:i386" "libglew-dev" "libglew-dev:i386");

41
scripts/depinstall Executable file
View File

@ -0,0 +1,41 @@
#!/usr/bin/env bash
. common
. depends
$DIALOG --title "Install?" --backtitle "Installing" --yesno "The script will probably need to install some additional packages using apt, and this probably can break something, so you should use it at your own risk." 9 78
if [ $? == 1 ]; then exit; fi
package_exists ()
{
dpkg -s $1 2>&1 | grep Status >/dev/null 2>&1
return $?
}
gauge_deps_packages ()
{
local I=0
for package in "${DEPENDS_PACKAGES[@]}"
do
# unholy
local percent=$(echo "scale=2; $I / ${#DEPENDS_PACKAGES[*]} * 100" | bc | sed s/\\.[0-9]\\+//)
printf 'XXX\n%d\nChecking for package "%s"...\nXXX\n' $percent "$package"
if ! package_exists $package; then
printf 'XXX\n%d\nInstalling "%s"...\nXXX\n' $percent "$package"
gksu -- apt install -y $package >/dev/null 2>&1
fi
I=$(($I + 1))
# Sleep so the user sees the package name
sleep 0.3
done
return 0
}
gauge_deps_packages | whiptail --title "Installing packages" --gauge "Please wait" 6 78 0
$DIALOG --title "Success" --msgbox "Installed successfully." 8 78
if ! [ ${PIPESTATUS[0]} == 0 ]; then
$DIALOG --title "Error: error" --msgbox "It appears that you have error. Please fix it." 8 78
fi

View File

@ -1,3 +0,0 @@
#!/usr/bin/env bash
xdg-open https://patreon.com/nullifiedcat >/dev/null 2>&1 &

0
scripts/inject Executable file
View File

View File

@ -1 +0,0 @@
libssl-dev:i386 libsdl2-dev libfreetype6-dev libfreetype6-dev:i386 libglew-dev libglew-dev:i386

View File

@ -10,33 +10,61 @@ While cathook can work on most distros, most helper scripts can work incorrectly
If you have trouble, you can visit cathook's official telegram channel and ask for help from other users of your distro there." 15 50
fi
USER=$($DIALOG --title "Main Menu" --menu "What do you want to do?" 20 40 7 \
"I" "Inject" \
"B" "Build" \
"T" "Troubleshoot" \
"S" "Suggestion or bug report" \
"P" "Support the creator" \
"F" "Format sources" \
"U" "Update" 3>&1 1>&2 2>&3)
USER=$($DIALOG --title "Main Menu (WIP)" --menu "What do you want to do?" 20 60 11 \
"DEP" "| Check requirements (Ubuntu)" \
"INS" "| Install libraries (Ubuntu)" \
"BLD" "| Build" \
"INJ" "| Inject" \
"FIX" "| Troubleshoot (WIP)" \
"BUG" "| Suggestion or bug report" \
"TGA" "| Join announcements channel in Telegram" \
"TGB" "| Join community channel in Telegram" \
"PAT" "| Support the creator" \
"FMT" "| Format sources" \
"UPD" "| Update" 3>&1 1>&2 2>&3)
case "$USER" in
"I")
"CHK")
. depcheck
exit
;;
"B")
"INS")
. depinstall
exit
;;
"T")
"BLD")
. build
exit
;;
"INJ")
. inject
exit
;;
"FIX")
. troubleshoot
exit
;;
"P")
. donate
"BUG")
xdg-open https://github.com/nullifiedcat/cathook/issues >/dev/null 2>&1 &
exit
;;
"F")
"TGA")
xdg-open tg://resolve?domain=cathook_cheat >/dev/null 2>&1 &
exit
;;
"TGB")
xdg-open tg://resolve?domain=nullifiedcat >/dev/null 2>&1 &
exit
;;
"PAT")
xdg-open https://patreon.com/nullifiedcat >/dev/null 2>&1 &
exit
;;
"FMT")
. format
exit
;;
"U")
"UPD")
. update
exit
;;

View File

@ -1,6 +1,27 @@
#!/usr/bin/env bash
. common
update()
{
git fetch >update.log
if ! git pull origin $(git rev-parse --abbrev-ref HEAD) >>update.log; then
$DIALOG --title "Error" --backtitle "Updating" --msgbox "An error occured while updating cathook, check update.log for details. It might have been caused by changes in local files - in that case try resetting local repo." 8 78
exit
fi
if ! git submodule update --remote --recursive >>update.log; then
$DIALOG --title "Error" --backtitle "Updating" --msgbox "An error occured while updating cathook, check update.log for details. It might have been caused by changes in local files - in that case try resetting local repo." 8 78
exit
fi
make clean
}
$DIALOG --title "Update?" --backtitle "Updating" --yesno "Warning: this will erase your current build of cathook, you will have to build it again after updating." 8 78
if [ $? == 1 ]; then exit; fi
echo "Please wait while cathook is updating"
cd ..
git pull origin master
git submodule update --remote --recursive
make clean
update
$DIALOG --title "Done" --backtitle "Updating" --msgbox "Updating process is done. You have to build cathook again now." 8 78