Permalink
Browse files

Prevent lrzuntar from automatically overwriting existing directories …

…without the -f option being specified.
  • Loading branch information...
ckolivas committed Mar 10, 2012
1 parent 14c3ce2 commit 84e42de8da9b77cb5acf697959094369daa7445e
Showing with 10 additions and 1 deletion.
  1. +10 −1 lrztar
View
11 lrztar
@@ -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";
@@ -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=$?
} || {

0 comments on commit 84e42de

Please sign in to comment.