24 Commits

Author SHA1 Message Date
d24e8b590b Bump version 2021-12-24 14:46:38 -05:00
3daeb0b3b1 Update lug-helper.sh
fixed raw-wine repo path
2021-12-24 02:01:11 +01:00
e8c93196ff Specify license 2021-12-21 19:52:32 -05:00
1561e1a9f6 Bump version 2021-11-27 20:28:40 -05:00
a0110720f6 Improve version checker 2021-11-27 20:28:11 -05:00
c1af0383f2 Bump version number 2021-11-27 00:27:41 -05:00
74c5bd2275 Add dxvk manager to command line arguments
Fixes #25
2021-11-27 00:17:24 -05:00
48d49dd438 Update repo url 2021-11-25 14:08:23 -05:00
f080ae2bca Fix syntax 2021-11-21 21:24:57 -05:00
72677ff7d5 Additional referral code 2021-11-19 10:58:49 -05:00
42f9992abf Revert EAC workaround on master branch
Track changes in a dedicated branch
2021-11-16 12:57:17 -05:00
786e3f4c13 Easy Anti-Cheat workaround 2021-11-16 12:49:09 -05:00
08285946c8 Add more referral codes 2021-11-14 17:24:52 -05:00
dafc53615d Display actual mapcount and file limits on system 2021-11-14 12:13:10 -05:00
3f72676c71 Additional referral code 2021-11-11 23:40:24 -05:00
3d7702dfdd Additional referral code 2021-11-11 09:53:39 -05:00
7ae0bcf330 Add additional referral code 2021-11-10 15:05:25 -05:00
8ce1a9a8ea Use better variable names 2021-11-10 15:04:48 -05:00
431df4aabd Corrected debug message 2021-11-08 12:57:00 +01:00
9f2c72042e Ensure extracted directory matches archive name
This is how we detect installed items in download_select_install()
2021-10-28 12:30:39 -04:00
25b122e891 Improve comments 2021-10-28 02:18:15 -04:00
a76c3d0a1a Improve post download messages 2021-10-28 02:02:48 -04:00
25a773602e Add post-download instructions 2021-10-28 00:35:43 -04:00
d5d7f75dde Cleanup redundant code 2021-10-27 23:54:51 -04:00

View File

