Skip to content

Commit

Permalink
Prevent lrzuntar from automatically overwriting existing directories …
Browse files Browse the repository at this point in the history
…without the -f option being specified.
  • Loading branch information
ckolivas committed Mar 10, 2012
1 parent 14c3ce2 commit 84e42de
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lrztar
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ lrzip -h will display lrzip options"
|| { printf "lrztar: no tar in your path\n"; return 1; }
which lrzip &> /dev/null \
|| { 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
[[ $x == [OtV] ]] && {
printf "lrztar: invalid option for lrztar: %s\n" "$x";
Expand All @@ -57,11 +59,18 @@ lrzip -h will display lrzip options"
[[ ${s%/*} != $s ]] && i="${s%/*}/" || i="./"
((v_d)) && {
s="${s%/}"
i+="${s##*/}"
s="${s##*/}"
i+="$s"
s="${s%.tar.lrz}"
[[ -e $i ]] || {
printf "lrztar: file does not exist: %s\n" "$i"
return 1
}

! ((v_f)) && [[ -e $s ]] && {
printf "lrztar: $s exists, will not overwrite without -f option\n"
return 1
}
lrzcat "${p[@]}" "$i" | tar x
x=$?
} || {
Expand Down

0 comments on commit 84e42de

Please sign in to comment.