fix all spellsheck
This commit is contained in:
@@ -44,36 +44,42 @@
|
||||
# -n, --no-dir Never create a host directory
|
||||
utaz()
|
||||
{
|
||||
# shellcheck disable=SC2329
|
||||
_ununzip()
|
||||
{
|
||||
unzip -o "$1" -d "$2" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2329
|
||||
_untar()
|
||||
{
|
||||
tar -xf "$1" -C "$2"
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2329
|
||||
_ungzip()
|
||||
{
|
||||
tar -xzf "$1" -C "$2"
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2329
|
||||
_unbzip2()
|
||||
{
|
||||
tar -xjf "$1" -C "$2"
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2329
|
||||
_unxz()
|
||||
{
|
||||
tar -xJf "$1" -C "$2"
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2329
|
||||
_unlzop()
|
||||
{
|
||||
lzop -d "$1" -o "$2/$(basename "${1%.*}")"
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2329
|
||||
_unlzip()
|
||||
{
|
||||
if command -v plzip >/dev/null 2>&1; then
|
||||
@@ -83,16 +89,19 @@ utaz()
|
||||
fi
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2329
|
||||
_ununrar()
|
||||
{
|
||||
unrar x -o+ "$1" "$2/" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2329
|
||||
_ununarj()
|
||||
{
|
||||
unarj e "$1" "$2/" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2329
|
||||
_unlha()
|
||||
{
|
||||
# lha typically extracts into the current directory
|
||||
@@ -100,40 +109,47 @@ utaz()
|
||||
(cd "$2" && lha -x "../$1") >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2329
|
||||
_ununace()
|
||||
{
|
||||
unace x "$1" "$2/" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2329
|
||||
_un7z()
|
||||
{
|
||||
7z x "$1" -o"$2/" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2329
|
||||
_unzstd()
|
||||
{
|
||||
# Zstd decompresses files directly, often requiring tar for archives
|
||||
tar --zstd -xf "$1" -C "$2"
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2329
|
||||
_uncpio()
|
||||
{
|
||||
# CPIO requires careful directory handling
|
||||
(cd "$2" && cpio -id < "../$1") >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2329
|
||||
_uncabextract()
|
||||
{
|
||||
# Requires 'cabextract' package
|
||||
cabextract "$1" -d "$2/" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2329
|
||||
_undeb()
|
||||
{
|
||||
# Extracts data content from a Debian package
|
||||
dpkg-deb -x "$1" "$2/" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2329
|
||||
_unrpm()
|
||||
{
|
||||
# Extracts CPIO-based payload from an RPM package
|
||||
@@ -141,8 +157,9 @@ utaz()
|
||||
rpm2cpio "$1" | (cd "$2/" && cpio -idmv) >/dev/null 2>&1
|
||||
}
|
||||
|
||||
local PARSED=$(getopt -o hdcn --long help,delete,create-dir,no-dir -n 'utaz' -- "$@")
|
||||
|
||||
local PARSED
|
||||
PARSED=$(getopt -o hdcn --long help,delete,create-dir,no-dir -n 'utaz' -- "$@")
|
||||
# shellcheck disable=SC2181 # getopt return code is checked immediately after
|
||||
if [ $? -ne 0 ]; then
|
||||
disp E "Invalid options, use \"utaz --help\" to display usage."
|
||||
return 1
|
||||
@@ -314,10 +331,10 @@ utaz()
|
||||
fi
|
||||
|
||||
disp I "Processing archive ${f} with ${extractor}..."
|
||||
mkdir -p "${dir}"
|
||||
[[ $? -gt 0 ]] &&
|
||||
if ! mkdir -p "${dir}"; then
|
||||
disp E "The filesystem can't create directories, exit!" &&
|
||||
return 1
|
||||
fi
|
||||
|
||||
${extractor} "${f}" "${dir}"
|
||||
case $? in
|
||||
@@ -390,6 +407,7 @@ export -f utaz
|
||||
# -1, .., -9 Compression level to use [1=fast/biggest, 9=slow/smallest]
|
||||
taz()
|
||||
{
|
||||
# shellcheck disable=SC2329
|
||||
_doxz()
|
||||
{
|
||||
command -v xz >/dev/null 2>&1 || {
|
||||
@@ -397,17 +415,19 @@ taz()
|
||||
return 127
|
||||
}
|
||||
|
||||
[[ $4 ]] && local verb='-v'
|
||||
local verb=()
|
||||
[[ $4 ]] && verb=('-v')
|
||||
|
||||
# Display a warning for this format
|
||||
disp W "xz format is not suited for long term archiving."
|
||||
disp I "See https://www.nongnu.org/lzip/xz_inadequate.html for details."
|
||||
|
||||
# Compresse to xz (lzma2) - Deprecated
|
||||
xz $verb --compress --keep -$3 -T $2 $1
|
||||
xz "${verb[@]}" --compress --keep "-$3" -T "$2" "$1"
|
||||
return $?
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2329
|
||||
_dolz()
|
||||
{
|
||||
local procopt="--threads $2"
|
||||
@@ -425,13 +445,16 @@ taz()
|
||||
disp W "Consider installing plzip to obtain multithreading abilities."
|
||||
}
|
||||
|
||||
[[ $4 ]] && local verb="-vv"
|
||||
local opt=()
|
||||
[[ $4 ]] && opt=('-vv')
|
||||
opt+=("$procopt")
|
||||
|
||||
# Compresse au format lzip (lzma)
|
||||
$command $verb $procopt --keep -$3 $1
|
||||
$command "${opt[@]}" --keep "-$3" "$1"
|
||||
return $?
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2329
|
||||
_dogz()
|
||||
{
|
||||
local procopt="--processes $2"
|
||||
@@ -449,13 +472,16 @@ taz()
|
||||
disp W "Consider installing pigz to obtain multithreading abilities."
|
||||
}
|
||||
|
||||
[[ $4 ]] && local verb="--verbose"
|
||||
local opt=()
|
||||
[[ $4 ]] && opt=('--verbose')
|
||||
opt+=("$procopt")
|
||||
|
||||
# Compresse au format bz2
|
||||
$command $verb $procopt --keep -$3 $1
|
||||
$command "${opt[@]}" --keep "-$3" "$1"
|
||||
return $?
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2329
|
||||
_dobz2()
|
||||
{
|
||||
local procopt="-p$2"
|
||||
@@ -473,13 +499,16 @@ taz()
|
||||
disp W "Consider installing pbzip2 to obtain multithreading abilities."
|
||||
}
|
||||
|
||||
[[ $4 ]] && local verb="-v"
|
||||
local opt=()
|
||||
[[ $4 ]] && opt=('-v')
|
||||
opt+=("$procopt")
|
||||
|
||||
# Compresse au format bz2
|
||||
$command $verb --compress $procopt --keep -$3 $1
|
||||
$command "${opt[@]}" --compress --keep "-$3" "$1"
|
||||
return $?
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2329
|
||||
_dolzo()
|
||||
{
|
||||
command -v lzop >/dev/null 2>&1 || {
|
||||
@@ -487,16 +516,18 @@ taz()
|
||||
return 127
|
||||
}
|
||||
|
||||
[[ $4 ]] && local verb='-v'
|
||||
local verb=()
|
||||
[[ $4 ]] && verb=('-v')
|
||||
[[ $2 -gt 1 ]] && disp W "lzop doesn't support multithreading, falling back to 1 thread."
|
||||
|
||||
# Compresse au format lzo
|
||||
lzop --keep -$3 $1
|
||||
lzop "${verb[@]}" --keep "-$3" "$1"
|
||||
return $?
|
||||
}
|
||||
|
||||
local PARSED
|
||||
PARSED=$(getopt -o hdf:p:vq123456789 --long help,delete,format:,parallel:,verbose,quiet --name "taz" -- "$@")
|
||||
# shellcheck disable=SC2181 # getopt return code is checked immediately after
|
||||
if [ $? -ne 0 ]; then
|
||||
disp E "Invalid options, use \"taz --help\" to display usage."
|
||||
return 1
|
||||
@@ -587,8 +618,7 @@ taz()
|
||||
if [[ -d "$item" ]]; then
|
||||
disp I "\t Creating $item.tar... "
|
||||
|
||||
tar -cf "$item.tar" "$item"
|
||||
if [[ ! $? -eq 0 ]]; then
|
||||
if ! tar -cf "$item.tar" "$item"; then
|
||||
disp E "tar file creation failed, skipping to next item."
|
||||
continue
|
||||
fi
|
||||
@@ -602,8 +632,9 @@ taz()
|
||||
# Skip compression part if tar is asked
|
||||
if [[ $compform != "tar" ]]; then
|
||||
disp I "\t Compressing archive..."
|
||||
_do$compform "$fname" "$nproc" "$complevel" "$verbose"
|
||||
[[ ! $? -eq 0 ]] && case $? in
|
||||
local exec_code=0
|
||||
"_do$compform" "$fname" "$nproc" "$complevel" "$verbose" || exec_code=$?
|
||||
[[ ! $exec_code -eq 0 ]] && case $exec_code in
|
||||
127)
|
||||
disp E "Compression program unavailable, aborting."
|
||||
return 127
|
||||
|
||||
Reference in New Issue
Block a user