30 Commits
v1.8 ... v1.10

Author SHA1 Message Date
709cb6dbae Bump version number 2021-10-11 10:26:31 -04:00
810f21415e Must be beautiful! 2021-10-11 10:25:25 -04:00
3e982b3303 Fix syntax 2021-10-11 10:10:20 -04:00
cfeb3a841f Update contributors 2021-10-11 09:36:14 -04:00
60af93add3 Update README.md 2021-10-11 09:35:57 -04:00
b64eaf88c5 Add referral code 2021-10-11 09:28:15 -04:00
e8d96c45a0 Fix previous sanity check 2021-10-10 22:16:02 -04:00
d8826f608c Add sanity check 2021-10-10 22:12:28 -04:00
07a99d3aa1 Add show directories to command line arguments 2021-10-10 22:06:00 -04:00
b4791a0b7d Formatting 2021-09-24 10:11:10 -04:00
e43a59ce7b Add moar referral codes! 2021-09-20 15:43:26 -04:00
fc98118ac5 List directories used by the helper and game 2021-09-19 23:13:46 -04:00
4fd9fec8f7 Fix version number (don't ask) 2021-09-18 16:33:06 -04:00
130704107b Bump version 2021-09-18 16:31:37 -04:00
15cad464e3 Remove extraneous / from path 2021-09-18 16:22:50 -04:00
cabfd03c29 Bump version number 2021-09-18 15:52:41 -04:00
33170fae78 Add better cancel button labels
Closes #22
2021-09-18 15:51:57 -04:00
b701ea5e3d Fix gzip error for non-gzip archives 2021-09-18 15:27:51 -04:00
05d75ec82f Ignore sha512sum files when creating download list 2021-09-18 15:17:39 -04:00
2f97a8eb2d Revert "ignoring .sha512sum files in runner release pages" and "solving trying to download the .sha512sum as archive"
Reverts commits c07e673 and 675621c.
2021-09-18 15:14:40 -04:00
cb3fc5d0d7 Reorganize version checker 2021-09-18 13:10:44 -04:00
c42d459ef2 Minor syntax, formatting, and organizational tweaks 2021-09-18 12:57:22 -04:00
675621c4c3 solving trying to download the .sha512sum as archive 2021-07-28 11:08:28 +02:00
c07e673c0d ignoring .sha512sum files in runner release pages 2021-07-27 20:32:07 +02:00
b85df29d6d Revert "ignoring .sha512sum files in runner release pages"
This reverts commit 7f3d84a8bc.
2021-07-27 20:31:02 +02:00
7f3d84a8bc ignoring .sha512sum files in runner release pages 2021-07-27 20:29:02 +02:00
6533cf98bd Merge pull request #20 from Wrzlprnft/patch-1
fix locale causing memory preflight check to fail
2021-07-20 08:49:37 +02:00
c7c8cd1ecd fix locale causing memory preflight check to fail
if the locale uses a decimal `,` instead of `.`, the memory preflight check fails
fix provided by @gort818
2021-07-19 16:01:38 +02:00
e0d149494d added script version check and glibc version check for /dev/null 2021-06-15 15:34:40 +02:00
9800420d73 added GloriousEggrolls lutris-Builds - thanks to Eutyches 2021-06-08 17:09:25 +02:00
2 changed files with 138 additions and 22 deletions

View File

@ -23,7 +23,7 @@ Keybinds are backed up to *$XDG_CONFIG_HOME/starcitizen-lug/keybinds/*
`Manage Lutris Runners`
- Quickly install and delete Lutris wine runners
`User Folder Maintenance and Troubleshooting`
`Maintenance and Troubleshooting`
- `Switch the helper between LIVE and PTU`
- Toggle between targeting LIVE or PTU for all of the above options. Defaults to LIVE on each run.
@ -34,12 +34,15 @@ Keybinds are backed up to *$XDG_CONFIG_HOME/starcitizen-lug/keybinds/*
- To re-import your keybinds from within the game, select them from the list:
- *Options->Keybindings->Control Profiles*
- `Delete my shaders only`
- `Delete my shaders folder only`
- Sometimes all you need to do between major version updates is delete your shaders directory.
- `Delete my DXVK cache`
- A troubleshooting step that sometimes helps fix various issues and crashes.
- `Display Helper and Star Citizen directories`
- Show all the directories currently in use by both the Helper and Star Citizen.
- `Reset Helper configs`
- Delete the configs saved by the helper in *$XDG_CONFIG_HOME/starcitizen-lug/*
@ -62,4 +65,5 @@ Arch Linux: https://aur.archlinux.org/packages/lug-helper/
- https://github.com/pstn
- https://github.com/gort818
- https://github.com/victort
- https://github.com/Wrzlprnft
- Runner Downloader inspired by https://github.com/richardtatum/sc-runner-updater

View File

@ -43,12 +43,13 @@
# Contributor: https://github.com/pstn
# Contributor: https://github.com/gort818
# Contributor: https://github.com/victort
# Contributor: https://github.com/Wrzlprnft
# Runner Downloader inspired by:
# https://github.com/richardtatum/sc-runner-updater
############################################################################
# Check if script is run as root
if [ "$(id -u)" = 0 ]; then
if [ "$(id -u)" -eq 0 ]; then
echo "This script is not supposed to be run as root!"
exit 1
fi
@ -106,6 +107,8 @@ runners_dir="$data_dir/lutris/runners/wine"
runner_sources=(
"RawFox" "https://api.github.com/repos/rawfoxDE/raw-wine/releases"
"Molotov/Snatella" "https://api.github.com/repos/snatella/wine-runner-sc/releases"
"/dev/null" "https://api.github.com/repos/gort818/wine-sc-lug/releases"
"GloriousEggroll" "https://api.github.com/repos/GloriousEggroll/wine-ge-custom/releases"
)
# Set a maximum number of runner versions to display from each url
max_runners=20
@ -124,6 +127,11 @@ else
lug_logo="info"
fi
# Github repo and script version info
repo="the-sane/lug-helper"
releases_url="https://github.com/the-sane/lug-helper/releases"
current_version="v1.10"
############################################################################
############################################################################
@ -256,6 +264,7 @@ message() {
# This text will be displayed above the menu options.
# Zenity supports Pango Markup for text formatting.
# - The integer "menu_height" specifies the height of the zenity menu.
# - The string "cancel_label" should contain the text of the cancel button.
#
# The final element in each array is expected to be a quit option.
#
@ -277,6 +286,8 @@ menu() {
debug_print exit "Script error: The string 'menu_text_terminal' was not set\nbefore calling the menu function. Aborting."
elif [ -z "$menu_height" ]; then
debug_print exit "Script error: The string 'menu_height' was not set\nbefore calling the menu function. Aborting."
elif [ -z "$cancel_label" ]; then
debug_print exit "Script error: The string 'menu_height' was not set\nbefore calling the menu function. Aborting."
fi
# Use Zenity if it is available
@ -296,7 +307,7 @@ menu() {
done
# Display the zenity radio button menu
choice="$(zenity --list --radiolist --width="480" --height="$menu_height" --text="$menu_text_zenity" --title="Star Citizen LUG Helper" --hide-header --window-icon=$lug_logo --column="" --column="Option" "${zen_options[@]}" 2>/dev/null)"
choice="$(zenity --list --radiolist --width="480" --height="$menu_height" --text="$menu_text_zenity" --title="Star Citizen LUG Helper" --hide-header --cancel-label "$cancel_label" --window-icon=$lug_logo --column="" --column="Option" "${zen_options[@]}" 2>/dev/null)"
# Loop through the options array to match the chosen option
matched="false"
@ -470,7 +481,7 @@ getdirs() {
# $live_or_ptu is set in the set_version() function
############################################################################
# The game's user directory
user_dir="$game_path/$live_or_ptu/USER/Client/0/"
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
@ -481,6 +492,37 @@ getdirs() {
backup_path="$conf_dir/$conf_subdir"
}
# Display all directories currently used by this helper and Star Citizen
display_dirs() {
# Helper configs and keybinds
if [ -d "$conf_dir/$conf_subdir" ]; then
dirs_list+=("\n\nHelper configuration:\n$conf_dir/$conf_subdir\n\nKeybind backups:\n$conf_dir/$conf_subdir/keybinds")
fi
# Wine prefix
if [ -f "$conf_dir/$conf_subdir/$wine_conf" ]; then
dirs_list+="\n\nWine prefix:\n$(cat "$conf_dir/$conf_subdir/$wine_conf")"
fi
# Star Citizen installation
if [ -f "$conf_dir/$conf_subdir/$game_conf" ]; then
dirs_list+="\n\nStar Citizen game directory:\n$(cat "$conf_dir/$conf_subdir/$game_conf")"
fi
# Lutris runners
if [ -d "$runners_dir" ]; then
dirs_list+="\n\nLutris Runners:\n$runners_dir"
fi
# Formatting
message_heading="These directories are currently being used by this Helper and Star Citizen"
if [ "$use_zenity" -eq 1 ]; then
message_heading="<b>$message_heading</b>"
fi
message info "$message_heading\n${dirs_list[@]}"
}
# Save exported keybinds, wipe the USER directory, and restore keybinds
sanitize() {
# Prompt user to back up the current keybinds in the game
@ -663,7 +705,7 @@ filelimit_check() {
# Check total system memory
memory_check() {
memtotal="$(awk '/MemTotal/ {printf "%.1f \n", $2/1024/1024}' /proc/meminfo)"
memtotal="$(LC_NUMERIC=C awk '/MemTotal/ {printf "%.1f \n", $2/1024/1024}' /proc/meminfo)"
if [ ${memtotal%.*} -ge "15" ]; then
preflight_pass+=("Your system has $memtotal GB of memory.")
else
@ -792,6 +834,9 @@ runner_select_delete() {
menu_height="400"
fi
# Set the label for the cancel button
cancel_label="Go Back"
# Call the menu function. It will use the options as configured above
menu
}
@ -819,6 +864,9 @@ runner_install() {
*.tgz)
runner_name="$(basename "$runner_file" .tgz)"
;;
*.tar.xz)
runner_name="$(basename "$runner_file" .tar.xz)"
;;
*)
debug_print exit "Unknown archive filetype in runner_install function. Aborting."
;;
@ -873,7 +921,7 @@ runner_install() {
# Get the path of the first item listed in the archive
# This should either be a subdirectory or the path ./
# depending on how the archive was created
first_filepath="$(stdbuf -oL tar -tzf "$tmp_dir/$runner_file" | head -n 1)"
first_filepath="$(stdbuf -oL tar -tf "$tmp_dir/$runner_file" | head -n 1)"
# Extract the runner
case "$first_filepath" in
@ -882,10 +930,10 @@ runner_install() {
debug_print continue "Installing runner into $runners_dir/$runner_name..."
if [ "$use_zenity" -eq 1 ]; then
# 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 -xf "$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
else
mkdir -p "$runners_dir/$runner_name" && tar -xzf "$tmp_dir/$runner_file" -C "$runners_dir/$runner_name"
mkdir -p "$runners_dir/$runner_name" && tar -xf "$tmp_dir/$runner_file" -C "$runners_dir/$runner_name"
fi
lutris_needs_restart="true"
;;
@ -894,10 +942,10 @@ runner_install() {
debug_print continue "Installing runner into $runners_dir..."
if [ "$use_zenity" -eq 1 ]; then
# Use Zenity progress bar
mkdir -p "$runners_dir" && tar -xzf "$tmp_dir/$runner_file" -C "$runners_dir" | \
mkdir -p "$runners_dir" && tar -xf "$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
else
mkdir -p "$runners_dir" && tar -xzf "$tmp_dir/$runner_file" -C "$runners_dir"
mkdir -p "$runners_dir" && tar -xf "$tmp_dir/$runner_file" -C "$runners_dir"
fi
lutris_needs_restart="true"
;;
@ -916,7 +964,8 @@ runner_select_install() {
debug_print exit "Script error: The runner_select_install function expects a numerical argument. Aborting."
fi
# Store the url from the selected contributor
# Store info from the selected contributor
contributor_name="${runner_sources[$1]}"
contributor_url="${runner_sources[$1+1]}"
# Check the provided contributor url to make sure we know how to handle it
@ -931,11 +980,22 @@ runner_select_install() {
;;
esac
# Check GlibC version against the requirements of the selected runner
if [ "$contributor_name" = "/dev/null" ]; then
required_glibc="2.33"
system_glibc="$(ldd --version | awk '/ldd/{print $NF}')"
if [ "$(bc <<< "$required_glibc > $system_glibc")" = "1" ]; then
message warning "Your glibc version is incompatible with the selected runner.\n\nSystem glibc: v$system_glibc\nMinimum required glibc: v$required_glibc"
return 1
fi
fi
# Fetch a list of runner versions from the selected contributor
# To add new sources, handle them here, in the if statement
# just above, and the runner_install function above
if [ "$runner_url_type" = "github" ]; then
runner_versions=($(curl -s "$contributor_url" | awk '/browser_download_url/ {print $2}' | xargs basename -a))
runner_versions=($(curl -s "$contributor_url" | awk '/browser_download_url/ {print $2}' | grep -vE "*.sha512sum" | xargs basename -a))
else
debug_print exit "Script error: Unknown api/url format in runner_sources array. Aborting."
fi
@ -967,6 +1027,9 @@ runner_select_install() {
*.tgz)
runner_name="$(basename "${runner_versions[i]}" .tgz)"
;;
*.tar.xz)
runner_name="$(basename "${runner_versions[i]}" .tar.xz)"
;;
*)
debug_print exit "Unknown archive filetype in runner_select_install function. Aborting."
;;
@ -991,6 +1054,9 @@ runner_select_install() {
menu_height="400"
fi
# Set the label for the cancel button
cancel_label="Go Back"
# Call the menu function. It will use the options as configured above
menu
}
@ -1038,6 +1104,9 @@ runner_manage() {
# Calculate the total height the menu should be
menu_height="$(($menu_option_height * ${#menu_options[@]} + $menu_text_height))"
# Set the label for the cancel button
cancel_label="Go Back"
# Call the menu function. It will use the options as configured above
menu
done
@ -1096,7 +1165,13 @@ preflight_check() {
# Display the results of the preflight check
if [ -z "$preflight_fail_string" ]; then
message info "Preflight Check Complete\n\nYour system is optimized for Star Citizen!\n\n$preflight_pass_string"
# Formatting
message_heading="Preflight Check Complete"
if [ "$use_zenity" -eq 1 ]; then
message_heading="<b>$message_heading</b>"
fi
message info "$message_heading\n\nYour system is optimized for Star Citizen!\n\n$preflight_pass_string"
else
if [ -z "$preflight_action_funcs" ]; then
message warning "$preflight_pass_string$preflight_fail_string"
@ -1165,17 +1240,21 @@ maintenance_menu() {
sanitize_msg="Delete my Star Citizen USER folder and preserve my keybinds"
shaders_msg="Delete my shaders folder only (Do this after each game update)"
vidcache_msg="Delete my DXVK cache"
dirs_msg="Display Helper and Star Citizen directories"
reset_msg="Reset Helper configs"
quit_msg="Return to the main 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" "$dirs_msg" "$reset_msg" "$quit_msg")
# Set the corresponding functions to be called for each of the options
menu_actions=("set_version" "sanitize" "rm_shaders" "rm_dxvkcache" "reset_helper" "menu_loop_done")
menu_actions=("set_version" "sanitize" "rm_shaders" "rm_dxvkcache" "display_dirs" "reset_helper" "menu_loop_done")
# Calculate the total height the menu should be
menu_height="$(($menu_option_height * ${#menu_options[@]} + $menu_text_height))"
# Set the label for the cancel button
cancel_label="Go Back"
# Call the menu function. It will use the options as configured above
menu
done
@ -1184,7 +1263,7 @@ maintenance_menu() {
# Get a random Penguin's Star Citizen referral code
referral_randomizer() {
# 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" "STAR-PLWB-LMFY" "STAR-TNZN-H4ZT" "STAR-T5G5-L2GJ" "STAR-6TPV-7QH2" "STAR-THHD-TV3Y")
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" "STAR-7ZFS-PK2L" "STAR-SRQN-43TB" "STAR-9TDG-D4H9" "STAR-BPH3-THJC" "STAR-HL3M-R5KC" "STAR-GBS5-LTVB" "STAR-CJ3Y-KZZ4" "STAR-5GRM-7HBY" "STAR-G2GX-Y2QJ" "STAR-YWY3-H4XX" "STAR-6VGM-PTKC" "STAR-T6MZ-QFHX" "STAR-T2K6-LXFW" "STAR-XN25-9CJJ" "STAR-47V3-4QGB")
# Pick a random array element. Scale a floating point number for
# a more random distribution than simply calling RANDOM
random_code="${referral_codes[$(awk '{srand($2); print int(rand()*$1)}' <<< "${#referral_codes[@]} $RANDOM")]}"
@ -1216,6 +1295,19 @@ reset_helper() {
fi
}
# Get the latest release version of a repo. Expects "user/repo_name" as input
# Credits for this go to https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c
get_latest_release() {
# Sanity check
if [ "$#" -lt 1 ]; then
debug_print exit "Script error: The get_latest_release function expects one argument. Aborting."
fi
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
quit() {
exit 0
}
@ -1235,6 +1327,19 @@ fi
live_or_ptu="$live_dir"
lutris_needs_restart="false"
# Check if a newer verison of the script is available
latest_version="$(get_latest_release "$repo")"
if [ "$latest_version" != "$current_version" ]; then
if [ "$use_zenity" -eq 1 ]; then
releases_url_formatted="<a href='$releases_url'>$releases_url</a>"
else
releases_url_formatted="$releases_url"
fi
message info "The latest version of the LUG Helper is $latest_version\nYou are using $current_version\n\nYou can download new releases here:\n$releases_url_formatted"
fi
# If invoked with command line arguments, process them and exit
if [ "$#" -gt 0 ]; then
while [ "$#" -gt 0 ]
@ -1250,8 +1355,9 @@ Usage: lug-helper <options>
-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)
-g, --use-gui=[yes|no] Use Zenity GUI if available (default yes)
-r, --get-referral Get a random LUG member's Star Citizen referral code
-d, --show-directories Show all Star Citizen and LUG Helper directories
-x, --reset-helper Delete saved lug-helper configs
"
exit 0
@ -1300,6 +1406,9 @@ Usage: lug-helper <options>
--get-referral | -r )
cargs+=("referral_randomizer")
;;
--show-directories | -d )
cargs+=("display_dirs")
;;
--reset-helper | -x )
cargs+=("reset_helper")
;;
@ -1331,7 +1440,7 @@ while true; do
# Configure the menu options
preflight_msg="Preflight Check (System Optimization)"
runners_msg="Manage Lutris Runners"
maintenance_msg="User Folder Maintenance and Troubleshooting"
maintenance_msg="Maintenance and Troubleshooting"
randomizer_msg="Get a random Penguin's Star Citizen referral code"
quit_msg="Quit"
@ -1343,6 +1452,9 @@ while true; do
# Calculate the total height the menu should be
menu_height="$(($menu_option_height * ${#menu_options[@]} + $menu_text_height))"
# Set the label for the cancel button
cancel_label="Quit"
# Call the menu function. It will use the options as configured above
menu
done