@ -46,6 +46,8 @@
# Contributor: https://github.com/Wrzlprnft # Contributor: https://github.com/Wrzlprnft
# Runner Downloader inspired by: # Runner Downloader inspired by:
# https://github.com/richardtatum/sc-runner-updater # https://github.com/richardtatum/sc-runner-updater
#
# License: GPLv3.0
############################################################################ ############################################################################
# Check if script is run as root # Check if script is run as root
@ -61,10 +63,10 @@ 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 mktemp)" ] || [ ! -x "$(command -v basename)" ]; then if [ ! -x "$(command -v mktemp)" ] || [ ! -x "$(command -v basename)" ] || [ ! -x "$(command -v sort)" ]; 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 packages are installed:\n- mktemp (part of gnu coreutils)\n- basename (part of gnu coreutils)\n" 1>&2 printf "lug-helper.sh: One or more required packages were not found on this system.\nPlease check that the following packages are installed:\n- mktemp (part of gnu coreutils)\n- basename (part of gnu coreutils)\n- sort (part of gnu coreutils)\n" 1>&2
notify-send "lug-helper" "One or more required packages were not found on this system.\nPlease check that the following packages are installed:\n- mktemp (part of gnu coreutils)\n- basename (part of gnu coreutils)\n" --icon=dialog-warning notify-send "lug-helper" "One or more required packages were not found on this system.\nPlease check that the following packages are installed:\n- mktemp (part of gnu coreutils)\n- basename (part of gnu coreutils)\n- sort (part of gnu coreutils)\n" --icon=dialog-warning
exit 1 exit 1
fi fi
@ -105,7 +107,7 @@ runners_dir="$data_dir/lutris/runners/wine"
# The second is expected to contain the github api releases url # The second is expected to contain the github api releases url
# 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/rawfoxDE/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" "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"
@ -145,9 +147,9 @@ else
fi fi
# Github repo and script version info # Github repo and script version info
repo="the-sane/lug-helper" repo="starcitizen-lug/lug-helper"
releases_url="https://github.com/the-sane/lug-helper/releases" releases_url="https://github.com/$repo/releases"
current_version="v1.11.1" current_version="v1.13"
############################################################################ ############################################################################
############################################################################ ############################################################################
@ -304,7 +306,7 @@ menu() {
elif [ -z "$menu_height" ]; then elif [ -z "$menu_height" ]; then
debug_print exit "Script error: The string 'menu_height' was not set\nbefore calling the menu function. Aborting." debug_print exit "Script error: The string 'menu_height' was not set\nbefore calling the menu function. Aborting."
elif [ -z "$cancel_label" ]; then elif [ -z "$cancel_label" ]; then
debug_print exit "Script error: The string 'menu_height' was not set\nbefore calling the menu function. Aborting." debug_print exit "Script error: The string 'cancel_label' was not set\nbefore calling the menu function. Aborting."
fi fi
# Use Zenity if it is available # Use Zenity if it is available
@ -637,7 +639,7 @@ mapcount_check() {
# Add to the results and actions arrays # Add to the results and actions arrays
if [ "$mapcount" -ge 16777216 ]; then if [ "$mapcount" -ge 16777216 ]; then
# All good # All good
preflight_pass+=("vm.max_map_count is set to at least 16777216.") preflight_pass+=("vm.max_map_count is set to $mapcount.")
elif grep -E -x -q "vm.max_map_count" /etc/sysctl.conf /etc/sysctl.d/* 2>/dev/null; then elif grep -E -x -q "vm.max_map_count" /etc/sysctl.conf /etc/sysctl.d/* 2>/dev/null; then
# Was it supposed to have been set by sysctl? # Was it supposed to have been set by sysctl?
preflight_fail+=("vm.max_map_count is configured to at least 16777216 but the setting has not been loaded by your system.") preflight_fail+=("vm.max_map_count is configured to at least 16777216 but the setting has not been loaded by your system.")
@ -702,7 +704,7 @@ filelimit_check() {
# Add to the results and actions arrays # Add to the results and actions arrays
if [ "$filelimit" -ge 524288 ]; then if [ "$filelimit" -ge 524288 ]; then
# All good # All good
preflight_pass+=("Hard open file descriptors limit is set to at least 524288.") preflight_pass+=("Hard open file descriptors limit is set to $filelimit.")
else else
# The file limit should be changed # The file limit should be changed
preflight_fail+=("Your hard open file descriptors limit is $filelimit\nand should be set to at least 524288\nto increase the maximum number of open files.") preflight_fail+=("Your hard open file descriptors limit is $filelimit\nand should be set to at least 524288\nto increase the maximum number of open files.")
@ -806,6 +808,22 @@ lutris_restart() {
#------------------------- begin download functions ----------------------------# #------------------------- begin download functions ----------------------------#
# Display post download message or instructions if needed
# Expects the variables message_heading, post_download_msg_text,
# post_download_msg_italics, and downloaded_item_name
post_download() {
if [ "$trigger_post_download" = "true" ]; then
message_heading="Download Complete"
if [ "$use_zenity" -eq 1 ]; then
message_heading="<b>$message_heading</b>"
post_download_msg_italics="<i>$post_download_msg_italics</i>"
fi
message info "$message_heading\n\n$post_download_msg_text\n\n$post_download_msg_italics\n$downloaded_item_name"
fi
trigger_post_download="false"
}
# Uninstall the selected item # Uninstall the selected item
download_delete() { download_delete() {
# This function expects an index number for the array # This function expects an index number for the array
@ -956,9 +974,10 @@ download_install() {
num_files=0 num_files=0
for extracted_item in "$tmp_dir/$download_name"/*; do for extracted_item in "$tmp_dir/$download_name"/*; do
if [ -d "$extracted_item" ]; then if [ -d "$extracted_item" ]; then
num_dirs="$((num_dirs+1))" num_dirs="$(($num_dirs+1))"
extracted_dir="$(basename "$extracted_item")"
elif [ -f "$extracted_item" ]; then elif [ -f "$extracted_item" ]; then
num_files="$((num_files+1))" num_files="$(($num_files+1))"
fi fi
done done
@ -966,21 +985,25 @@ download_install() {
if [ "$num_dirs" -eq 0 ] && [ "$num_files" -eq 0 ]; then if [ "$num_dirs" -eq 0 ] && [ "$num_files" -eq 0 ]; then
# Sanity check # Sanity check
message warning "The downloaded archive is empty. There is nothing to do." message warning "The downloaded archive is empty. There is nothing to do."
# Cleanup tmp download
debug_print continue "Removing $tmp_dir/$download_file..."
rm "$tmp_dir/$download_file"
return 1
elif [ "$num_dirs" -eq 1 ] && [ "$num_files" -eq 0 ]; then elif [ "$num_dirs" -eq 1 ] && [ "$num_files" -eq 0 ]; then
# If the archive contains only one directory, install that directory # If the archive contains only one directory, install that directory
debug_print continue "Installing $download_type into $download_dir..." # We rename it to the name of the archive in case it is different
# so we can easily detect installed items in download_select_install()
debug_print continue "Installing $download_type into $download_dir/$download_name..."
if [ "$use_zenity" -eq 1 ]; then if [ "$use_zenity" -eq 1 ]; then
# Use Zenity progress bar # Use Zenity progress bar
mkdir -p "$download_dir" && cp -r "$tmp_dir"/"$download_name"/* "$download_dir" | \ mkdir -p "$download_dir" && cp -r "$tmp_dir/$download_name/$extracted_dir" "$download_dir/$download_name" | \
zenity --progress --pulsate --no-cancel --auto-close --title="Star Citizen LUG Helper" --text="Installing ${download_type}...\n" 2>/dev/null zenity --progress --pulsate --no-cancel --auto-close --title="Star Citizen LUG Helper" --text="Installing ${download_type}...\n" 2>/dev/null
else else
mkdir -p "$download_dir" && cp -r "$tmp_dir"/"$download_name"/* "$download_dir" mkdir -p "$download_dir" && cp -r "$tmp_dir/$download_name/$extracted_dir" "$download_dir/$download_name"
fi fi
# We need to restart Lutris for the download to be detected
lutris_needs_restart="true" lutris_needs_restart="true"
# Store the final name of the downloaded directory
downloaded_item_name="$download_name"
# Trigger the post_download() function
trigger_post_download="true"
elif [ "$num_dirs" -gt 1 ] || [ "$num_files" -gt 0 ]; then elif [ "$num_dirs" -gt 1 ] || [ "$num_files" -gt 0 ]; then
# If the archive contains more than one directory or # If the archive contains more than one directory or
# one or more files, we must create a subdirectory # one or more files, we must create a subdirectory
@ -992,7 +1015,13 @@ download_install() {
else else
mkdir -p "$download_dir/$download_name" && cp -r "$tmp_dir"/"$download_name"/* "$download_dir"/"$download_name" mkdir -p "$download_dir/$download_name" && cp -r "$tmp_dir"/"$download_name"/* "$download_dir"/"$download_name"
fi fi
# We need to restart Lutris for the download to be detected
lutris_needs_restart="true" lutris_needs_restart="true"
# Store the final name of the downloaded directory
downloaded_item_name="$download_name"
# Trigger the post_download() function
trigger_post_download="true"
else else
# Some unexpected combination of directories and files # Some unexpected combination of directories and files
debug_print exit "Script error: Unexpected archive contents in download_install function. Aborting" debug_print exit "Script error: Unexpected archive contents in download_install function. Aborting"
@ -1000,8 +1029,11 @@ download_install() {
fi fi
# Cleanup tmp download # Cleanup tmp download
debug_print continue "Removing $tmp_dir/$download_file..." debug_print continue "Cleaning up $tmp_dir/$download_file..."
rm "$tmp_dir/$download_file" rm "$tmp_dir/$download_file"
# Display any post-download messages or instructions
post_download
} }
# List available items for download # List available items for download
@ -1193,6 +1225,10 @@ download_manage() {
# Configure the download_manage function for runners # Configure the download_manage function for runners
runner_manage() { runner_manage() {
# Set some defaults
lutris_needs_restart="false"
trigger_post_download="false"
# Use indirect expansion to point download_sources # Use indirect expansion to point download_sources
# to the runner_sources array set at the top of the script # to the runner_sources array set at the top of the script
declare -n download_sources=runner_sources declare -n download_sources=runner_sources
@ -1203,6 +1239,15 @@ runner_manage() {
download_menu_description="The runners listed below are wine builds created for Star Citizen" download_menu_description="The runners listed below are wine builds created for Star Citizen"
download_menu_height="140" download_menu_height="140"
# Set the post download instructions
# Format:
# A header is automatically displayed that reads: Download Complete
# msg_text is displayed below the header
# msg_italics is displayed below that in italics when zenity is in use
# Lastly, the downloaded directory name is automatically displayed
post_download_msg_text="Select the runner in Lutris from the dropdown menu"
post_download_msg_italics="Configure->Runner Options->Wine version"
# Call the download_manage function with the above configuration # Call the download_manage function with the above configuration
# The argument passed to the function is used for special handling # The argument passed to the function is used for special handling
# and displayed in the menus and dialogs. # and displayed in the menus and dialogs.
@ -1211,6 +1256,10 @@ runner_manage() {
# Configure the download_manage function for dxvks # Configure the download_manage function for dxvks
dxvk_manage() { dxvk_manage() {
# Set some defaults
lutris_needs_restart="false"
trigger_post_download="false"
# Use indirect expansion to point download_sources # Use indirect expansion to point download_sources
# to the dxvk_sources array set at the top of the script # to the dxvk_sources array set at the top of the script
declare -n download_sources=dxvk_sources declare -n download_sources=dxvk_sources
@ -1221,6 +1270,15 @@ dxvk_manage() {
download_menu_description="The DXVK versions below may help improve game performance" download_menu_description="The DXVK versions below may help improve game performance"
download_menu_height="140" download_menu_height="140"
# Set the post download instructions
# Format:
# A header is automatically displayed that reads: Download Complete
# msg_text is displayed below the header
# msg_italics is displayed below that in italics when zenity is in use
# Lastly, the downloaded directory name is automatically displayed
post_download_msg_text="Type the DXVK folder name in your Lutris settings"
post_download_msg_italics="Configure->Runner Options->DXVK version"
# Call the download_manage function with the above configuration # Call the download_manage function with the above configuration
# The argument passed to the function is used for special handling # The argument passed to the function is used for special handling
# and displayed in the menus and dialogs. # and displayed in the menus and dialogs.
@ -1375,7 +1433,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") 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")
# 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")]}"
@ -1435,14 +1493,14 @@ if [ -x "$(command -v zenity)" ]; then
use_zenity=1 use_zenity=1
fi fi
# Set some defaults # Set defaults
live_or_ptu="$live_dir" live_or_ptu="$live_dir"
lutris_needs_restart="false"
# Check if a newer verison of the script is available # Check if a newer verison of the script is available
latest_version="$(get_latest_release "$repo")" latest_version="$(get_latest_release "$repo")"
if [ "$latest_version" != "$current_version" ]; then if [ "$latest_version" != "$current_version" ] &&
[ "$current_version" = "$(printf "$current_version\n$latest_version" | sort -V | head -n1)" ]; then
if [ "$use_zenity" -eq 1 ]; then if [ "$use_zenity" -eq 1 ]; then
releases_url_formatted="<a href='$releases_url'>$releases_url</a>" releases_url_formatted="<a href='$releases_url'>$releases_url</a>"
else else
@ -1463,6 +1521,7 @@ if [ "$#" -gt 0 ]; then
Usage: lug-helper <options> Usage: lug-helper <options>
-p, --preflight-check Run system optimization checks -p, --preflight-check Run system optimization checks
-m, --manage-runners Install or remove Lutris runners -m, --manage-runners Install or remove Lutris runners
-k, --manage-dxvk Install or remove DXVK versions
-u, --delete-user-folder Delete Star Citizen USER folder, preserving keybinds -u, --delete-user-folder Delete Star Citizen USER folder, preserving keybinds
-s, --delete-shaders Delete Star Citizen shaders directory -s, --delete-shaders Delete Star Citizen shaders directory
-c, --delete-dxvk-cache Delete Star Citizen dxvk cache file -c, --delete-dxvk-cache Delete Star Citizen dxvk cache file
@ -1480,6 +1539,9 @@ Usage: lug-helper <options>
--manage-runners | -m ) --manage-runners | -m )
cargs+=("runner_manage") cargs+=("runner_manage")
;; ;;
--manage-dxvk | -k )
cargs+=("dxvk_manage")
;;
--delete-user-folder | -u ) --delete-user-folder | -u )
cargs+=("sanitize") cargs+=("sanitize")
;; ;;