From 8f33d775c64b6545105c4a2d036d171069aa42b7 Mon Sep 17 00:00:00 2001 From: TotallyNotElite <1yourexperiment@protonmail.com> Date: Thu, 11 Feb 2021 21:08:43 +0100 Subject: [PATCH] Add proper support for updater self update Also remove old scripts --- scripts/old/attach-backtrace | 41 --------- scripts/old/attach-backtrace-scramble.sh | 51 ----------- scripts/old/attach-noscramble | 53 ----------- scripts/old/attach-pid | 21 ----- scripts/old/attach-user | 46 ---------- scripts/old/catlibs | 29 ------ scripts/old/common | 13 --- scripts/old/configure | 33 ------- scripts/old/depcheck | 76 ---------------- scripts/old/depends | 9 -- scripts/old/depinstall | 45 --------- scripts/old/detach | 37 -------- scripts/old/detach-backtrace | 38 -------- scripts/old/inject | 0 scripts/old/make-nogui.sh | 2 - scripts/old/menu | 76 ---------------- scripts/old/preload.sh | 111 ----------------------- scripts/old/reattach | 3 - scripts/old/troubleshoot | 11 --- scripts/updater | 30 +++--- 20 files changed, 19 insertions(+), 706 deletions(-) delete mode 100755 scripts/old/attach-backtrace delete mode 100755 scripts/old/attach-backtrace-scramble.sh delete mode 100755 scripts/old/attach-noscramble delete mode 100755 scripts/old/attach-pid delete mode 100755 scripts/old/attach-user delete mode 100755 scripts/old/catlibs delete mode 100755 scripts/old/common delete mode 100755 scripts/old/configure delete mode 100755 scripts/old/depcheck delete mode 100755 scripts/old/depends delete mode 100755 scripts/old/depinstall delete mode 100755 scripts/old/detach delete mode 100755 scripts/old/detach-backtrace delete mode 100755 scripts/old/inject delete mode 100755 scripts/old/make-nogui.sh delete mode 100755 scripts/old/menu delete mode 100755 scripts/old/preload.sh delete mode 100755 scripts/old/reattach delete mode 100755 scripts/old/troubleshoot diff --git a/scripts/old/attach-backtrace b/scripts/old/attach-backtrace deleted file mode 100755 index 52616dbf..00000000 --- a/scripts/old/attach-backtrace +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash - -line=$(pidof hl2_linux) -arr=($line) -inst=$1 -if [ $# == 0 ]; then - inst=0 -fi - -if [ ${#arr[@]} == 0 ]; then - echo tf2 isn\'t running! - exit -fi - -if [ $inst -gt ${#arr[@]} ] || [ $inst == ${#arr[@]} ]; then - echo wrong index! - exit -fi - -proc=${arr[$inst]} - -echo Running instances: "${arr[@]}" -echo Attaching to "$proc" - -sudo ./detach $inst bin/libcathook.so - -if grep -q "$(realpath bin/libcathook.so)" /proc/"$proc"/maps; then - echo already loaded - exit -fi - -echo loading "$(realpath bin/libcathook.so)" to "$proc" -gdb -n -q -batch \ - -ex "attach $proc" \ - -ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \ - -ex "call \$dlopen(\"$(realpath bin/libcathook.so)\", 1)" \ - -ex "call dlerror()" \ - -ex 'print (char *) $2' \ - -ex "catch syscall exit exit_group" \ - -ex "continue" \ - -ex "backtrace" diff --git a/scripts/old/attach-backtrace-scramble.sh b/scripts/old/attach-backtrace-scramble.sh deleted file mode 100755 index 3a586022..00000000 --- a/scripts/old/attach-backtrace-scramble.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env bash - -line=$(pidof hl2_linux) -arr=($line) -inst=$1 -if [ $# == 0 ]; then - inst=0 -fi - -if [ ${#arr[@]} == 0 ]; then - echo tf2 isn\'t running! - exit -fi - -if [ $inst -gt ${#arr[@]} ] || [ $inst == ${#arr[@]} ]; then - echo wrong index! - exit -fi - -proc=${arr[$inst]} - -echo Running instances: "${arr[@]}" - -FILENAME="/tmp/.gl$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1)" -cp "bin/libcathook.so" "$FILENAME" - -echo Attaching to "$proc" - -sudo ./detach $inst bin/libcathook.so - -if grep -q "$FILENAME" /proc/"$proc"/maps; then - echo already loaded - exit -fi - -sudo killall -19 steam -sudo killall -19 steamwebhelper - -echo loading "$FILENAME" to "$proc" -gdb -n -q -batch \ - -ex "attach $proc" \ - -ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \ - -ex "call \$dlopen(\"$FILENAME\", 1)" \ - -ex "call dlerror()" \ - -ex "print (char *) $2" \ - -ex "catch syscall exit exit_group" \ - -ex "continue" \ - -ex "backtrace" - -sudo killall -18 steamwebhelper -sudo killall -18 steam diff --git a/scripts/old/attach-noscramble b/scripts/old/attach-noscramble deleted file mode 100755 index 1e7d3279..00000000 --- a/scripts/old/attach-noscramble +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env bash - -if [ $UID == "0" ]; then - echo "Don't run as root!" - exit -fi - -user=$USER - -if [ "$#" == 1 ]; then - user=$1 -fi - -proc="0" - -for pid in $(pidof hl2_linux) -do - if sudo -H -u $user kill -0 $pid - then - proc=$pid - break - fi -done - -echo Attaching to "$proc" - -if sudo grep -q "libcathook.so" /proc/"$proc"/maps; then - echo already loaded - exit -fi - -# pBypass for crash dumps being sent -# You may also want to consider using -nobreakpad in your launch options. -sudo rm -rf /tmp/dumps # Remove if it exists -sudo mkdir /tmp/dumps # Make it as root -sudo chmod 000 /tmp/dumps # No permissions - -cp "bin/libcathook.so" /tmp - -FILENAME=/tmp/libcathook.so - -echo loading "$FILENAME" to "$proc" - -sudo gdb -n -q -batch \ - -ex "attach $proc" \ - -ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \ - -ex "call \$dlopen(\"$FILENAME\", 1)" \ - -ex "call dlerror()" \ - -ex 'print (char *) $2' \ - -ex "detach" \ - -ex "quit" - -rm /tmp/libcathook.so \ No newline at end of file diff --git a/scripts/old/attach-pid b/scripts/old/attach-pid deleted file mode 100755 index c91d6152..00000000 --- a/scripts/old/attach-pid +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -proc=${1:-$(ps $(pidof gameoverlayui) | tail -n1 | cut -d\- -f2 | cut -d\ -f2)} -if ! [[ $proc =~ ^[0-9]+$ ]]; then - echo "Couldn't find process! Are you sure a game is running?" >&2; exit 1 -fi - -if grep -q "$(realpath bin/libcathook.so)" /proc/"$proc"/maps; then - echo already loaded - exit -fi - -echo loading "$(realpath bin/libcathook.so)" to "$proc" -gdb -n -q -batch \ - -ex "attach $proc" \ - -ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \ - -ex "call \$dlopen(\"$(realpath bin/libcathook.so)\", 1)" \ - -ex "call dlerror()" \ - -ex 'print (char *) $2' \ - -ex "detach" \ - -ex "quit" diff --git a/scripts/old/attach-user b/scripts/old/attach-user deleted file mode 100755 index 7d999c17..00000000 --- a/scripts/old/attach-user +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env bash - -user=$USER - -if [ "$#" == 1 ]; then - user=$1 -fi - -proc="0" - -for pid in $(pidof hl2_linux) -do - if sudo -H -u $user kill -0 $pid - then - proc=$pid - break - fi -done - - -if [ "$proc" == "0" ] -then - echo "TF2 for $user is not running" - continue -fi - -echo Attaching to "$proc" - -FILENAME=$(realpath "bin/libcathook.so") - -echo loading "$FILENAME" to "$proc" - -sudo killall -19 steam -sudo killall -19 steamwebhelper - -sudo gdb -n -q -batch \ - -ex "attach $proc" \ - -ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \ - -ex "call \$dlopen(\"$FILENAME\", 1)" \ - -ex "call dlerror()" \ - -ex 'print (char *) $2' \ - -ex "detach" \ - -ex "quit" - -sudo killall -18 steamwebhelper -sudo killall -18 steam \ No newline at end of file diff --git a/scripts/old/catlibs b/scripts/old/catlibs deleted file mode 100755 index 87752f78..00000000 --- a/scripts/old/catlibs +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - -. common - -$DIALOG --title "Install?" --backtitle "Installing catlibs" --yesno "This script will ask you for superuser password to install xoverlay and glez." 9 78 -if [ $? == 1 ]; then exit; fi - -SU=gksu - -if ! command -v gksu; then - SU=sudo - exit -fi - -pushd ../libxoverlay -if ! make -e ARCH=32 >/tmp/buildxoverlay.log 2>&1; then - $DIALOG --title "Build failed" --msgbox "Failed to build libxoverlay. See /tmp/buildxoverlay.log for more info." 9 78 - exit -fi -$SU make install -popd - -pushd ../libglez -if ! make -e ARCH=32 >/tmp/buildglez.log 2>&1; then - $DIALOG --title "Build failed" --msgbox "Failed to build libglez. See /tmp/buildglez.log for more info." 9 78 - exit -fi -$SU make install -popd \ No newline at end of file diff --git a/scripts/old/common b/scripts/old/common deleted file mode 100755 index b1ebb7f9..00000000 --- a/scripts/old/common +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -DIALOG="whiptail --clear" - -echo_ok () -{ - echo -e "\033[32m\e[1mOK\e[0m" -} - -echo_error () -{ - echo -e "\033[31m\e[1mERROR\e[0m" -} \ No newline at end of file diff --git a/scripts/old/configure b/scripts/old/configure deleted file mode 100755 index 951080ef..00000000 --- a/scripts/old/configure +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -. common - -CONFIG=autoconf.h -echo "/* This config is generated by scripts/configure */" >$CONFIG - -FEATURES=(aimbot esp test); - -declare -A features -for feature in "${FEATURES[@]}" -do - features[\"$feature\"]=0 -done - -enabled=$($DIALOG --backtitle "Configure cathook" --checklist "Select features you want to enable" 20 78 4 \ - aimbot "Enable Aimbot" ON \ - esp "Enable ESP" ON \ - test "Test" OFF \ - 3>&2 2>&1 1>&3) - -for feature in $enabled -do - features[$feature]="1" -done - -for feature in ${FEATURES[@]} -do - echo "#define CONFIG_FEATURE_$feature ${features[\"$feature\"]}">>$CONFIG -done - -! $DIALOG --backtitle "Configure cathook" --yesno "Use Xoverlay to draw visuals outside TF2's window (can be buggy and is NOT compatible with Steam overlay!)" 10 40 3>&2 2>&1 1>&3 -echo "#define CONFIG_ENABLE_XOVERLAY $?" >>$CONFIG \ No newline at end of file diff --git a/scripts/old/depcheck b/scripts/old/depcheck deleted file mode 100755 index f0d9e6ba..00000000 --- a/scripts/old/depcheck +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env bash - -. depends -. common - -library_exists () -{ - ld -melf_i386 -l$1 -o /dev/null >/dev/null 2>&1 - return $? -} - -header_exists () -{ - echo "#include <$1>" | g++ -x c++ - -fsyntax-only -o /dev/null >/dev/null 2>&1 - return $? -} - -STATUS_MISSING=$(mktemp) - -gauge_deps_libraries () -{ - local I=0 - for lib in "${DEPENDS_LIBRARIES[@]}" - do - # unholy - local percent=$(echo "scale=2; $I / ${#DEPENDS_LIBRARIES[*]} * 100" | bc | sed s/\\.[0-9]\\+//) - printf 'XXX\n%d\nChecking for library "%s"...\nXXX\n' $percent "$lib" - if ! library_exists $lib; then - echo $lib >$STATUS_MISSING - return 1 - fi - I=$(($I + 1)) - done - return 0 -} - -gauge_deps_headers () -{ - local I=0 - for header in "${DEPENDS_HEADERS[@]}" - do - # unholy - local percent=$(echo "scale=2; $I / ${#DEPENDS_HEADERS[*]} * 100" | bc | sed s/\\.[0-9]\\+//) - printf 'XXX\n%d\nChecking for header <%s>...\nXXX\n' $percent "$header" - if ! header_exists $header; then - echo $header >$STATUS_MISSING - return 1 - fi - I=$(($I + 1)) - done - 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 - $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 - $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 -} - -check_all_deps -rm $STATUS_MISSING \ No newline at end of file diff --git a/scripts/old/depends b/scripts/old/depends deleted file mode 100755 index 52f4d7c1..00000000 --- a/scripts/old/depends +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -# TODO -# do not depend on graphical libraries if compiling for textmode -# do not depend on X libraries if Xoverlay is disabled - -DEPENDS_LIBRARIES=(ssl m rt GL freetype GLEW png X11 Xext pthread Xfixes xoverlay glez); -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" "libpng-dev" "libpng-dev:i386" "libboost-all-dev"); diff --git a/scripts/old/depinstall b/scripts/old/depinstall deleted file mode 100755 index 139a85a7..00000000 --- a/scripts/old/depinstall +++ /dev/null @@ -1,45 +0,0 @@ -#!/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 -} - -if ! package_exists "gksu"; then - $DIALOG --title "gksu not installed" --msgbox "You should install gksu first. Do that with\nsudo apt install gksu" 9 78 - exit -fi - -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/old/detach b/scripts/old/detach deleted file mode 100755 index c1f22a32..00000000 --- a/scripts/old/detach +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash - -line=$(pidof hl2_linux) -arr=($line) -inst=$1 -if [ $# == 0 ]; then - inst=0 -fi - -if [ ${#arr[@]} == 0 ]; then - echo TF2 isn\'t running! - exit -fi - -if [ $inst -gt ${#arr[@]} ] || [ $inst == ${#arr[@]} ]; then - echo wrong index! - exit -fi - -echo Running instances: "${arr[@]}" -echo Detaching from "${arr[$1]}" - -if grep -q "$(realpath bin/libcathook.so)" /proc/"${arr[$1]}"/maps; then - gdb -n -q -batch \ - -ex "attach ${arr[$1]}" \ - -ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \ - -ex "set \$dlclose = (int(*)(void*)) dlclose" \ - -ex "set \$library = \$dlopen(\"$(realpath bin/libcathook.so)\", 6)" \ - -ex "print \$library" \ - -ex "sharedlibrary ." \ - -ex "call \$dlclose(\$library)" \ - -ex "call \$dlclose(\$library)" \ - -ex "detach" - echo "Detached" -else - echo "not found!" -fi diff --git a/scripts/old/detach-backtrace b/scripts/old/detach-backtrace deleted file mode 100755 index 407da3f2..00000000 --- a/scripts/old/detach-backtrace +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bash - -line=$(pidof hl2_linux) -arr=($line) -inst=$1 -if [ $# == 0 ]; then - inst=0 -fi - -if [ ${#arr[@]} == 0 ]; then - echo TF2 isn\'t running! - exit -fi - -if [ $inst -gt ${#arr[@]} ] || [ $inst == ${#arr[@]} ]; then - echo wrong index! - exit -fi - -echo Running instances: "${arr[@]}" -echo Detaching from "${arr[$1]}" - -if grep -q "$(realpath bin/libcathook.so)" /proc/"${arr[$1]}"/maps; then - gdb -n -q -batch \ - -ex "attach ${arr[$1]}" \ - -ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \ - -ex "set \$dlclose = (int(*)(void*)) dlclose" \ - -ex "set \$library = \$dlopen(\"$(realpath bin/libcathook.so)\", 6)" \ - -ex "print \$library" \ - -ex "sharedlibrary ." \ - -ex "call \$dlclose(\$library)" \ - -ex "call \$dlclose(\$library)" \ - -ex "continue" \ - -ex "backtrace" - echo "Detached" -else - echo "not found!" -fi diff --git a/scripts/old/inject b/scripts/old/inject deleted file mode 100755 index e69de29b..00000000 diff --git a/scripts/old/make-nogui.sh b/scripts/old/make-nogui.sh deleted file mode 100755 index fddbff17..00000000 --- a/scripts/old/make-nogui.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -make -j4 -e NOGUI=1 diff --git a/scripts/old/menu b/scripts/old/menu deleted file mode 100755 index ba32d635..00000000 --- a/scripts/old/menu +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env bash - -# TODO extremely unfinished - -. common - -if ! grep -qi "Ubuntu" /proc/version ; then - $DIALOG --title "WARNING" --msgbox "The script has detected that you are not using Ubuntu.\n\ -While cathook can work on most distros, most helper scripts can work incorrectly or not work at all and you may also have trouble with compiling cathook here.\n\n\ -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 (WIP)" --menu "What do you want to do?" 20 60 12 \ - "DEP" "| Check requirements (Ubuntu)" \ - "CAT" "| Install libglez and libxoverlay" \ - "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 - "DEP") - . depcheck - exit - ;; - "CAT") - . catlibs - exit - ;; - "INS") - . depinstall - exit - ;; - "BLD") - . build - exit - ;; - "INJ") - . inject - exit - ;; - "FIX") - . troubleshoot - exit - ;; - "BUG") - xdg-open https://github.com/nullifiedcat/cathook/issues >/dev/null 2>&1 & - exit - ;; - "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 - ;; - "UPD") - . update - exit - ;; -esac \ No newline at end of file diff --git a/scripts/old/preload.sh b/scripts/old/preload.sh deleted file mode 100755 index 3dff4872..00000000 --- a/scripts/old/preload.sh +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/env bash - -# Credit to LWSS for doing this shit in Fuzion, looked and pasted a stuff from his preload meme - -# This assumes the presence of the ~/.steam symlink -GAMEROOT=$(realpath $HOME/.steam/steam/steamapps/common/Team\ Fortress\ 2) -GAMEEXE="hl2_linux" - -if [ ! -d "$GAMEROOT" ]; then - echo -e "\e[91mCould not find Team Fortress 2 directory. Check if Steam symlink at $HOME/.steam exists.\e[39m" - exit -1 -fi - -export LD_LIBRARY_PATH="$GAMEROOT"\ -":$GAMEROOT/bin"\ -":$GAMEROOT/bin/linux32"\ -":$GAMEROOT/tf/bin"\ -":$HOME/.steam/ubuntu12_32"\ -":$HOME/.steam/ubuntu12_32/linux32"\ -":$HOME/.steam/ubuntu12_32/panorama"\ -":$HOME/.steam/bin32"\ -":$HOME/.steam/bin32/linux32"\ -":$HOME/.steam/bin32/panorama"\ -":/lib/i386-linux-gnu"\ -":/usr/lib/i386-linux-gnu/"\ -":/usr/lib64/atlas"\ -":/usr/lib64/bind99"\ -":/usr/lib64/iscsi"\ -":/usr/lib64/nx"\ -":/usr/lib64/qt-3.3/lib"\ -":/usr/lib"\ -":/usr/lib32"\ -":/lib64"\ -":/lib32"\ -":/usr/lib/i686"\ -":/usr/lib/sse2"\ -":/lib64/tls"\ -":/lib64/sse2"\ -":/usr/lib/steam"\ -":/usr/lib32/steam"\ -":$HOME/.steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu"\ -":$HOME/.steam/ubuntu12_32/steam-runtime/i386/lib/i386-linux-gnu"\ -":$HOME/.steam/ubuntu12_32/steam-runtime/amd64/lib/x86_64-linux-gnu"\ -":$HOME/.steam/ubuntu12_32/steam-runtime/amd64/lib"\ -":$HOME/.steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu"\ -":$HOME/.steam/ubuntu12_32/steam-runtime/amd64/usr/lib"\ -":$HOME/.steam/ubuntu12_32/steam-runtime/i386/lib/i386-linux-gnu"\ -":$HOME/.steam/ubuntu12_32/steam-runtime/i386/lib"\ -":$HOME/.steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu"\ -":$HOME/.steam/ubuntu12_32/steam-runtime/i386/usr/lib"\ -":$HOME/.steam/ubuntu12_32/steam-runtime/amd64/lib/x86_64-linux-gnu"\ -":$HOME/.steam/ubuntu12_32/steam-runtime/amd64/lib"\ -":$HOME/.steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu"\ -":$HOME/.steam/ubuntu12_32/steam-runtime/amd64/usr/lib"\ -":$HOME/.steam/ubuntu12_64"\ -":$HOME/.steam/bin32/steam-runtime/i386/usr/lib/i386-linux-gnu"\ -":$HOME/.steam/bin32/steam-runtime/i386/lib/i386-linux-gnu"\ -":$HOME/.steam/bin32/steam-runtime/amd64/lib/x86_64-linux-gnu"\ -":$HOME/.steam/bin32/steam-runtime/amd64/lib"\ -":$HOME/.steam/bin32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu"\ -":$HOME/.steam/bin32/steam-runtime/amd64/usr/lib"\ -":$HOME/.steam/bin32/steam-runtime/i386/lib/i386-linux-gnu"\ -":$HOME/.steam/bin32/steam-runtime/i386/lib"\ -":$HOME/.steam/bin32/steam-runtime/i386/usr/lib/i386-linux-gnu"\ -":$HOME/.steam/bin32/steam-runtime/i386/usr/lib"\ -":$HOME/.steam/bin32/steam-runtime/amd64/lib/x86_64-linux-gnu"\ -":$HOME/.steam/bin32/steam-runtime/amd64/lib"\ -":$HOME/.steam/bin32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu"\ -":$HOME/.steam/bin32/steam-runtime/amd64/usr/lib"\ -":$HOME/.steam/bin64"\ -":$HOME/.steam/bin" - -# Set file descriptor limit -ulimit -n 2048 - -export LD_PRELOAD -LD_PRELOAD="$(realpath .)/bin/libcathook.so:/usr/lib/i386-linux-gnu/libstdc++.so.6:/usr/lib32/libstdc++.so.6:launcher.so" - -# Enable nVidia threaded optimizations -export __GL_THREADED_OPTIMIZATIONS=1 -# Enable Mesa threaded shader compiles -export multithread_glsl_compiler=1 - -cd "$GAMEROOT" - -STATUS=42 -while [ $STATUS -eq 42 ]; do - if [ "${DEBUGGER}" == "gdb" ] || [ "${DEBUGGER}" == "cgdb" ]; then - echo -e "\e[92mSuccess! Launching TF2 using ${DEBUGGER} as debugger.\e[39m" - - ARGSFILE=$(mktemp "$(whoami)".hl2.gdb.XXXX) - echo b main > "$ARGSFILE" - - # Set the LD_PRELOAD varname in the debugger, and unset the global version. This makes it so that - # gameoverlayrenderer.so and the other preload objects aren't loaded in our debugger's process. - echo set env LD_PRELOAD=$LD_PRELOAD >> "$ARGSFILE" - echo show env LD_PRELOAD >> "$ARGSFILE" - unset LD_PRELOAD - - echo run $@ >> "$ARGSFILE" - echo show args >> "$ARGSFILE" - ${DEBUGGER} "${GAMEROOT}"/${GAMEEXE} -x -steam -game "tf" "$ARGSFILE" - rm "$ARGSFILE" - else - echo -e "\e[92mSuccess! Launching TF2.\e[39m" - ${DEBUGGER} "${GAMEROOT}"/${GAMEEXE} -steam -game "tf" "$@" - fi - STATUS=$? -done - -exit ${STATUS} diff --git a/scripts/old/reattach b/scripts/old/reattach deleted file mode 100755 index d385fb8d..00000000 --- a/scripts/old/reattach +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -sudo ./detach "$1" && sudo ./attach "$1" diff --git a/scripts/old/troubleshoot b/scripts/old/troubleshoot deleted file mode 100755 index fecd386a..00000000 --- a/scripts/old/troubleshoot +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -. common - -$DIALOG --backtitle "Troubleshooting" --title "Troubleshooting" --menu "What is your problem?" 12 40 3 \ - "C" "Compiling problems" \ - "R" "Runtime problems" \ - "O" "Other problems" - -$DIALOG --backtitle "Troubleshooting" --title "Compile problems" --menu "What is your problem?" 20 40 3 \ - "TODO" "TODO" \ No newline at end of file diff --git a/scripts/updater b/scripts/updater index ec2423be..d9dac62a 100755 --- a/scripts/updater +++ b/scripts/updater @@ -21,7 +21,7 @@ if [ $(id -u) -eq 0 ]; then fi LOCKFILE=/tmp/chupdater.lock -if [ -e ${LOCKFILE} ] && ps -p `cat ${LOCKFILE}` >/dev/null; then +if [ -e ${LOCKFILE} ] && ps -p `cat ${LOCKFILE}` >/dev/null && [ -z "$CH_UPDATER_SELFUPDATE" ]; then echo -e "\033[1;33m \n \nUpdater: Updater already running!\n\033[0m" exit 1 fi @@ -48,9 +48,6 @@ if [ "$DISABLE_TUI" == "true" ]; then fi if [ ! -x "$(command -v dialog)" ] || [ "$tui" == false ]; then dialog=false - if [ "$tui" == true ]; then - echo -e "\033[1;31mTerminal UI NOT supported! Install \"dialog\"! \033[0m" - fi fi # Run migrations if not a developer @@ -67,14 +64,14 @@ fi exists=true cfg_haskey $configfile autoupdater || exists=false if [ "$dialog" == true ] && [ "$exists" == false ]; then - value=true + value=false response=255 while [ "$response" != 0 ] && [ "$response" != 1 ]; do dialog --keep-tite --title "Updater" --yesno "Do you want to enable the cathook auto updater?" 10 25 || { response=$?; continue; } response=$? done - if [ "$response" == 1 ]; then - value=false + if [ "$response" == 0 ]; then + value=true fi cfg_write $configfile autoupdater $value fi @@ -106,12 +103,15 @@ function performupdate() { fi fi + # Store info about the currently checked out updater script hash + OLD_UPDATE=$(git rev-parse HEAD:scripts/updater) + if [ "$update_channel" == "stable" ]; then git fetch --force --depth 1 origin refs/tags/stable:refs/tags/stable && git reset --hard stable || { echo -e "\033[1;33m\nFailed to pull from github! Trying alternative pull (legacy)\n\033[0m"; git fetch --depth 1 && git reset --hard @{upstream} || { echo -e "\033[1;31m\nFailed to pull from github! A reinstall is recommended. https://cathook.club\n\033[0m"; exit 1; } } elif [ "$update_channel" == "master" ]; then git fetch --force --depth 1 origin && git reset --hard origin/master || { echo -e "\033[1;33m\nFailed to pull from github! Trying alternative pull (legacy)\n\033[0m"; git fetch --depth 1 && git reset --hard @{upstream} || { echo -e "\033[1;31m\nFailed to pull from github! A reinstall is recommended. https://cathook.club\n\033[0m"; exit 1; } } elif [ "$update_channel" == "developer" ]; then - echo -e "\033[1;33m\nWarning! Running in developer mode! Expect issues!\n\033[0m" && git pull origin || { echo -e "\033[1;31m\n\nFailed to pull from github!\n\033[0m"; exit 1; } + echo -e "\033[1;33m\nWarning! Running in developer mode! Expect issues!\n\033[0m" && git pull origin --rebase=false || { echo -e "\033[1;31m\n\nFailed to pull from github!\n\033[0m"; exit 1; } else if [ "$dialog" == true ]; then value=true @@ -124,11 +124,19 @@ function performupdate() { exit 1 fi - # Run migrations - if [ "$update_channel" != "developer" ]; then + # Run migrations, idk if it's a good idea to let this execute outside of the reach of the updater script self updater + if [ "$update_channel" != "developer" ] && [ -e ./scripts/migrations ]; then ./scripts/migrations $tui $INIT false || exit 1 fi + NEW_UPDATE=$(git rev-parse HEAD:scripts/updater) + + # Check if the updater script hash has changed. If yes, re-execute yourself (this automates the "double updates" that are sometimes required + if [ "$OLD_UPDATE" != "$NEW_UPDATE" ]; then + echo -e "\033[1;33m\nWarning: Update script self update!\n\033[0m" + CH_UPDATER_SELFUPDATE=1 exec $0 $@ + fi + # Check if all required packages are installed ./scripts/dependencycheck @@ -145,7 +153,7 @@ function performupdate() { if [ "$AUTOUPDATER" == true ]; then proccount=1 fi - + #Create build folder in case it doesn't exist mkdir -p ./build # Update cathook