mirror of
https://github.com/the-sane/lug-helper.git
synced 2025-01-15 00:20:35 +00:00
Syntax fixes
This commit is contained in:
parent
4772265c99
commit
c45b974f43
205
lug-helper.sh
205
lug-helper.sh
@ -125,94 +125,95 @@ getdirs() {
|
|||||||
# Check if the config files already exist
|
# Check if the config files already exist
|
||||||
if [ -f "$conf_dir/$conf_subdir/$wine_conf" ]; then
|
if [ -f "$conf_dir/$conf_subdir/$wine_conf" ]; then
|
||||||
found_wine_conf=1
|
found_wine_conf=1
|
||||||
wine_prefix="$(cat $conf_dir/$conf_subdir/$wine_conf")"
|
wine_prefix="$(cat "$conf_dir/$conf_subdir/$wine_conf")"
|
||||||
fi
|
fi
|
||||||
if [ -f "$conf_dir/$conf_subdir/$game_conf" ]; then
|
if [ -f "$conf_dir/$conf_subdir/$game_conf" ]; then
|
||||||
found_game_conf=1
|
found_game_conf=1
|
||||||
game_path="$(cat $conf_dir/$conf_subdir/$game_conf")"
|
game_path="$(cat "$conf_dir/$conf_subdir/$game_conf")"
|
||||||
fi
|
fi
|
||||||
if [ -f "$conf_dir/$conf_subdir/$backup_conf" ]; then
|
if [ -f "$conf_dir/$conf_subdir/$backup_conf" ]; then
|
||||||
found_backup_conf=1
|
found_backup_conf=1
|
||||||
backup_path="$(cat $conf_dir/$conf_subdir/$backup_conf")"
|
backup_path="$(cat "$conf_dir/$conf_subdir/$backup_conf")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$found_wine_config" ] || [ -z "$found_game_conf" ] || [ -z "$found_backup_conf" ]; then
|
if [ -z "$found_wine_config" ] || [ -z "$found_game_conf" ] || [ -z "$found_backup_conf" ]; then
|
||||||
message 1 "You will now be asked to provide some directories needed by this script.\nThey will be saved for later use in:\n$conf_dir/$conf_subdir/"
|
message 1 "You will now be asked to provide some directories needed by this script.\nThey will be saved for later use in:\n$conf_dir/$conf_subdir/"
|
||||||
if [ "$has_zen" -eq 1 ]; then
|
if [ "$has_zen" -eq 1 ]; then
|
||||||
# Get the wine prefix directory
|
# Get the wine prefix directory
|
||||||
if [ -z "$found_wine_conf" ]; then
|
if [ -z "$found_wine_conf" ]; then
|
||||||
wine_prefix="$(zenity --file-selection --directory --title="Select your WINE prefix directory" --filename="$HOME/")"
|
wine_prefix="$(zenity --file-selection --directory --title="Select your WINE prefix directory" --filename="$HOME/")"
|
||||||
if [ "$?" -eq -1 ]; then
|
if [ "$?" -eq -1 ]; then
|
||||||
message 2 "An unexpected error has occurred."
|
message 2 "An unexpected error has occurred."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Get the game path
|
# Get the game path
|
||||||
if [ -z "$found_game_conf" ]; then
|
if [ -z "$found_game_conf" ]; then
|
||||||
while true; do
|
while true; do
|
||||||
game_path="$(zenity --file-selection --directory --title="Select your Star Citizen LIVE directory" --filename="$prefix/")"
|
game_path="$(zenity --file-selection --directory --title="Select your Star Citizen LIVE directory" --filename="$prefix/")"
|
||||||
if [ "$?" -eq -1 ]; then
|
if [ "$?" -eq -1 ]; then
|
||||||
|
message 2 "An unexpected error has occurred."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$(basename "$game_path")" != "LIVE" ]; then
|
||||||
|
message 2 "You must select your LIVE directory."
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get the backup directory
|
||||||
|
if [ -z "$found_backup_conf" ]; then
|
||||||
|
backup_path="$(zenity --file-selection --directory --title="Select a backup directory for your keybinds" --filename="$HOME/")"
|
||||||
|
if [ "$?" -eq -1 ]; then
|
||||||
message 2 "An unexpected error has occurred."
|
message 2 "An unexpected error has occurred."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$(basename $game_path)" != "LIVE" ]; then
|
|
||||||
message 2 "You must select your LIVE directory."
|
|
||||||
else
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Get the backup directory
|
|
||||||
if [ -z "$found_backup_conf" ]; then
|
|
||||||
backup_path="$(zenity --file-selection --directory --title="Select a backup directory for your keybinds" --filename="$HOME/")"
|
|
||||||
if [ "$?" -eq -1 ]; then
|
|
||||||
message 2 "An unexpected error has occurred."
|
|
||||||
fi
|
fi
|
||||||
fi
|
else
|
||||||
else
|
clear
|
||||||
clear
|
|
||||||
|
|
||||||
# Get the wine prefix directory
|
# Get the wine prefix directory
|
||||||
if [ -z "$found_wine_conf" ]; then
|
if [ -z "$found_wine_conf" ]; then
|
||||||
echo -e "Enter the full path to your WINE prefix directory"
|
echo -e "Enter the full path to your WINE prefix directory"
|
||||||
echo -e "ie. /home/USER/.wine/"
|
echo -e "ie. /home/USER/.wine/"
|
||||||
while read -rp ": " wine_prefix; do
|
while read -rp ": " wine_prefix; do
|
||||||
if [ ! -d "$wine_prefix" ]; then
|
if [ ! -d "$wine_prefix" ]; then
|
||||||
echo -e "That directory is invalid or does not exist. Please try again.\n"
|
echo -e "That directory is invalid or does not exist. Please try again.\n"
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Get the game path
|
||||||
|
if [ -z "$found_game_conf" ]; then
|
||||||
|
echo -e "\nEnter the full path to your Star Citizen installation LIVE directory"
|
||||||
|
echo -e "ie. /home/USER/.wine/drive_c/Program Files/Roberts Space Industries/Star Citizen/LIVE/"
|
||||||
|
while read -rp ": " game_path; do
|
||||||
|
if [ ! -d "$game_path" ]; then
|
||||||
|
echo -e "That directory is invalid or does not exist. Please try again.\n"
|
||||||
|
elif [ "$(basename "$game_path")" != "LIVE" ]; then
|
||||||
|
echo -e "You must select your LIVE directory."
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get the backup directory
|
||||||
|
if [ -z "$found_backup_conf" ]; then
|
||||||
|
echo -e "\nEnter the full path to a backup directory for your keybinds"
|
||||||
|
echo -e "ie. /home/USER/backups/"
|
||||||
|
while read -rp ": " backup_path; do
|
||||||
|
if [ ! -d "$backup_path" ]; then
|
||||||
|
echo -e "That directory is invalid or does not exist. Please try again.\n"
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
fi
|
||||||
|
|
||||||
# Get the game path
|
|
||||||
if [ -z "$found_game_conf" ]; then
|
|
||||||
echo -e "\nEnter the full path to your Star Citizen installation LIVE directory"
|
|
||||||
echo -e "ie. /home/USER/.wine/drive_c/Program Files/Roberts Space Industries/Star Citizen/LIVE/"
|
|
||||||
while read -rp ": " game_path; do
|
|
||||||
if [ ! -d "$game_path" ]; then
|
|
||||||
echo -e "That directory is invalid or does not exist. Please try again.\n"
|
|
||||||
elif [ "$(basename $game_path)" != "LIVE" ]; then
|
|
||||||
echo -e "You must select your LIVE directory."
|
|
||||||
else
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Get the backup directory
|
|
||||||
if [ -z "$found_backup_conf" ]; then
|
|
||||||
echo -e "\nEnter the full path to a backup directory for your keybinds"
|
|
||||||
echo -e "ie. /home/USER/backups/"
|
|
||||||
while read -rp ": " backup_path; do
|
|
||||||
if [ ! -d "$backup_path" ]; then
|
|
||||||
echo -e "That directory is invalid or does not exist. Please try again.\n"
|
|
||||||
else
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Save the paths for later use
|
# Save the paths for later use
|
||||||
echo "$wine_prefix" > "$conf_dir/$conf_subdir/$wine_conf"
|
echo "$wine_prefix" > "$conf_dir/$conf_subdir/$wine_conf"
|
||||||
@ -229,40 +230,40 @@ getdirs() {
|
|||||||
sanitize() {
|
sanitize() {
|
||||||
clear
|
clear
|
||||||
|
|
||||||
# Prompt user to back up the current keybinds in the game
|
# Prompt user to back up the current keybinds in the game
|
||||||
message 1 "Before proceeding, please be sure you have\nexported your Star Citizen keybinds from within the game!\n\nTo do this, launch the game and go to:\nOptions->Keybindings->Control Profiles->Save Control Settings"
|
message 1 "Before proceeding, please be sure you have\nexported your Star Citizen keybinds from within the game!\n\nTo do this, launch the game and go to:\nOptions->Keybindings->Control Profiles->Save Control Settings"
|
||||||
|
|
||||||
# Get/Set directory paths
|
# Get/Set directory paths
|
||||||
getdirs
|
getdirs
|
||||||
|
|
||||||
# Check for exported keybind files
|
# Check for exported keybind files
|
||||||
exported=0 # Default to none found
|
exported=0 # Default to none found
|
||||||
if [ ! -d "$mappings_dir" ] || [ -z "$(ls -A $mappings_dir)" ]; then
|
if [ ! -d "$mappings_dir" ] || [ -z "$(ls -A "$mappings_dir")" ]; then
|
||||||
message 1 "Warning: No exported keybindings found. Keybinds will not be backed up!"
|
message 1 "Warning: No exported keybindings found. Keybinds will not be backed up!"
|
||||||
exported=0
|
exported=0
|
||||||
else
|
else
|
||||||
exported=1
|
exported=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Back up keybinds
|
# Back up keybinds
|
||||||
if [ "$exported" -eq 1 ]; then
|
if [ "$exported" -eq 1 ]; then
|
||||||
echo "Backing up all saved keybinds..."
|
echo "Backing up all saved keybinds..."
|
||||||
mkdir -p "$backup_path" && cp -r "$mappings_dir/." "$backup_path/"
|
mkdir -p "$backup_path" && cp -r "$mappings_dir/." "$backup_path/"
|
||||||
echo -e "Done.\n"
|
echo -e "Done.\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Wipe the user directory
|
# Wipe the user directory
|
||||||
echo "Wiping USER directory..."
|
echo "Wiping USER directory..."
|
||||||
rm -rf "$user_dir"
|
rm -rf "$user_dir"
|
||||||
echo -e "Done.\n"
|
echo -e "Done.\n"
|
||||||
|
|
||||||
# Restore custom keybinds
|
# Restore custom keybinds
|
||||||
if [ "$exported" -eq 1 ]; then
|
if [ "$exported" -eq 1 ]; then
|
||||||
echo "Restoring keybinds..."
|
echo "Restoring keybinds..."
|
||||||
mkdir -p "$mappings_dir" && cp -r "$backup_path/." "$mappings_dir/"
|
mkdir -p "$mappings_dir" && cp -r "$backup_path/." "$mappings_dir/"
|
||||||
echo -e "Done.\n"
|
echo -e "Done.\n"
|
||||||
message 1 "\nTo re-import your keybinds, select it in-game from the list:\nOptions->Keybindings->Control Profiles\n"
|
message 1 "\nTo re-import your keybinds, select it in-game from the list:\nOptions->Keybindings->Control Profiles\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
message 1 "Your USER directory has been cleaned up!"
|
message 1 "Your USER directory has been cleaned up!"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user