28 Commits

Author SHA1 Message Date
8f857476d0 Quiet grep in eac_workaround() 2022-10-15 16:00:18 -04:00
652c2fa4a0 Add shaders path to display directories feature
...in the maintenance & troubleshooting menu
2022-10-15 15:46:09 -04:00
6e4feecc85 Update phrasing 2022-10-15 15:06:02 -04:00
0e5fe688eb Quote zenity window icon path to handle spaces 2022-10-15 14:57:00 -04:00
8d130668d6 Fix pgrep/pkill commands to auto-restart Lutris 2022-10-15 14:41:31 -04:00
142e09800f Refactor download_select_install() function 2022-10-15 14:24:31 -04:00
1ae94e9b50 Add a referral code
Closes #43
2022-07-10 14:14:17 -06:00
747c799a8b more general message on zstd dependency check 2022-06-23 10:01:59 +02:00
ba907c44bf check if EAC-Workaround is commented out 2022-06-20 15:00:35 +02:00
e7a3b30564 check if zstd is installed 2022-06-20 14:44:42 +02:00
38e646578a format README.md - damn markdown newlines ;) 2022-06-16 09:02:39 +02:00
d0dc44dcd9 format README.md again 2022-06-16 08:57:11 +02:00
9986f1fe8c format README.md 2022-06-16 08:55:46 +02:00
bc11c184d2 Merge branch 'master' of github.com:starcitizen-lug/lug-helper 2022-06-16 08:48:51 +02:00
02a79aa859 added dependencies to Readme and glibc check to TKG 2022-06-16 08:48:02 +02:00
2eabf019a6 Merge pull request #40 from snatella/remove-molotov-releases
Remove snatella/molotov runners for now
2022-06-08 11:12:29 +02:00
bdb71475a8 Remove snatella/molotov runners for now 2022-06-07 09:15:44 +01:00
c627666705 added download option for TKG runners 2022-05-18 12:51:11 +02:00
65ac8ae4cd fixed if statement in rm_shaders 2022-05-16 18:37:32 +02:00
b4d9598fe5 simplified if statement for shader removal 2022-05-16 15:52:51 +02:00
dd81f24be3 Merge pull request #37 from starcitizen-lug/3.17-shaders
3.17 shaders
2022-05-16 15:41:32 +02:00
f99fe9b996 harmonized style 2022-05-16 15:40:12 +02:00
dffa971dc1 quoted lug_logo to avoid zenity bug if space is present in path - issue 36 2022-05-02 08:27:59 +02:00
fe1733542d added info message when no shaders directory is found 2022-04-23 11:12:51 +02:00
d6d28f1481 quoted variable for space safety 2022-04-22 17:15:37 +02:00
eb48d00396 adapted rm_shaders() to the new appdata-location used with 3.17 2022-04-22 17:04:22 +02:00
f072378617 Bump version 2022-04-09 10:53:28 -06:00
d6376ff9fa Prepare for shaders location change in 3.17 2022-04-09 10:51:29 -06:00
2 changed files with 69 additions and 31 deletions

View File

@ -67,6 +67,9 @@ From Source:
2. Extract it! 2. Extract it!
3. Run it! 3. Run it!
Dependencies: bash, coreurtils, curl, polkit (those should be installed by default on most distributions)
Optional Dependencies: zenity (for GUI), zstd (to extract some runners)
Arch Linux: https://aur.archlinux.org/packages/lug-helper/ Arch Linux: https://aur.archlinux.org/packages/lug-helper/
## Contributors: ## Contributors:

View File

