Improve archive subdirectory handling

This commit is contained in:
the Sane 2021-10-24 12:29:55 -04:00 committed by GitHub
parent cf491f9151
commit 274c674681
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -948,7 +948,8 @@ runner_install() {
# Extract the runner # Extract the runner
case "$first_filepath" in case "$first_filepath" in
# If the files in the archive begin with ./ there is no subdirectory # If the files in the archive begin with ./ there is no subdirectory,
# so we must create one
./*) ./*)
debug_print continue "Installing runner into $runners_dir/$runner_name..." debug_print continue "Installing runner into $runners_dir/$runner_name..."
if [ "$use_zenity" -eq 1 ]; then if [ "$use_zenity" -eq 1 ]; then
@ -960,9 +961,10 @@ runner_install() {
fi fi
lutris_needs_restart="true" lutris_needs_restart="true"
;; ;;
*) # If a subdirectory exists and has the same name as the archive,
# Runners with a subdirectory in the archive # extract it as is
debug_print continue "Installing runner into $runners_dir..." "$runner_name")
debug_print continue "Installing runner into $runners_dir/$runner_name....."
if [ "$use_zenity" -eq 1 ]; then if [ "$use_zenity" -eq 1 ]; then
# Use Zenity progress bar # Use Zenity progress bar
mkdir -p "$runners_dir" && tar -xf "$tmp_dir/$runner_file" -C "$runners_dir" | \ mkdir -p "$runners_dir" && tar -xf "$tmp_dir/$runner_file" -C "$runners_dir" | \
@ -972,6 +974,19 @@ runner_install() {
fi fi
lutris_needs_restart="true" lutris_needs_restart="true"
;; ;;
# If a subdirectory exists and has any other name,
# we must create the correct subdirectory
*)
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 -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 -xf "$tmp_dir/$runner_file" -C "$runners_dir/$runner_name"
fi
lutris_needs_restart="true"
;;
esac esac
# Cleanup tmp download # Cleanup tmp download
@ -1283,7 +1298,8 @@ dxvk_install() {
# Extract the dxvk # Extract the dxvk
case "$first_filepath" in case "$first_filepath" in
# If the files in the archive begin with ./ there is no subdirectory # If the files in the archive begin with ./ there is no subdirectory,
# so we must create one
./*) ./*)
debug_print continue "Installing DXVK into $dxvk_dir/$dxvk_name..." debug_print continue "Installing DXVK into $dxvk_dir/$dxvk_name..."
if [ "$use_zenity" -eq 1 ]; then if [ "$use_zenity" -eq 1 ]; then
@ -1295,9 +1311,10 @@ dxvk_install() {
fi fi
lutris_needs_restart="true" lutris_needs_restart="true"
;; ;;
*) # If a subdirectory exists and has the same name as the archive,
# dxvks with a subdirectory in the archive # extract it as is
debug_print continue "Installing DXVK into $dxvk_dir..." "$dxvk_name")
debug_print continue "Installing DXVK into $dxvk_dir/$dxvk_name..."
if [ "$use_zenity" -eq 1 ]; then if [ "$use_zenity" -eq 1 ]; then
# Use Zenity progress bar # Use Zenity progress bar
mkdir -p "$dxvk_dir" && tar -xf "$tmp_dir/$dxvk_file" -C "$dxvk_dir" | \ mkdir -p "$dxvk_dir" && tar -xf "$tmp_dir/$dxvk_file" -C "$dxvk_dir" | \
@ -1307,6 +1324,19 @@ dxvk_install() {
fi fi
lutris_needs_restart="true" lutris_needs_restart="true"
;; ;;
# If a subdirectory exists and has any other name,
# we must create the correct subdirectory
*)
debug_print continue "Installing DXVK into $dxvk_dir/$dxvk_name..."
if [ "$use_zenity" -eq 1 ]; then
# Use Zenity progress bar
mkdir -p "$dxvk_dir/$dxvk_name" && tar -xf "$tmp_dir/$dxvk_file" -C "$dxvk_dir/$dxvk_name" | \
zenity --progress --pulsate --no-cancel --auto-close --title="Star Citizen LUG Helper" --text="Installing DXVK...\n" 2>/dev/null
else
mkdir -p "$dxvk_dir/$dxvk_name" && tar -xf "$tmp_dir/$dxvk_file" -C "$dxvk_dir/$dxvk_name"
fi
lutris_needs_restart="true"
;;
esac esac
# Cleanup tmp download # Cleanup tmp download