mirror of
https://github.com/the-sane/lug-helper.git
synced 2025-07-01 13:30:35 +00:00
Compare commits
38 Commits
Author | SHA1 | Date | |
---|---|---|---|
eae146ce02 | |||
b4248fb264 | |||
d5dbec7b3f | |||
d4e8298743 | |||
8ee730bf35 | |||
b6eea7b224 | |||
c9c3c07866 | |||
2e883423d3 | |||
12a3a51eb4 | |||
aec6ffbfc0 | |||
96b15262f5 | |||
9986f62566 | |||
a2397c28f0 | |||
e8891b42e6 | |||
52f602498e | |||
9279c68d69 | |||
45e5f586dd | |||
9d532f3ac5 | |||
ce7031e873 | |||
8492cdc3a2 | |||
b22e84887e | |||
bfc2822a35 | |||
dfe15f8e78 | |||
8a27a77579 | |||
28edb3393e | |||
978e0adc92 | |||
1ae2d6e4b4 | |||
ae7c407b19 | |||
5caea10a6b | |||
c6b56ac98b | |||
407db0bbcf | |||
70f282d012 | |||
0018591192 | |||
e3d6e4db68 | |||
ca2ce556aa | |||
8e922ae0ef | |||
1d4ff8375e | |||
8bd3a165de |
14
README.md
14
README.md
@ -1,13 +1,15 @@
|
|||||||
# LUG-Helper
|
# LUG-Helper
|
||||||
**Star Citizen's Linux Users Group Helper Script**
|
**Star Citizen's Linux Users Group Helper Script**
|
||||||
|
|
||||||
https://robertsspaceindustries.com/orgs/LUG
|
https://robertsspaceindustries.com/orgs/LUG
|
||||||
|
|
||||||
*Greetings, fellow Penguin!*
|
### *Greetings, fellow Penguin!*
|
||||||
|
_**This script is designed to help you manage and optimize Star Citizen on Linux.**_
|
||||||
|
|
||||||
This script is designed to help you manage and optimize Star Citizen on Linux.
|
Zenity menus are used for a GUI experience with a fallback to terminal-based menus where Zenity is unavailable.
|
||||||
|
Command line arguments are available for quickly launching functions from the terminal.
|
||||||
|
|
||||||
Zenity menus are used for a GUI experience with a fallback to terminal-based menus where Zenity is unavailable. The game directory paths provided by the user on first run are saved in *$XDG_CONFIG_HOME/starcitizen-lug/*. Keybinds are backed up to *$XDG_CONFIG_HOME/starcitizen-lug/keybinds/*
|
Configuration is saved in *$XDG_CONFIG_HOME/starcitizen-lug/*.
|
||||||
|
Keybinds are backed up to *$XDG_CONFIG_HOME/starcitizen-lug/keybinds/*
|
||||||
|
|
||||||
## Options:
|
## Options:
|
||||||
|
|
||||||
@ -58,4 +60,6 @@ Arch Linux: https://aur.archlinux.org/packages/lug-helper/
|
|||||||
## Contributors:
|
## Contributors:
|
||||||
- https://github.com/Termuellinator
|
- https://github.com/Termuellinator
|
||||||
- https://github.com/pstn
|
- https://github.com/pstn
|
||||||
|
- https://github.com/gort818
|
||||||
|
- https://github.com/victort
|
||||||
- Runner Downloader inspired by https://github.com/richardtatum/sc-runner-updater
|
- Runner Downloader inspired by https://github.com/richardtatum/sc-runner-updater
|
||||||
|
228
lug-helper.sh
228
lug-helper.sh
@ -41,10 +41,18 @@
|
|||||||
# Author: https://github.com/the-sane
|
# Author: https://github.com/the-sane
|
||||||
# Contributor: https://github.com/Termuellinator
|
# Contributor: https://github.com/Termuellinator
|
||||||
# Contributor: https://github.com/pstn
|
# Contributor: https://github.com/pstn
|
||||||
|
# Contributor: https://github.com/gort818
|
||||||
|
# Contributor: https://github.com/victort
|
||||||
# Runner Downloader inspired by:
|
# Runner Downloader inspired by:
|
||||||
# https://github.com/richardtatum/sc-runner-updater
|
# https://github.com/richardtatum/sc-runner-updater
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
|
# Check if script is run as root
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
echo "This script is not supposed to be run as root!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Check for dependencies
|
# Check for dependencies
|
||||||
if [ ! -x "$(command -v curl)" ]; then
|
if [ ! -x "$(command -v curl)" ]; then
|
||||||
# Print to stderr and also try warning the user through notify-send
|
# Print to stderr and also try warning the user through notify-send
|
||||||
@ -61,19 +69,10 @@ fi
|
|||||||
|
|
||||||
wine_conf="winedir.conf"
|
wine_conf="winedir.conf"
|
||||||
game_conf="gamedir.conf"
|
game_conf="gamedir.conf"
|
||||||
backup_conf="backupdir.conf"
|
|
||||||
|
|
||||||
# Use XDG base directories if defined
|
# Use XDG base directories if defined
|
||||||
if [ -z "$XDG_CONFIG_HOME" ]; then
|
conf_dir="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||||
conf_dir="$HOME/.config"
|
data_dir="${XDG_DATA_HOME:-$HOME/.local/share}"
|
||||||
else
|
|
||||||
conf_dir="$XDG_CONFIG_HOME"
|
|
||||||
fi
|
|
||||||
if [ -z "$XDG_DATA_HOME" ]; then
|
|
||||||
data_dir="$HOME/.local/share"
|
|
||||||
else
|
|
||||||
data_dir="$XDG_DATA_HOME"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# .config subdirectory
|
# .config subdirectory
|
||||||
conf_subdir="starcitizen-lug"
|
conf_subdir="starcitizen-lug"
|
||||||
@ -82,12 +81,20 @@ conf_subdir="starcitizen-lug"
|
|||||||
tmp_dir="$(mktemp -d --suffix=".lughelper")"
|
tmp_dir="$(mktemp -d --suffix=".lughelper")"
|
||||||
trap 'rm -r "$tmp_dir"' EXIT
|
trap 'rm -r "$tmp_dir"' EXIT
|
||||||
|
|
||||||
# The game's user subdirectory name
|
######## Game Directories ##################################################
|
||||||
user_subdir_name="USER"
|
|
||||||
# The location within the USER directory to which the game exports keybinds
|
|
||||||
keybinds_export_path="Controls/Mappings"
|
|
||||||
|
|
||||||
dxvk_cache_file="StarCitizen.dxvk-cache"
|
# The game's base directory name
|
||||||
|
sc_base_dir="StarCitizen"
|
||||||
|
# The default install location within a WINE prefix:
|
||||||
|
install_path="drive_c/Program Files/Roberts Space Industries/$sc_base_dir"
|
||||||
|
|
||||||
|
# The names of the live/ptu directories
|
||||||
|
live_dir="LIVE"
|
||||||
|
ptu_dir="PTU"
|
||||||
|
|
||||||
|
# Remaining directory paths are set at the end of the getdirs() function
|
||||||
|
|
||||||
|
############################################################################
|
||||||
|
|
||||||
# Lutris wine runners directory
|
# Lutris wine runners directory
|
||||||
runners_dir="$data_dir/lutris/runners/wine"
|
runners_dir="$data_dir/lutris/runners/wine"
|
||||||
@ -164,7 +171,7 @@ message() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Use zenity messages if available
|
# Use zenity messages if available
|
||||||
if [ "$has_zen" -eq 1 ]; then
|
if [ "$use_zenity" -eq 1 ]; then
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"info")
|
"info")
|
||||||
# info message
|
# info message
|
||||||
@ -273,7 +280,7 @@ menu() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Use Zenity if it is available
|
# Use Zenity if it is available
|
||||||
if [ "$has_zen" -eq 1 ]; then
|
if [ "$use_zenity" -eq 1 ]; then
|
||||||
# Format the options array for Zenity by adding
|
# Format the options array for Zenity by adding
|
||||||
# TRUE or FALSE to indicate default selections
|
# TRUE or FALSE to indicate default selections
|
||||||
# ie: "TRUE" "List item 1" "FALSE" "List item 2" "FALSE" "List item 3"
|
# ie: "TRUE" "List item 1" "FALSE" "List item 2" "FALSE" "List item 3"
|
||||||
@ -367,7 +374,7 @@ getdirs() {
|
|||||||
fi
|
fi
|
||||||
if [ -f "$conf_dir/$conf_subdir/$game_conf" ]; then
|
if [ -f "$conf_dir/$conf_subdir/$game_conf" ]; then
|
||||||
game_path="$(cat "$conf_dir/$conf_subdir/$game_conf")"
|
game_path="$(cat "$conf_dir/$conf_subdir/$game_conf")"
|
||||||
if [ ! -d "$game_path" ] || [ "$(basename "$game_path")" != "StarCitizen" ]; then
|
if [ ! -d "$game_path" ] || [ "$(basename "$game_path")" != "$sc_base_dir" ]; then
|
||||||
debug_print continue "Unexpected game path found in config file, ignoring."
|
debug_print continue "Unexpected game path found in config file, ignoring."
|
||||||
game_path=""
|
game_path=""
|
||||||
fi
|
fi
|
||||||
@ -377,7 +384,7 @@ getdirs() {
|
|||||||
# ask the user to provide them
|
# ask the user to provide them
|
||||||
if [ -z "$wine_prefix" ] || [ -z "$game_path" ]; then
|
if [ -z "$wine_prefix" ] || [ -z "$game_path" ]; then
|
||||||
message info "At the next screen, please select your Star Citizen WINE prefix.\nIt will be remembered for future use."
|
message info "At the next screen, please select your Star Citizen WINE prefix.\nIt will be remembered for future use."
|
||||||
if [ "$has_zen" -eq 1 ]; then
|
if [ "$use_zenity" -eq 1 ]; then
|
||||||
# Using Zenity file selection menus
|
# Using Zenity file selection menus
|
||||||
# Get the wine prefix directory
|
# Get the wine prefix directory
|
||||||
if [ -z "$wine_prefix" ]; then
|
if [ -z "$wine_prefix" ]; then
|
||||||
@ -394,15 +401,15 @@ getdirs() {
|
|||||||
|
|
||||||
# Get the game path
|
# Get the game path
|
||||||
if [ -z "$game_path" ]; then
|
if [ -z "$game_path" ]; then
|
||||||
if [ -d "$wine_prefix/drive_c/Program Files/Roberts Space Industries/StarCitizen" ] &&
|
if [ -d "$wine_prefix/$install_path" ] &&
|
||||||
message question "Is this your Star Citizen game directory?\n\n$wine_prefix/drive_c/Program Files/Roberts Space Industries/StarCitizen"; then
|
message question "Is this your Star Citizen game directory?\n\n$wine_prefix/$install_path"; then
|
||||||
game_path="$wine_prefix/drive_c/Program Files/Roberts Space Industries/StarCitizen"
|
game_path="$wine_prefix/$install_path"
|
||||||
else
|
else
|
||||||
while game_path="$(zenity --file-selection --directory --title="Select your Star Citizen directory" --filename="$wine_prefix/drive_c/Program Files/Roberts Space Industries/StarCitizen" 2>/dev/null)"; do
|
while game_path="$(zenity --file-selection --directory --title="Select your Star Citizen directory" --filename="$wine_prefix/$install_path" 2>/dev/null)"; do
|
||||||
if [ "$?" -eq -1 ]; then
|
if [ "$?" -eq -1 ]; then
|
||||||
message warning "An unexpected error has occurred. The Helper is unable to proceed."
|
message warning "An unexpected error has occurred. The Helper is unable to proceed."
|
||||||
return 1
|
return 1
|
||||||
elif [ "$(basename "$game_path")" != "StarCitizen" ]; then
|
elif [ "$(basename "$game_path")" != "$sc_base_dir" ]; then
|
||||||
message warning "You must select the Star Citizen base game directory.\n\nFor Example: prefix/drive_c/Program Files/Roberts Space Industries/StarCitizen"
|
message warning "You must select the Star Citizen base game directory.\n\nFor Example: prefix/drive_c/Program Files/Roberts Space Industries/StarCitizen"
|
||||||
else
|
else
|
||||||
# All good or cancel
|
# All good or cancel
|
||||||
@ -435,17 +442,17 @@ getdirs() {
|
|||||||
|
|
||||||
# Get the game path
|
# Get the game path
|
||||||
if [ -z "$game_path" ]; then
|
if [ -z "$game_path" ]; then
|
||||||
if [ -d "$wine_prefix/drive_c/Program Files/Roberts Space Industries/StarCitizen" ] &&
|
if [ -d "$wine_prefix/$install_path" ] &&
|
||||||
message question "Is this your Star Citizen game directory?\n\n$wine_prefix/drive_c/Program Files/Roberts Space Industries/StarCitizen"; then
|
message question "Is this your Star Citizen game directory?\n\n$wine_prefix/$install_path"; then
|
||||||
game_path="$wine_prefix/drive_c/Program Files/Roberts Space Industries/StarCitizen"
|
game_path="$wine_prefix/$install_path"
|
||||||
else
|
else
|
||||||
printf "\nEnter the full path to your Star Citizen installation directory (case sensitive)\n"
|
printf "\nEnter the full path to your Star Citizen installation directory (case sensitive)\n"
|
||||||
printf "ie. /home/USER/Games/star-citizen/drive_c/Program Files/Roberts Space Industries/StarCitizen\n"
|
printf "ie. /home/USER/Games/star-citizen/drive_c/Program Files/Roberts Space Industries/StarCitizen\n"
|
||||||
while read -rp ": " game_path; do
|
while read -rp ": " game_path; do
|
||||||
if [ ! -d "$game_path" ]; then
|
if [ ! -d "$game_path" ]; then
|
||||||
printf "That directory is invalid or does not exist. Please try again.\n\n"
|
printf "That directory is invalid or does not exist. Please try again.\n\n"
|
||||||
elif [ "$(basename "$game_path")" != "StarCitizen" ]; then
|
elif [ "$(basename "$game_path")" != "$sc_base_dir" ]; then
|
||||||
printf "You must enter the full path to the directory named 'StarCitizen'\n\n"
|
printf "You must enter the full path to the directory named '$sc_base_dir'\n\n"
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
@ -459,9 +466,18 @@ getdirs() {
|
|||||||
echo "$game_path" > "$conf_dir/$conf_subdir/$game_conf"
|
echo "$game_path" > "$conf_dir/$conf_subdir/$game_conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set some remaining directory paths
|
######## Set remaining directory paths #####################################
|
||||||
user_dir="$game_path/$live_or_ptu/$user_subdir_name"
|
# $live_or_ptu is set in the set_version() function
|
||||||
keybinds_dir="$user_dir/$keybinds_export_path"
|
############################################################################
|
||||||
|
# The game's user directory
|
||||||
|
user_dir="$game_path/$live_or_ptu/USER/Client/0/"
|
||||||
|
# The location within the USER directory to which the game exports keybinds
|
||||||
|
keybinds_dir="$user_dir/Controls/Mappings"
|
||||||
|
# Shaders directory
|
||||||
|
shaders_dir="$user_dir/shaders"
|
||||||
|
# dxvk cache file
|
||||||
|
dxvk_cache="$game_path/$live_or_ptu/StarCitizen.dxvk-cache"
|
||||||
|
# Where to store backed up keybinds
|
||||||
backup_path="$conf_dir/$conf_subdir"
|
backup_path="$conf_dir/$conf_subdir"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -518,6 +534,7 @@ sanitize() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#--------------------- begin preflight check functions -----------------------#
|
||||||
#------------------------- begin mapcount functions --------------------------#
|
#------------------------- begin mapcount functions --------------------------#
|
||||||
|
|
||||||
# Check if setting vm.max_map_count was successful
|
# Check if setting vm.max_map_count was successful
|
||||||
@ -644,17 +661,27 @@ filelimit_check() {
|
|||||||
|
|
||||||
#------------------------- end filelimit functions ---------------------------#
|
#------------------------- end filelimit functions ---------------------------#
|
||||||
|
|
||||||
|
|
||||||
# Check total system memory
|
# Check total system memory
|
||||||
memory_check() {
|
memory_check() {
|
||||||
memtotal="$(awk '/MemTotal/ {printf "%.1f \n", $2/1024/1024}' /proc/meminfo)"
|
memtotal="$(awk '/MemTotal/ {printf "%.1f \n", $2/1024/1024}' /proc/meminfo)"
|
||||||
if awk 'BEGIN {exit !("$memtotal" < 15)}'; then
|
if [ ${memtotal%.*} -ge "15" ]; then
|
||||||
preflight_pass+=("Your system has $memtotal GB of memory.")
|
preflight_pass+=("Your system has $memtotal GB of memory.")
|
||||||
else
|
else
|
||||||
preflight_fail+=("Your system has $memtotal GB of memory.\nWe recommend at least 16 GB to avoid crashes.")
|
preflight_fail+=("Your system has $memtotal GB of memory.\nWe recommend at least 16 GB to avoid crashes.")
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check CPU for the required AVX extension
|
||||||
|
avx_check() {
|
||||||
|
if grep -q "avx" /proc/cpuinfo; then
|
||||||
|
preflight_pass+=("Your CPU supports the necessary AVX instruction set.")
|
||||||
|
else
|
||||||
|
preflight_fail+=("Your CPU does not appear to support AVX instructions.\nThis requirement was added to Star Citizen in version 3.11")
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#------------------------- end preflight check functions ---------------------#
|
||||||
|
|
||||||
# Delete the shaders directory
|
# Delete the shaders directory
|
||||||
rm_shaders() {
|
rm_shaders() {
|
||||||
# Get/Set directory paths
|
# Get/Set directory paths
|
||||||
@ -664,8 +691,6 @@ rm_shaders() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
shaders_dir="$user_dir/shaders"
|
|
||||||
|
|
||||||
# Sanity check
|
# Sanity check
|
||||||
if [ ! -d "$shaders_dir" ]; then
|
if [ ! -d "$shaders_dir" ]; then
|
||||||
message warning "Shaders directory not found. There is nothing to delete!\n\n$shaders_dir"
|
message warning "Shaders directory not found. There is nothing to delete!\n\n$shaders_dir"
|
||||||
@ -681,7 +706,7 @@ rm_shaders() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Delete DXVK cache
|
# Delete DXVK cache
|
||||||
rm_vidcache() {
|
rm_dxvkcache() {
|
||||||
# Get/Set directory paths
|
# Get/Set directory paths
|
||||||
getdirs
|
getdirs
|
||||||
if [ "$?" -eq 1 ]; then
|
if [ "$?" -eq 1 ]; then
|
||||||
@ -689,9 +714,7 @@ rm_vidcache() {
|
|||||||
# or there was an error
|
# or there was an error
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dxvk_cache="$game_path/$live_or_ptu/$dxvk_cache_file"
|
|
||||||
|
|
||||||
# Sanity check
|
# Sanity check
|
||||||
if [ ! -f "$dxvk_cache" ]; then
|
if [ ! -f "$dxvk_cache" ]; then
|
||||||
message warning "Unable to find the DXVK cache file. There is nothing to delete!\n\n$dxvk_cache"
|
message warning "Unable to find the DXVK cache file. There is nothing to delete!\n\n$dxvk_cache"
|
||||||
@ -764,7 +787,7 @@ runner_select_delete() {
|
|||||||
menu_actions+=(":") # no-op
|
menu_actions+=(":") # no-op
|
||||||
|
|
||||||
# Calculate the total height the menu should be
|
# Calculate the total height the menu should be
|
||||||
menu_height="$(("$menu_option_height" * "${#menu_options[@]}" + "$menu_text_height"))"
|
menu_height="$(($menu_option_height * ${#menu_options[@]} + $menu_text_height))"
|
||||||
if [ "$menu_height" -gt "400" ]; then
|
if [ "$menu_height" -gt "400" ]; then
|
||||||
menu_height="400"
|
menu_height="400"
|
||||||
fi
|
fi
|
||||||
@ -818,7 +841,7 @@ runner_install() {
|
|||||||
|
|
||||||
# Download the runner to the tmp directory
|
# Download the runner to the tmp directory
|
||||||
debug_print continue "Downloading $runner_dl_url into $tmp_dir/$runner_file..."
|
debug_print continue "Downloading $runner_dl_url into $tmp_dir/$runner_file..."
|
||||||
if [ "$has_zen" -eq 1 ]; then
|
if [ "$use_zenity" -eq 1 ]; then
|
||||||
# Format the curl progress bar for zenity
|
# Format the curl progress bar for zenity
|
||||||
mkfifo "$tmp_dir/lugpipe"
|
mkfifo "$tmp_dir/lugpipe"
|
||||||
cd "$tmp_dir" && curl -#LO "$runner_dl_url" > "$tmp_dir/lugpipe" 2>&1 & curlpid="$!"
|
cd "$tmp_dir" && curl -#LO "$runner_dl_url" > "$tmp_dir/lugpipe" 2>&1 & curlpid="$!"
|
||||||
@ -857,7 +880,7 @@ runner_install() {
|
|||||||
# If the files in the archive begin with ./ there is no subdirectory
|
# If the files in the archive begin with ./ there is no subdirectory
|
||||||
./*)
|
./*)
|
||||||
debug_print continue "Installing runner into $runners_dir/$runner_name..."
|
debug_print continue "Installing runner into $runners_dir/$runner_name..."
|
||||||
if [ "$has_zen" -eq 1 ]; then
|
if [ "$use_zenity" -eq 1 ]; then
|
||||||
# Use Zenity progress bar
|
# Use Zenity progress bar
|
||||||
mkdir -p "$runners_dir/$runner_name" && tar -xzf "$tmp_dir/$runner_file" -C "$runners_dir/$runner_name" | \
|
mkdir -p "$runners_dir/$runner_name" && tar -xzf "$tmp_dir/$runner_file" -C "$runners_dir/$runner_name" | \
|
||||||
zenity --progress --pulsate --no-cancel --auto-close --title="Star Citizen LUG Helper" --text="Installing runner...\n" 2>/dev/null
|
zenity --progress --pulsate --no-cancel --auto-close --title="Star Citizen LUG Helper" --text="Installing runner...\n" 2>/dev/null
|
||||||
@ -869,7 +892,7 @@ runner_install() {
|
|||||||
*)
|
*)
|
||||||
# Runners with a subdirectory in the archive
|
# Runners with a subdirectory in the archive
|
||||||
debug_print continue "Installing runner into $runners_dir..."
|
debug_print continue "Installing runner into $runners_dir..."
|
||||||
if [ "$has_zen" -eq 1 ]; then
|
if [ "$use_zenity" -eq 1 ]; then
|
||||||
# Use Zenity progress bar
|
# Use Zenity progress bar
|
||||||
mkdir -p "$runners_dir" && tar -xzf "$tmp_dir/$runner_file" -C "$runners_dir" | \
|
mkdir -p "$runners_dir" && tar -xzf "$tmp_dir/$runner_file" -C "$runners_dir" | \
|
||||||
zenity --progress --pulsate --no-cancel --auto-close --title="Star Citizen LUG Helper" --text="Installing runner...\n" 2>/dev/null
|
zenity --progress --pulsate --no-cancel --auto-close --title="Star Citizen LUG Helper" --text="Installing runner...\n" 2>/dev/null
|
||||||
@ -963,7 +986,7 @@ runner_select_install() {
|
|||||||
menu_actions+=(":") # no-op
|
menu_actions+=(":") # no-op
|
||||||
|
|
||||||
# Calculate the total height the menu should be
|
# Calculate the total height the menu should be
|
||||||
menu_height="$(("$menu_option_height" * "${#menu_options[@]}" + "$menu_text_height"))"
|
menu_height="$(($menu_option_height * ${#menu_options[@]} + $menu_text_height))"
|
||||||
if [ "$menu_height" -gt "400" ]; then
|
if [ "$menu_height" -gt "400" ]; then
|
||||||
menu_height="400"
|
menu_height="400"
|
||||||
fi
|
fi
|
||||||
@ -1013,7 +1036,7 @@ runner_manage() {
|
|||||||
menu_actions+=("runner_select_delete" "menu_loop_done")
|
menu_actions+=("runner_select_delete" "menu_loop_done")
|
||||||
|
|
||||||
# Calculate the total height the menu should be
|
# Calculate the total height the menu should be
|
||||||
menu_height="$(("$menu_option_height" * "${#menu_options[@]}" + "$menu_text_height"))"
|
menu_height="$(($menu_option_height * ${#menu_options[@]} + $menu_text_height))"
|
||||||
|
|
||||||
# Call the menu function. It will use the options as configured above
|
# Call the menu function. It will use the options as configured above
|
||||||
menu
|
menu
|
||||||
@ -1038,6 +1061,7 @@ preflight_check() {
|
|||||||
|
|
||||||
# Call the optimization functions to perform the checks
|
# Call the optimization functions to perform the checks
|
||||||
memory_check
|
memory_check
|
||||||
|
avx_check
|
||||||
mapcount_check
|
mapcount_check
|
||||||
filelimit_check
|
filelimit_check
|
||||||
|
|
||||||
@ -1147,10 +1171,10 @@ maintenance_menu() {
|
|||||||
# Set the options to be displayed in the menu
|
# Set the options to be displayed in the menu
|
||||||
menu_options=("$version_msg" "$sanitize_msg" "$shaders_msg" "$vidcache_msg" "$reset_msg" "$quit_msg")
|
menu_options=("$version_msg" "$sanitize_msg" "$shaders_msg" "$vidcache_msg" "$reset_msg" "$quit_msg")
|
||||||
# Set the corresponding functions to be called for each of the options
|
# Set the corresponding functions to be called for each of the options
|
||||||
menu_actions=("set_version" "sanitize" "rm_shaders" "rm_vidcache" "reset_helper" "menu_loop_done")
|
menu_actions=("set_version" "sanitize" "rm_shaders" "rm_dxvkcache" "reset_helper" "menu_loop_done")
|
||||||
|
|
||||||
# Calculate the total height the menu should be
|
# Calculate the total height the menu should be
|
||||||
menu_height="$(("$menu_option_height" * "${#menu_options[@]}" + "$menu_text_height"))"
|
menu_height="$(($menu_option_height * ${#menu_options[@]} + $menu_text_height))"
|
||||||
|
|
||||||
# Call the menu function. It will use the options as configured above
|
# Call the menu function. It will use the options as configured above
|
||||||
menu
|
menu
|
||||||
@ -1160,7 +1184,7 @@ maintenance_menu() {
|
|||||||
# Get a random Penguin's Star Citizen referral code
|
# Get a random Penguin's Star Citizen referral code
|
||||||
referral_randomizer() {
|
referral_randomizer() {
|
||||||
# Populate the referral codes array
|
# Populate the referral codes array
|
||||||
referral_codes=("STAR-4TZD-6KMM" "STAR-4XM2-VM99" "STAR-2NPY-FCR2" "STAR-T9Z9-7W6P" "STAR-VLBF-W2QR" "STAR-BYR6-YHMF" "STAR-3X2H-VZMX" "STAR-BRWN-FB9T" "STAR-FG6Y-N4Q4" "STAR-VLD6-VZRG" "STAR-T9KF-LV77" "STAR-4XHB-R7RF" "STAR-9NVF-MRN7" "STAR-3Q4W-9TC3" "STAR-3SBK-7QTT" "STAR-XFBT-9TTK" "STAR-F3H9-YPHN" "STAR-BYK6-RCCL" "STAR-XCKH-W6T7" "STAR-H292-39WK" "STAR-ZRT5-PJB7" "STAR-GMBP-SH9Y")
|
referral_codes=("STAR-4TZD-6KMM" "STAR-4XM2-VM99" "STAR-2NPY-FCR2" "STAR-T9Z9-7W6P" "STAR-VLBF-W2QR" "STAR-BYR6-YHMF" "STAR-3X2H-VZMX" "STAR-BRWN-FB9T" "STAR-FG6Y-N4Q4" "STAR-VLD6-VZRG" "STAR-T9KF-LV77" "STAR-4XHB-R7RF" "STAR-9NVF-MRN7" "STAR-3Q4W-9TC3" "STAR-3SBK-7QTT" "STAR-XFBT-9TTK" "STAR-F3H9-YPHN" "STAR-BYK6-RCCL" "STAR-XCKH-W6T7" "STAR-H292-39WK" "STAR-ZRT5-PJB7" "STAR-GMBP-SH9Y" "STAR-PLWB-LMFY" "STAR-TNZN-H4ZT" "STAR-T5G5-L2GJ" "STAR-6TPV-7QH2" "STAR-THHD-TV3Y")
|
||||||
# Pick a random array element. Scale a floating point number for
|
# Pick a random array element. Scale a floating point number for
|
||||||
# a more random distribution than simply calling RANDOM
|
# a more random distribution than simply calling RANDOM
|
||||||
random_code="${referral_codes[$(awk '{srand($2); print int(rand()*$1)}' <<< "${#referral_codes[@]} $RANDOM")]}"
|
random_code="${referral_codes[$(awk '{srand($2); print int(rand()*$1)}' <<< "${#referral_codes[@]} $RANDOM")]}"
|
||||||
@ -1170,15 +1194,15 @@ referral_randomizer() {
|
|||||||
|
|
||||||
# Toggle between the LIVE and PTU game directories for all Helper functions
|
# Toggle between the LIVE and PTU game directories for all Helper functions
|
||||||
set_version() {
|
set_version() {
|
||||||
if [ "$live_or_ptu" = "LIVE" ]; then
|
if [ "$live_or_ptu" = "$live_dir" ]; then
|
||||||
live_or_ptu="PTU"
|
live_or_ptu="$ptu_dir"
|
||||||
message info "The Helper will now target your Star Citizen PTU installation."
|
message info "The Helper will now target your Star Citizen PTU installation."
|
||||||
elif [ "$live_or_ptu" = "PTU" ]; then
|
elif [ "$live_or_ptu" = "$ptu_dir" ]; then
|
||||||
live_or_ptu="LIVE"
|
live_or_ptu="$live_dir"
|
||||||
message info "The Helper will now target your Star Citizen LIVE installation."
|
message info "The Helper will now target your Star Citizen LIVE installation."
|
||||||
else
|
else
|
||||||
debug_print continue "Unexpected game version provided. Defaulting to the LIVE installation."
|
debug_print continue "Unexpected game version provided. Defaulting to the LIVE installation."
|
||||||
live_or_ptu="LIVE"
|
live_or_ptu="$live_dir"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1202,15 +1226,101 @@ quit() {
|
|||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
# Check if Zenity is available
|
# Check if Zenity is available
|
||||||
has_zen=0
|
use_zenity=0
|
||||||
if [ -x "$(command -v zenity)" ]; then
|
if [ -x "$(command -v zenity)" ]; then
|
||||||
has_zen=1
|
use_zenity=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set some defaults
|
# Set some defaults
|
||||||
live_or_ptu="LIVE"
|
live_or_ptu="$live_dir"
|
||||||
lutris_needs_restart="false"
|
lutris_needs_restart="false"
|
||||||
|
|
||||||
|
# If invoked with command line arguments, process them and exit
|
||||||
|
if [ "$#" -gt 0 ]; then
|
||||||
|
while [ "$#" -gt 0 ]
|
||||||
|
do
|
||||||
|
# Victor_Tramp expects the spanish inquisition.
|
||||||
|
case "$1" in
|
||||||
|
--help | -h )
|
||||||
|
printf "Star Citizen Linux Users Group Helper Script
|
||||||
|
Usage: lug-helper <options>
|
||||||
|
-p, --preflight-check Run system optimization checks
|
||||||
|
-m, --manage-runners Install or remove Lutris runners
|
||||||
|
-u, --delete-user-folder Delete Star Citizen USER folder, preserving keybinds
|
||||||
|
-s, --delete-shaders Delete Star Citizen shaders directory
|
||||||
|
-c, --delete-dxvk-cache Delete Star Citizen dxvk cache file
|
||||||
|
-t, --target=[live|ptu] Target LIVE or PTU (default live)
|
||||||
|
-g, --use-gui=[yes|no] Use Zenity GUI (default yes)
|
||||||
|
-r, --get-referral Get a random LUG member's Star Citizen referral code
|
||||||
|
-x, --reset-helper Delete saved lug-helper configs
|
||||||
|
"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
--preflight-check | -p )
|
||||||
|
cargs+=("preflight_check")
|
||||||
|
;;
|
||||||
|
--manage-runners | -m )
|
||||||
|
cargs+=("runner_manage")
|
||||||
|
;;
|
||||||
|
--delete-user-folder | -u )
|
||||||
|
cargs+=("sanitize")
|
||||||
|
;;
|
||||||
|
--delete-shaders | -s )
|
||||||
|
cargs+=("rm_shaders")
|
||||||
|
;;
|
||||||
|
--delete-dxvk-cache | -c )
|
||||||
|
cargs+=("rm_dxvkcache")
|
||||||
|
;;
|
||||||
|
--target=* | -t=* )
|
||||||
|
live_or_ptu="$(echo "$1" | cut -d'=' -f2)"
|
||||||
|
if [ "$live_or_ptu" = "live" ] || [ "$live_or_ptu" = "LIVE" ]; then
|
||||||
|
live_or_ptu="$live_dir"
|
||||||
|
elif [ "$live_or_ptu" = "ptu" ] || [ "$live_or_ptu" = "PTU" ]; then
|
||||||
|
live_or_ptu="$ptu_dir"
|
||||||
|
else
|
||||||
|
printf "$0: Invalid option '$1'\n"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
--use-gui=* | -g=* )
|
||||||
|
# If zenity is unavailable, it has already been set to 0
|
||||||
|
# and this setting has no effect
|
||||||
|
if [ -x "$(command -v zenity)" ]; then
|
||||||
|
use_zenity="$(echo "$1" | cut -d'=' -f2)"
|
||||||
|
if [ "$use_zenity" = "yes" ] || [ "$use_zenity" = "YES" ] || [ "$use_zenity" = "1" ]; then
|
||||||
|
use_zenity=1
|
||||||
|
elif [ "$use_zenity" = "no" ] || [ "$use_zenity" = "NO" ] || [ "$use_zenity" = "0" ]; then
|
||||||
|
use_zenity=0
|
||||||
|
else
|
||||||
|
printf "$0: Invalid option '$1'\n"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
--get-referral | -r )
|
||||||
|
cargs+=("referral_randomizer")
|
||||||
|
;;
|
||||||
|
--reset-helper | -x )
|
||||||
|
cargs+=("reset_helper")
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
printf "$0: Invalid option '$1'\n"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
# Shift forward to the next argument and loop again
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
# Call the requested functions and exit
|
||||||
|
if [ "${#cargs[@]}" -gt 0 ]; then
|
||||||
|
for (( i=0; i<"${#cargs[@]}"; i++ )); do
|
||||||
|
${cargs[i]}
|
||||||
|
done
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Loop the main menu until the user selects quit
|
# Loop the main menu until the user selects quit
|
||||||
while true; do
|
while true; do
|
||||||
# Configure the menu
|
# Configure the menu
|
||||||
@ -1231,7 +1341,7 @@ while true; do
|
|||||||
menu_actions=("preflight_check" "runner_manage" "maintenance_menu" "referral_randomizer" "quit")
|
menu_actions=("preflight_check" "runner_manage" "maintenance_menu" "referral_randomizer" "quit")
|
||||||
|
|
||||||
# Calculate the total height the menu should be
|
# Calculate the total height the menu should be
|
||||||
menu_height="$(("$menu_option_height" * "${#menu_options[@]}" + "$menu_text_height"))"
|
menu_height="$(($menu_option_height * ${#menu_options[@]} + $menu_text_height))"
|
||||||
|
|
||||||
# Call the menu function. It will use the options as configured above
|
# Call the menu function. It will use the options as configured above
|
||||||
menu
|
menu
|
||||||
|
Reference in New Issue
Block a user