about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/archive_compress.sh10
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/archive_decompress.sh26
2 files changed, 12 insertions, 24 deletions
diff --git a/modules/by-name/lf/lf/commands/scripts/archive_compress.sh b/modules/by-name/lf/lf/commands/scripts/archive_compress.sh
index 0d53af2a..c3776a80 100755
--- a/modules/by-name/lf/lf/commands/scripts/archive_compress.sh
+++ b/modules/by-name/lf/lf/commands/scripts/archive_compress.sh
@@ -1,11 +1,5 @@
 # shellcheck shell=sh
 
-# Option '-f' disables pathname expansion which can be useful when $f, $fs, and
-# $fx variables contain names with '*' or '?' characters. However, this option
-# is used selectively within individual commands as it can be limiting at
-# times.
-set -f
-
 # shellcheck disable=SC2269
 f="$f"
 # shellcheck disable=SC2269
@@ -49,7 +43,7 @@ done
 
 # fx contains all selected file name separated by a newline
 while read -r file; do
-    set -- "$@" "$file"
+    set -- "$@" "$(realpath --relative-to="$(pwd)" "$file")"
 done <"$(echo "$fx" | tmp)"
 
 case "$archiver" in
@@ -63,7 +57,7 @@ case "$archiver" in
     7z a "$name" "$@"
     ;;
 "zip")
-    zip --symlinks -9 -r "$name" "$@"
+    zip --symlinks -9 --recurse-paths "$name" "$@"
     ;;
 esac
 # vim: ft=sh
diff --git a/modules/by-name/lf/lf/commands/scripts/archive_decompress.sh b/modules/by-name/lf/lf/commands/scripts/archive_decompress.sh
index 0e99b98e..08374176 100755
--- a/modules/by-name/lf/lf/commands/scripts/archive_decompress.sh
+++ b/modules/by-name/lf/lf/commands/scripts/archive_decompress.sh
@@ -9,21 +9,15 @@ fs="$fs"
 # shellcheck disable=SC2269
 id="$id"
 
-set -f
-
-unarchive() {
-    case "$1" in
-    *.tar.bz | *.tar.bz2 | *.tbz | *.tbz2) tar --extract --bzip2 --verbose --file="$1" ;;
-    *.tar.gz | *.tgz) tar --extract --gzip --verbose --file="$1" ;;
-    *.tar.xz | *.txz) tar --extract --xz --verbose --file="$1" ;;
-    *.tar*) tar --extract --verbose --file="$1" ;;
-    *.zip) unzip "$1" ;;
-    *.7z) 7z x "$1" ;;
-    *) die "'$1' is not a supported file for unarchiving." ;;
+echo "$fx" | while read -r file; do
+    case "$file" in
+    *.tar.bz | *.tar.bz2 | *.tbz | *.tbz2) tar --extract --bzip2 --verbose --file="$file" ;;
+    *.tar.gz | *.tgz) tar --extract --gzip --verbose --file="$file" ;;
+    *.tar.xz | *.txz) tar --extract --xz --verbose --file="$file" ;;
+    *.tar*) tar --extract --verbose --file="$file" ;;
+    *.zip) unzip "$file" ;;
+    *.7z) 7z x "$file" ;;
+    *) die "'$file' is not a supported file for unarchiving." ;;
     esac
-}
-
-while read -r file; do
-    unarchive "$file"
-done <"$fx"
+done
 # vim: ft=sh