Compare commits

...

3 Commits

Author SHA1 Message Date
the-sane
85932824ca Reference relative install paths to support NixOS 2023-08-01 13:01:46 -04:00
the-sane
2214d6a9e7 Change gui command-line argument 2023-08-01 12:11:15 -04:00
the-sane
3f4c1eaab2 Fix url formatting with command-line arguments 2023-08-01 12:04:59 -04:00

View File

@ -152,8 +152,8 @@ shaders_subdir="shaders"
# Use logo installed by a packaged version of this script if available # Use logo installed by a packaged version of this script if available
# Otherwise, default to the logo in the same directory # Otherwise, default to the logo in the same directory
if [ -f "/usr/share/pixmaps/lug-logo.png" ]; then if [ -f "$(dirname "$helper_dir")/share/pixmaps/lug-logo.png" ]; then
lug_logo="/usr/share/pixmaps/lug-logo.png" lug_logo="$(dirname "$helper_dir")/share/pixmaps/lug-logo.png"
elif [ -f "$helper_dir/lug-logo.png" ]; then elif [ -f "$helper_dir/lug-logo.png" ]; then
lug_logo="$helper_dir/lug-logo.png" lug_logo="$helper_dir/lug-logo.png"
else else
@ -162,8 +162,8 @@ fi
# Use Lutris install script installed by a packaged version of this script if available # Use Lutris install script installed by a packaged version of this script if available
# Otherwise, default to the json in the same directory # Otherwise, default to the json in the same directory
if [ -f "/usr/share/lug-helper/lutris-sc-install.json" ]; then if [ -f "$(dirname "$helper_dir")/share/lug-helper/lutris-sc-install.json" ]; then
install_script="/usr/share/lug-helper/lutris-sc-install.json" install_script="$(dirname "$helper_dir")/share/lug-helper/lutris-sc-install.json"
else else
install_script="$helper_dir/lutris-sc-install.json" install_script="$helper_dir/lutris-sc-install.json"
fi fi
@ -2331,6 +2331,15 @@ eac_workaround() {
fi fi
} }
# Format some URLs for Zenity
format_urls() {
if [ "$use_zenity" -eq 1 ]; then
releases_url="<a href='$releases_url'>$releases_url</a>"
lug_wiki="<a href='$lug_wiki'>$lug_wiki</a>"
lug_wiki_nixos="<a href='$lug_wiki_nixos'>$lug_wiki_nixos</a>"
fi
}
# 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
@ -2378,11 +2387,9 @@ fi
# Set defaults # Set defaults
live_or_ptu="$live_dir" live_or_ptu="$live_dir"
# Format some URLs for Zenity # Format some URLs for Zenity if the Helper was not invoked with command-line arguments (handle those separately below)
if [ "$use_zenity" -eq 1 ]; then if [ "$#" -eq 0 ]; then
releases_url="<a href='$releases_url'>$releases_url</a>" format_urls
lug_wiki="<a href='$lug_wiki'>$lug_wiki</a>"
lug_wiki_nixos="<a href='$lug_wiki_nixos'>$lug_wiki_nixos</a>"
fi fi
# Check if a newer verison of the script is available # Check if a newer verison of the script is available
@ -2413,7 +2420,7 @@ Usage: lug-helper <options>
-s, --delete-shaders Delete Star Citizen shaders -s, --delete-shaders Delete Star Citizen shaders
-c, --delete-dxvk-cache Delete Star Citizen dxvk cache file -c, --delete-dxvk-cache Delete Star Citizen dxvk cache file
-t, --target=[live|ptu] Target LIVE or PTU (default live) -t, --target=[live|ptu] Target LIVE or PTU (default live)
-g, --use-gui=[yes|no] Use Zenity GUI if available (default yes) -g, --no-gui Use terminal menus instead of a Zenity GUI
-r, --get-referral Get a random LUG member's Star Citizen referral code -r, --get-referral Get a random LUG member's Star Citizen referral code
-d, --show-directories Show all Star Citizen and LUG Helper directories -d, --show-directories Show all Star Citizen and LUG Helper directories
-w, --show-wiki Show the LUG Wiki -w, --show-wiki Show the LUG Wiki
@ -2457,20 +2464,10 @@ Usage: lug-helper <options>
exit 0 exit 0
fi fi
;; ;;
--use-gui=* | -g=* ) --no-gui | -g )
# If zenity is unavailable, it has already been set to 0 # If zenity is unavailable, it has already been set to 0
# and this setting has no effect # and this setting has no effect
if [ -x "$(command -v zenity)" ]; then use_zenity=0
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 '%s'\n" "$1"
exit 0
fi
fi
;; ;;
--get-referral | -r ) --get-referral | -r )
cargs+=("referral_randomizer") cargs+=("referral_randomizer")
@ -2497,6 +2494,9 @@ Usage: lug-helper <options>
shift shift
done done
# Format some URLs for Zenity
format_urls
# Call the requested functions and exit # Call the requested functions and exit
if [ "${#cargs[@]}" -gt 0 ]; then if [ "${#cargs[@]}" -gt 0 ]; then
for (( x=0; x<"${#cargs[@]}"; x++ )); do for (( x=0; x<"${#cargs[@]}"; x++ )); do