diff --git a/scripts/autoconf.h b/scripts/autoconf.h deleted file mode 100644 index c5eac977..00000000 --- a/scripts/autoconf.h +++ /dev/null @@ -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 diff --git a/scripts/depcheck b/scripts/depcheck index ad5c2e68..c7e7ac6f 100755 --- a/scripts/depcheck +++ b/scripts/depcheck @@ -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 } diff --git a/scripts/depends b/scripts/depends index 9b36167d..f9d19a47 100755 --- a/scripts/depends +++ b/scripts/depends @@ -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"); \ No newline at end of file +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"); \ No newline at end of file diff --git a/scripts/depinstall b/scripts/depinstall new file mode 100755 index 00000000..1e4721c3 --- /dev/null +++ b/scripts/depinstall @@ -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 \ No newline at end of file diff --git a/scripts/donate b/scripts/donate deleted file mode 100755 index 6adb31aa..00000000 --- a/scripts/donate +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -xdg-open https://patreon.com/nullifiedcat >/dev/null 2>&1 & \ No newline at end of file diff --git a/scripts/inject b/scripts/inject new file mode 100755 index 00000000..e69de29b diff --git a/scripts/libs.txt b/scripts/libs.txt deleted file mode 100644 index 092bd989..00000000 --- a/scripts/libs.txt +++ /dev/null @@ -1 +0,0 @@ -libssl-dev:i386 libsdl2-dev libfreetype6-dev libfreetype6-dev:i386 libglew-dev libglew-dev:i386 \ No newline at end of file diff --git a/scripts/menu b/scripts/menu index db275ba0..2af5c504 100755 --- a/scripts/menu +++ b/scripts/menu @@ -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 ;; diff --git a/scripts/update b/scripts/update index 633f369a..e415983b 100755 --- a/scripts/update +++ b/scripts/update @@ -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 \ No newline at end of file +update + +$DIALOG --title "Done" --backtitle "Updating" --msgbox "Updating process is done. You have to build cathook again now." 8 78