@ -65,6 +65,12 @@ if [ ! -x "$(command -v curl)" ]; then
notify-send "lug-helper" "The required package 'curl' was not found on this system.\n" --icon=dialog-warning notify-send "lug-helper" "The required package 'curl' was not found on this system.\n" --icon=dialog-warning
exit 1 exit 1
fi fi
if [ ! -x "$(command -v zstd)" ]; then
# Print to stderr and also try warning the user through notify-send
printf "lug-helper.sh: The package 'zstd' was not found on this system. It is required for extracting some runner packages.\n" 1>&2
notify-send "lug-helper" "The package 'zstd' was not found on this system. It is required for extracting some runner packages.\n" --icon=dialog-warning
exit 1
fi
if [ ! -x "$(command -v mktemp)" ] || [ ! -x "$(command -v sort)" ] || [ ! -x "$(command -v basename)" ] || [ ! -x "$(command -v realpath)" ] || [ ! -x "$(command -v dirname)" ]; then if [ ! -x "$(command -v mktemp)" ] || [ ! -x "$(command -v sort)" ] || [ ! -x "$(command -v basename)" ] || [ ! -x "$(command -v realpath)" ] || [ ! -x "$(command -v dirname)" ]; 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
printf "lug-helper.sh: One or more required packages were not found on this system.\nPlease check that the following coreutils packages are installed:\n- mktemp\n- sort\n- basename\n- realpath\n- dirname\n" 1>&2 printf "lug-helper.sh: One or more required packages were not found on this system.\nPlease check that the following coreutils packages are installed:\n- mktemp\n- sort\n- basename\n- realpath\n- dirname\n" 1>&2
@ -102,6 +108,8 @@ install_path="drive_c/Program Files/Roberts Space Industries/$sc_base_dir"
live_dir="LIVE" live_dir="LIVE"
ptu_dir="PTU" ptu_dir="PTU"
# AppData directory
appdata_path="drive_c/users/$USER/AppData/Local/Star Citizen"
# Remaining directory paths are set at the end of the getdirs() function # Remaining directory paths are set at the end of the getdirs() function
######## Runners ########################################################### ######## Runners ###########################################################
@ -115,9 +123,9 @@ runners_dir="$data_dir/lutris/runners/wine"
# ie. "RawFox" "https://api.github.com/repos/rawfoxDE/raw-wine/releases" # ie. "RawFox" "https://api.github.com/repos/rawfoxDE/raw-wine/releases"
runner_sources=( runner_sources=(
"RawFox" "https://api.github.com/repos/starcitizen-lug/raw-wine/releases" "RawFox" "https://api.github.com/repos/starcitizen-lug/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" "/dev/null" "https://api.github.com/repos/gort818/wine-sc-lug/releases"
"GloriousEggroll" "https://api.github.com/repos/GloriousEggroll/wine-ge-custom/releases" "GloriousEggroll" "https://api.github.com/repos/GloriousEggroll/wine-ge-custom/releases"
"TKG" "https://api.github.com/repos/Frogging-Family/wine-tkg-git/releases"
) )
######## DXVK ############################################################## ######## DXVK ##############################################################
@ -170,7 +178,7 @@ lug_wiki="https://github.com/starcitizen-lug/information-howtos/wiki"
# Github repo and script version info # Github repo and script version info
repo="starcitizen-lug/lug-helper" repo="starcitizen-lug/lug-helper"
releases_url="https://github.com/$repo/releases" releases_url="https://github.com/$repo/releases"
current_version="v1.19" current_version="v1.21"
############################################################################ ############################################################################
############################################################################ ############################################################################
@ -224,17 +232,17 @@ message() {
"info") "info")
# info message # info message
# call format: message info "text to display" # call format: message info "text to display"
margs=("--info" "--window-icon=$lug_logo" "--no-wrap" "--text=") margs=("--info" "--window-icon=\"$lug_logo\"" "--no-wrap" "--text=")
;; ;;
"warning") "warning")
# warning message # warning message
# call format: message warning "text to display" # call format: message warning "text to display"
margs=("--warning" "--window-icon=$lug_logo" "--text=") margs=("--warning" "--window-icon=\"$lug_logo\"" "--text=")
;; ;;
"question") "question")
# question # question
# call format: if message question "question to ask?"; then... # call format: if message question "question to ask?"; then...
margs=("--question" "--window-icon=$lug_logo" "--text=") margs=("--question" "--window-icon=\"$lug_logo\"" "--text=")
;; ;;
*) *)
debug_print exit "Script Error: Invalid message type passed to the message function. Aborting." debug_print exit "Script Error: Invalid message type passed to the message function. Aborting."
@ -347,7 +355,7 @@ menu() {
done done
# Display the zenity radio button menu # 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 --cancel-label "$cancel_label" --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 # Loop through the options array to match the chosen option
matched="false" matched="false"
@ -525,7 +533,7 @@ getdirs() {
# The location within the USER directory to which the game exports keybinds # The location within the USER directory to which the game exports keybinds
keybinds_dir="$user_dir/Controls/Mappings" keybinds_dir="$user_dir/Controls/Mappings"
# Shaders directory # Shaders directory
shaders_dir="$user_dir/shaders" shaders_dir="$wine_prefix/$appdata_path/shaders"
# dxvk cache file # dxvk cache file
dxvk_cache="$game_path/$live_or_ptu/StarCitizen.dxvk-cache" dxvk_cache="$game_path/$live_or_ptu/StarCitizen.dxvk-cache"
# Where to store backed up keybinds # Where to store backed up keybinds
@ -534,6 +542,8 @@ getdirs() {
# Display all directories currently used by this helper and Star Citizen # Display all directories currently used by this helper and Star Citizen
display_dirs() { display_dirs() {
declare -a dirs_list
# Helper configs and keybinds # Helper configs and keybinds
if [ -d "$conf_dir/$conf_subdir" ]; then 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") dirs_list+=("\n\nHelper configuration:\n$conf_dir/$conf_subdir\n\nKeybind backups:\n$conf_dir/$conf_subdir/keybinds")
@ -549,6 +559,11 @@ display_dirs() {
dirs_list+="\n\nStar Citizen game directory:\n$(cat "$conf_dir/$conf_subdir/$game_conf")" dirs_list+="\n\nStar Citizen game directory:\n$(cat "$conf_dir/$conf_subdir/$game_conf")"
fi fi
# Star Citizen shaders path
if [ -f "$conf_dir/$conf_subdir/$wine_conf" ]; then
dirs_list+="\n\nStar Citizen shaders:\n$(cat "$conf_dir/$conf_subdir/$wine_conf")/$appdata_path"
fi
# Lutris runners # Lutris runners
if [ -d "$runners_dir" ]; then if [ -d "$runners_dir" ]; then
dirs_list+="\n\nLutris Runners:\n$runners_dir" dirs_list+="\n\nLutris Runners:\n$runners_dir"
@ -559,7 +574,7 @@ display_dirs() {
dirs_list+="\n\nLutris DXVK Versions:\n$dxvk_dir" dirs_list+="\n\nLutris DXVK Versions:\n$dxvk_dir"
fi fi
# Formatting # Format the info header
message_heading="These directories are currently being used by this Helper and Star Citizen" message_heading="These directories are currently being used by this Helper and Star Citizen"
if [ "$use_zenity" -eq 1 ]; then if [ "$use_zenity" -eq 1 ]; then
message_heading="<b>$message_heading</b>" message_heading="<b>$message_heading</b>"
@ -901,10 +916,10 @@ preflight_check() {
# Restart lutris if necessary # Restart lutris if necessary
lutris_restart() { lutris_restart() {
if [ "$lutris_needs_restart" = "true" ] && [ "$(pgrep lutris)" ]; then if [ "$lutris_needs_restart" = "true" ] && [ "$(pgrep -f lutris)" ]; then
if message question "Lutris must be restarted to detect the changes.\nWould you like this Helper to restart it for you?"; then if message question "Lutris must be restarted to detect the changes.\nWould you like this Helper to restart it for you?"; then
debug_print continue "Restarting Lutris..." debug_print continue "Restarting Lutris..."
pkill -SIGTERM lutris && nohup lutris </dev/null &>/dev/null & pkill -f -SIGTERM lutris && nohup lutris </dev/null &>/dev/null &
fi fi
fi fi
lutris_needs_restart="false" lutris_needs_restart="false"
@ -1185,7 +1200,7 @@ download_select_install() {
esac esac
# For runners, check GlibC version against runner requirements # For runners, check GlibC version against runner requirements
if [ "$download_type" = "runner" ] && [ "$contributor_name" = "/dev/null" ]; then if [ "$download_type" = "runner" ] && ( [ "$contributor_name" = "/dev/null" ] || [ "$contributor_name" = "TKG" ] ); then
required_glibc="2.33" required_glibc="2.33"
system_glibc="$(ldd --version | awk '/ldd/{print $NF}')" system_glibc="$(ldd --version | awk '/ldd/{print $NF}')"
@ -1201,7 +1216,7 @@ download_select_install() {
# To add new sources, handle them here, in the if statement # To add new sources, handle them here, in the if statement
# just above, and the download_install function above # just above, and the download_install function above
if [ "$download_url_type" = "github" ]; then if [ "$download_url_type" = "github" ]; then
download_versions=($(curl -s "$contributor_url" | awk '/browser_download_url/ {print $2}' | grep -vE "*.sha512sum" | xargs basename -a)) download_versions=($(curl -s "$contributor_url" | awk '/browser_download_url/ {print $2}' | xargs basename -a))
else else
debug_print exit "Script error: Unknown api/url format in ${download_type}_sources array. Aborting." debug_print exit "Script error: Unknown api/url format in ${download_type}_sources array. Aborting."
fi fi
@ -1224,9 +1239,13 @@ download_select_install() {
# and add them to the menu options # and add them to the menu options
# To add new file extensions, handle them here and in # To add new file extensions, handle them here and in
# the download_install function above # the download_install function above
for (( i=0; i<"$max_download_items" && i<"${#download_versions[@]}"; i++ )); do for (( i=0,num_download_items=0; i<"${#download_versions[@]}" && "$num_download_items"<"$max_download_items"; i++ )); do
# Get the file name minus the extension # Get the file name minus the extension
case "${download_versions[i]}" in case "${download_versions[i]}" in
*.sha*sum | *.ini | proton*)
# Ignore hashes, configs, and proton downloads
continue
;;
*.tar.gz) *.tar.gz)
download_name="$(basename "${download_versions[i]}" .tar.gz)" download_name="$(basename "${download_versions[i]}" .tar.gz)"
;; ;;
@ -1240,7 +1259,9 @@ download_select_install() {
download_name="$(basename "${download_versions[i]}" .tar.zst)" download_name="$(basename "${download_versions[i]}" .tar.zst)"
;; ;;
*) *)
debug_print exit "Unknown archive filetype in download_select_install function. Aborting." # Print a warning and move on to the next item
debug_print continue "Warning: Unknown archive filetype in download_select_install() function. Offending String: ${download_versions[i]}"
continue
;; ;;
esac esac
@ -1251,6 +1272,9 @@ download_select_install() {
menu_options+=("$download_name") menu_options+=("$download_name")
fi fi
menu_actions+=("download_install $i") menu_actions+=("download_install $i")
# Increment the added items counter
num_download_items="$(($num_download_items+1))"
done done
# Complete the menu by adding the option to go back to the previous menu # Complete the menu by adding the option to go back to the previous menu
@ -1436,8 +1460,12 @@ eac_workaround() {
eac_hosts="127.0.0.1 modules-cdn.eac-prod.on.epicgames.com" eac_hosts="127.0.0.1 modules-cdn.eac-prod.on.epicgames.com"
# Check if EAC workaround is already applied # Check if EAC workaround is already applied
if grep "$eac_hosts" /etc/hosts; then if grep -q "$eac_hosts" /etc/hosts; then
if grep -q "^$eac_hosts" /etc/hosts; then
message info "The Easy Anti-Cheat workaround has already been applied.\nYou're all set!" message info "The Easy Anti-Cheat workaround has already been applied.\nYou're all set!"
else
message info "The Easy Anti-Cheat workaround has already been applied, but may be commented out.\nNo changes have been made, please edit /etc/hosts manually."
fi
return 1 return 1
fi fi
@ -1505,18 +1533,25 @@ rm_shaders() {
return 0 return 0
fi fi
# Sanity check # Create an array containing all directories in the appdata_path
if [ ! -d "$shaders_dir" ]; then for appdata_list in "$wine_prefix/$appdata_path"/*; do
message warning "Shaders directory not found. There is nothing to delete!\n\n$shaders_dir" if [ -d "$appdata_list" ]; then
return 0 appdata_items+=("$appdata_list")
fi fi
done
# Delete the shader directory # Delete shaders directory in every directory beginning with "sc-alpha"
if message question "The following directory will be deleted:\n\n$shaders_dir\n\nDo you want to proceed?"; then for (( i=0; i<"${#appdata_items[@]}"; i++ )); do
debug_print continue "Deleting $shaders_dir..." if [[ "${appdata_items[i]}" = "$wine_prefix/$appdata_path"/sc-alpha* ]] && [[ -d "${appdata_items[i]}"/shaders ]]; then # check if the item in the array begins with sc-alpha
rm -r "$shaders_dir" if message question "The following directory will be deleted:\n\n${appdata_items[i]}/shaders\n\nDo you want to proceed?"; then
debug_print continue "Deleting ${appdata_items[i]}/shaders..."
rm -r "${appdata_items[i]}/shaders"
message info "Your shaders have been deleted!" message info "Your shaders have been deleted!"
fi fi
elif [ $i = $(( "${#appdata_items[@]}" - 1 )) ]; then # display message when end of array is reached and no shaders or sc-alpha directories were found
message info "No more shader directories found"
fi
done
} }
# Delete DXVK cache # Delete DXVK cache
@ -1582,7 +1617,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" "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" "STAR-YD4Z-TQZV" "STAR-XLN7-9XNJ" "STAR-N62T-2R39" "STAR-3S3D-9HXQ" "STAR-TRZF-NMCV" "STAR-TLLJ-SMG4" "STAR-MFT6-Q44H" "STAR-TZX2-TPWF") 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" "STAR-YD4Z-TQZV" "STAR-XLN7-9XNJ" "STAR-N62T-2R39" "STAR-3S3D-9HXQ" "STAR-TRZF-NMCV" "STAR-TLLJ-SMG4" "STAR-MFT6-Q44H" "STAR-TZX2-TPWF" "STAR-WCHN-4ZMX")
# 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")]}"