Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- #Script to update the menu in the tf2 folder with the one in the github folder
- ## Int these var here just cuz
- TFLOCATION=""
- FIRSTTIME=false
- ## If our config file is found, we run it to get our var
- if [ -f TFLOC ]; then
- bash TFLOC
- fi
- ## 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
- if [ -z "$TFLOCATION" ] || [ "$TFLOCATION" != *"Team Fortress 2/" ] || [ -f "$TFLOCATION" ]; then
- FIRSTTIME=true
- echo "cfg file not found, checking for install
- ## Check common locations for the install and save to var
- if [ -f "~/.local/share/Steam/steamapps/common/Team Fortress 2/" ]; then
- TFLOCATION="~/.local/share/Steam/steamapps/common/Team Fortress 2/"
- elif [ -f "/var/log/messages" ]; then
- TFLOCATION="~/.local/share/Steam/steamapps/common/Team Fortress 2/"
- ## We cant find it in the common locations, so we ask the user for input
- else
- ## We want to keep asking the user untill the path passes
- while [ -z TFLOCATION ]; do
- ## Tell the user about the situation and ask them for input
- echo "Your team fortress install was not found."
- echo "Please input the path to your team fortress 2 folder"
- echo "Example: ~/Steam/steamapps/common/Team Fortress 2/"
- ## We retrieve our userinput here and place it into the TFLOCATIONTMP var
- read -r -p "Path: " TFLOCATIONTMP
- ## Check user input if it has the tf folder in end of the name
- if [ $TFLOCATIONTMP == *"Team Fortress 2/" ]; then
- ## Check if the folder actually exists
- if [ -f "$TFLOCATIONTMP" ]; then
- echo "Passed Checks!"
- ## The check passed so we move the var from the placeholder
- TFLOCATION=$TFLOCATIONTMP
- fi
- fi
- done
- fi
- ## It should be impossible to reach this point without a path set, so it is expected that we have the tf2 dir
- ## We save the var here for future use
- echo '$TFLOCATION='$TFLOCATION> TFLOC
- ## We want this mini script to export the var for use in this script
- echo "export TFLOCATION">> TFLOC
- fi
- ## If var wasnt in the cfg when this was run, we give the user a notice
- if ![ $FIRSTTIME ]; then
- ## Wall o' text
- echo "This script copys and updates menu and font files inside the tf2 dir"
- echo "They are needed for cathook to run, you may manually install them"
- echo "by copying the tf-settings dir inside cathooks github folder into"
- echo "the Team Fortress 2 folder and renaming it to cathook"
- echo " "
- echo "These files can not and will not result in vac and are completely safe"
- ## pause and wait for a keypress
- read -n1 -r -p "Press any key to automate this process..." key
- fi
- ## We should have our path to the tf dir now, so do a final check for tf-settings folder
- if [ -f tf-settings/ ]; then
- ## now we update the menu files
- cp -f -r -u -t tf-settings/ "$TFLOCATION"/cathook
- echo "Menu updated"
- else
- echo "tf-settings folder not found"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement