Compare commits

..

6 Commits

Author SHA1 Message Date
the-sane
8f857476d0 Quiet grep in eac_workaround() 2022-10-15 16:00:18 -04:00
the-sane
652c2fa4a0 Add shaders path to display directories feature
...in the maintenance & troubleshooting menu
2022-10-15 15:46:09 -04:00
the-sane
6e4feecc85 Update phrasing 2022-10-15 15:06:02 -04:00
the-sane
0e5fe688eb Quote zenity window icon path to handle spaces 2022-10-15 14:57:00 -04:00
the-sane
8d130668d6 Fix pgrep/pkill commands to auto-restart Lutris 2022-10-15 14:41:31 -04:00
the-sane
142e09800f Refactor download_select_install() function 2022-10-15 14:24:31 -04:00

View File

@ -232,17 +232,17 @@ message() {
"info")
# info message
# 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 message
# call format: message warning "text to display"
margs=("--warning" "--window-icon=$lug_logo" "--text=")
margs=("--warning" "--window-icon=\"$lug_logo\"" "--text=")
;;
"question")
# question
# 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."
@ -542,6 +542,8 @@ getdirs() {
# Display all directories currently used by this helper and Star Citizen
display_dirs() {
declare -a dirs_list
# 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")
@ -557,6 +559,11 @@ display_dirs() {
dirs_list+="\n\nStar Citizen game directory:\n$(cat "$conf_dir/$conf_subdir/$game_conf")"
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
if [ -d "$runners_dir" ]; then
dirs_list+="\n\nLutris Runners:\n$runners_dir"
@ -567,7 +574,7 @@ display_dirs() {
dirs_list+="\n\nLutris DXVK Versions:\n$dxvk_dir"
fi
# Formatting
# Format the info header
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>"
@ -909,10 +916,10 @@ preflight_check() {
# Restart lutris if necessary
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
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
lutris_needs_restart="false"
@ -1209,7 +1216,7 @@ download_select_install() {
# To add new sources, handle them here, in the if statement
# just above, and the download_install function above
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
debug_print exit "Script error: Unknown api/url format in ${download_type}_sources array. Aborting."
fi
@ -1232,9 +1239,13 @@ download_select_install() {
# and add them to the menu options
# To add new file extensions, handle them here and in
# 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
case "${download_versions[i]}" in
*.sha*sum | *.ini | proton*)
# Ignore hashes, configs, and proton downloads
continue
;;
*.tar.gz)
download_name="$(basename "${download_versions[i]}" .tar.gz)"
;;
@ -1248,20 +1259,22 @@ download_select_install() {
download_name="$(basename "${download_versions[i]}" .tar.zst)"
;;
*)
download_name="skip"
debug_print continue "Unknown archive filetype in download_select_install function. Offending String: ${download_versions[i]}"
# 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
# Add the file names to the menu
if [[ "$download_name" = "skip" ]] || [[ "${download_versions[i]}" = "proton"* ]] ; then # filter out other file types or proton-downloads (needed for TKG)
continue
elif [ -d "$download_dir/$download_name" ]; then
if [ -d "$download_dir/$download_name" ]; then
menu_options+=("$download_name [installed]")
else
menu_options+=("$download_name")
fi
menu_actions+=("download_install $i")
# Increment the added items counter
num_download_items="$(($num_download_items+1))"
done
# Complete the menu by adding the option to go back to the previous menu
@ -1447,11 +1460,11 @@ eac_workaround() {
eac_hosts="127.0.0.1 modules-cdn.eac-prod.on.epicgames.com"
# Check if EAC workaround is already applied
if grep "$eac_hosts" /etc/hosts; then
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!"
else
message info "The Easy Anti-Cheat workaround has already been applied, but is commented out.\nNo changes have been made, please edit /etc/hosts manually!"
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
fi