Advertisement
Guest User

Untitled

a guest
Jun 29th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.93 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. #Script to update the menu in the tf2 folder with the one in the github folder
  4.  
  5. ## Int these var here just cuz
  6. TFLOCATION=""
  7. FIRSTTIME=false
  8.  
  9. ## If our config file is found, we run it to get our var
  10. if [ -f TFLOC ]; then
  11.     bash TFLOC
  12. fi
  13.    
  14. ## Check if var is empty, or if Team Fortress isnt in the name, or if the location doesnt exist, then we need to find where the tf2 folder is
  15. if [ -z "$TFLOCATION" ] || [ "$TFLOCATION" != *"Team Fortress 2/" ] || [ -f "$TFLOCATION" ]; then
  16.     FIRSTTIME=true
  17.     echo "cfg file not found, checking for install
  18.     ## Check common locations for the install and save to var
  19.     if [ -f "~/.local/share/Steam/steamapps/common/Team Fortress 2/" ]; then
  20.         TFLOCATION="~/.local/share/Steam/steamapps/common/Team Fortress 2/"
  21.     elif [ -f "/var/log/messages" ]; then
  22.         TFLOCATION="~/.local/share/Steam/steamapps/common/Team Fortress 2/"
  23.            
  24.     ## We cant find it in the common locations, so we ask the user for input
  25.     else
  26.         ## We want to keep asking the user untill the path passes
  27.         while [ -z TFLOCATION ]; do
  28.             ## Tell the user about the situation and ask them for input
  29.             echo "Your team fortress install was not found."
  30.             echo "Please input the path to your team fortress 2 folder"
  31.             echo "Example: ~/Steam/steamapps/common/Team Fortress 2/"
  32.            
  33.             ## We retrieve our userinput here and place it into the TFLOCATIONTMP var
  34.             read -r -p "Path: " TFLOCATIONTMP
  35.            
  36.             ## Check user input if it has the tf folder in end of the name
  37.             if [ $TFLOCATIONTMP == *"Team Fortress 2/" ]; then
  38.                 ## Check if the folder actually exists
  39.                 if [ -f "$TFLOCATIONTMP" ]; then
  40.                     echo "Passed Checks!"
  41.                     ## The check passed so we move the var from the placeholder
  42.                     TFLOCATION=$TFLOCATIONTMP
  43.                 fi
  44.             fi
  45.         done
  46.     fi
  47.    
  48.     ## It should be impossible to reach this point without a path set, so it is expected that we have the tf2 dir
  49.     ## We save the var here for future use
  50.     echo '$TFLOCATION='$TFLOCATION> TFLOC
  51.     ## We want this mini script to export the var for use in this script
  52.     echo "export TFLOCATION">> TFLOC
  53.    
  54. fi
  55.  
  56. ## If var wasnt in the cfg when this was run, we give the user a notice
  57. if ![ $FIRSTTIME ]; then
  58.     ## Wall o' text
  59.     echo "This script copys and updates menu and font files inside the tf2 dir"
  60.     echo "They are needed for cathook to run, you may manually install them"
  61.     echo "by copying the tf-settings dir inside cathooks github folder into"
  62.     echo "the Team Fortress 2 folder and renaming it to cathook"
  63.     echo " "
  64.     echo "These files can not and will not result in vac and are completely safe"
  65.     ## pause and wait for a keypress
  66.     read -n1 -r -p "Press any key to automate this process..." key
  67. fi
  68.  
  69. ## We should have our path to the tf dir now, so do a final check for tf-settings folder
  70. if [ -f tf-settings/ ]; then
  71.     ## now we update the menu files
  72.     cp -f -r -u -t tf-settings/ "$TFLOCATION"/cathook
  73.     echo "Menu updated"
  74. else
  75.     echo "tf-settings folder not found"
  76. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement