Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cfgnunes committed Mar 12, 2024
1 parent 5fafd75 commit 923d680
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 28 deletions.
14 changes: 6 additions & 8 deletions Archive/Compress to '7z' (each)
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,18 @@ _main_task() {
cd -- "$input_file" || return 1

if _command_exists "7za"; then
std_output=$(7za a -mx9 "$output_file" -- . 2>&1)
std_output=$(7za a -mx9 "$output_file" -- * .[!.]* 2>&1)
elif _command_exists "bsdtar"; then
std_output=$(find . -printf "%P\n" | bsdtar -a -cf "$output_file" -T - 2>&1)
std_output=$(bsdtar -a -cf "$output_file" -- * .[!.]* 2>&1)
fi
else
local input_file_relative=""
input_file_relative=$(_text_remove_pwd "$input_file")
# shellcheck disable=SC2001
input_file_relative=$(sed "s|^\./||g" <<<$"$input_file_relative")
local input_file_basename=""
input_file_basename=$(basename -- "$input_file")

if _command_exists "7za"; then
std_output=$(7za a -mx9 "$output_file" -- "$input_file_relative" 2>&1)
std_output=$(7za a -mx9 "$output_file" -- "$input_file_basename" 2>&1)
elif _command_exists "bsdtar"; then
std_output=$(bsdtar -a -cf "$output_file" -- "$input_file_relative" 2>&1)
std_output=$(bsdtar -a -cf "$output_file" -- "$input_file_basename" 2>&1)
fi
fi
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
Expand Down
4 changes: 3 additions & 1 deletion Archive/Compress to 'iso' (each)
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ _main_task() {
local output_dir=$2
local output_file=""
local std_output=""
local input_file_basename=""
input_file_basename=$(basename -- "$input_file")

# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=iso")
std_output=$(genisoimage -input-charset "utf-8" -o "$output_file" -V "$(basename -- "$input_file")" -A "" -sysid "" -J -R "$input_file" 2>&1)
std_output=$(genisoimage -input-charset "utf-8" -o "$output_file" -V "$input_file_basename" -A "" -sysid "" -J -R "$input_file_basename" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}

Expand Down
4 changes: 3 additions & 1 deletion Archive/Compress to 'squashfs' (each)
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ _main_task() {
local output_dir=$2
local output_file=""
local std_output=""
local input_file_basename=""
input_file_basename=$(basename -- "$input_file")

# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=squashfs")
std_output=$(mksquashfs "$input_file" "$output_file" 2>&1)
std_output=$(mksquashfs "$input_file_basename" "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}

Expand Down
10 changes: 4 additions & 6 deletions Archive/Compress to 'tar.gz' (each)
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@ _main_task() {
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=tar.gz")
if [[ -d "$input_file" ]]; then
cd -- "$input_file" || return 1
std_output=$(find . -printf "%P\n" | tar -czf "$output_file" -T - 2>&1)
std_output=$(tar -czf "$output_file" -- * .[!.]* 2>&1)
else
local input_file_relative=""
input_file_relative=$(_text_remove_pwd "$input_file")
# shellcheck disable=SC2001
input_file_relative=$(sed "s|^\./||g" <<<$"$input_file_relative")
std_output=$(tar -czf "$output_file" -- "$input_file_relative" 2>&1)
local input_file_basename=""
input_file_basename=$(basename -- "$input_file")
std_output=$(tar -czf "$output_file" -- "$input_file_basename" 2>&1)
fi
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
Expand Down
10 changes: 4 additions & 6 deletions Archive/Compress to 'tar.xz' (each)
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,11 @@ _main_task() {
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=tar.xz")
if [[ -d "$input_file" ]]; then
cd -- "$input_file" || return 1
std_output=$(XZ_OPT="-9" find . -printf "%P\n" | tar -cJf "$output_file" -T - 2>&1)
std_output=$(XZ_OPT="-9" tar -cJf "$output_file" -- * .[!.]* 2>&1)
else
local input_file_relative=""
input_file_relative=$(_text_remove_pwd "$input_file")
# shellcheck disable=SC2001
input_file_relative=$(sed "s|^\./||g" <<<$"$input_file_relative")
std_output=$(XZ_OPT="-9" tar -cJf "$output_file" -- "$input_file_relative" 2>&1)
local input_file_basename=""
input_file_basename=$(basename -- "$input_file")
std_output=$(XZ_OPT="-9" tar -cJf "$output_file" -- "$input_file_basename" 2>&1)
fi
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
Expand Down
10 changes: 4 additions & 6 deletions Archive/Compress to 'zip' (each)
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@ _main_task() {
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=zip")
if [[ -d "$input_file" ]]; then
cd -- "$input_file" || return 1
std_output=$(zip --symlinks --quiet --recurse-paths "$output_file" -- . 2>&1)
std_output=$(zip --symlinks --quiet --recurse-paths "$output_file" -- * .[!.]* 2>&1)
else
local input_file_relative=""
input_file_relative=$(_text_remove_pwd "$input_file")
# shellcheck disable=SC2001
input_file_relative=$(sed "s|^\./||g" <<<$"$input_file_relative")
std_output=$(zip --symlinks --quiet --recurse-paths "$output_file" -- "$input_file_relative" 2>&1)
local input_file_basename=""
input_file_basename=$(basename -- "$input_file")
std_output=$(zip --symlinks --quiet --recurse-paths "$output_file" -- "$input_file_basename" 2>&1)
fi
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
Expand Down

0 comments on commit 923d680

Please sign in to comment.