mirror of
https://github.com/ckolivas/lrzip.git
synced 2025-12-06 07:12:00 +01:00
Prevent lrzuntar from automatically overwriting existing directories without the -f option being specified.
This commit is contained in:
parent
14c3ce2ab4
commit
84e42de8da
11
lrztar
11
lrztar
|
|
@ -40,6 +40,8 @@ lrzip -h will display lrzip options"
|
||||||
|| { printf "lrztar: no tar in your path\n"; return 1; }
|
|| { printf "lrztar: no tar in your path\n"; return 1; }
|
||||||
which lrzip &> /dev/null \
|
which lrzip &> /dev/null \
|
||||||
|| { printf "lrztar: no lrzip in your path\n"; return 1; }
|
|| { printf "lrztar: no lrzip in your path\n"; return 1; }
|
||||||
|
which lrzcat &> /dev/null \
|
||||||
|
|| { printf "lrztar: no lrzcat in your path\n"; return 1; }
|
||||||
while getopts w:OS:DqL:nlbgzUTN:p:vfo:dtVhHck x; do
|
while getopts w:OS:DqL:nlbgzUTN:p:vfo:dtVhHck x; do
|
||||||
[[ $x == [OtV] ]] && {
|
[[ $x == [OtV] ]] && {
|
||||||
printf "lrztar: invalid option for lrztar: %s\n" "$x";
|
printf "lrztar: invalid option for lrztar: %s\n" "$x";
|
||||||
|
|
@ -57,11 +59,18 @@ lrzip -h will display lrzip options"
|
||||||
[[ ${s%/*} != $s ]] && i="${s%/*}/" || i="./"
|
[[ ${s%/*} != $s ]] && i="${s%/*}/" || i="./"
|
||||||
((v_d)) && {
|
((v_d)) && {
|
||||||
s="${s%/}"
|
s="${s%/}"
|
||||||
i+="${s##*/}"
|
s="${s##*/}"
|
||||||
|
i+="$s"
|
||||||
|
s="${s%.tar.lrz}"
|
||||||
[[ -e $i ]] || {
|
[[ -e $i ]] || {
|
||||||
printf "lrztar: file does not exist: %s\n" "$i"
|
printf "lrztar: file does not exist: %s\n" "$i"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
! ((v_f)) && [[ -e $s ]] && {
|
||||||
|
printf "lrztar: $s exists, will not overwrite without -f option\n"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
lrzcat "${p[@]}" "$i" | tar x
|
lrzcat "${p[@]}" "$i" | tar x
|
||||||
x=$?
|
x=$?
|
||||||
} || {
|
} || {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue