From 71a5ee0303d1bc1c20198094e397534b71c31e91 Mon Sep 17 00:00:00 2001 From: George Makrydakis Date: Fri, 2 Apr 2010 16:17:42 +0300 Subject: [PATCH 1/9] Adjusting .lrz and relative path behaviour as per lrzip for lrztar. --- lrztar | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lrztar b/lrztar index 2d2870f..d572b0c 100755 --- a/lrztar +++ b/lrztar @@ -28,15 +28,22 @@ function lrztar_local() { return } ((v_d)) && { - fname="$(basename "$s")"; tname="${fname%.lrz}" + fname="$(basename "$s")"; tname="${fname%.lrz}"; ! ((v_f)) && [[ -e ${tname%.tar} ]] && { printf "lrztar: ${tname%.tar} already present, aborting\n" return 1 } + [[ ${s%/*} != $s ]] && s="${s%/*}" || s="." + pushd "$s" &> /dev/null lrzip $p "$fname" && tar xf "$tname" x=$? + popd &> /dev/null } || { - tname="$(basename "$s").tar" + fname="$(basename "$s")"; tname="$fname.tar" + [[ $fname == *.lrz ]] && { + printf "lrztar: $fname is already a .lrz file, aborting\n" + return 1 + } tar cf "$tname" "$s" && lrzip $p "$tname" x=$? } From 7c86442d38f7d630f76f6fb7bb79f09ff6f7ec8e Mon Sep 17 00:00:00 2001 From: George Makrydakis Date: Sat, 3 Apr 2010 11:14:52 +0300 Subject: [PATCH 2/9] Adding a basic .gitignore file. --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5236e1e --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*~ + From cd1a1bd88057df4cc0d7a96fd29aab483c643d55 Mon Sep 17 00:00:00 2001 From: George Makrydakis Date: Sat, 3 Apr 2010 11:42:12 +0300 Subject: [PATCH 3/9] Adding symlink style "lrzuntar" support. --- lrztar | 1 + 1 file changed, 1 insertion(+) diff --git a/lrztar b/lrztar index d572b0c..fa36745 100755 --- a/lrztar +++ b/lrztar @@ -20,6 +20,7 @@ function lrztar_local() { [[ $x == [otV] ]] || ((v_$x=1)) &> /dev/null \ || { printf "lrztar: invalid option for lrztar %s\n" "$x"; return 1; } done + [[ $(basename "$0") == lrzuntar ]] && { v_d=1; p="-d $p"; } { ! (($#)) || ((v_h)); } && { printf "lrztar wrapper for compressing/decompressing whole directories with lrzip.\n" printf "usage: lrztar [lrzip options] will compress directory to directory.tar.lrz\n" From fe3903481077fc6ddc3475eb024ae4f98168c40a Mon Sep 17 00:00:00 2001 From: George Makrydakis Date: Sat, 3 Apr 2010 12:21:31 +0300 Subject: [PATCH 4/9] Polishing some details in flow logic. --- lrztar | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lrztar b/lrztar index fa36745..e662007 100755 --- a/lrztar +++ b/lrztar @@ -11,7 +11,7 @@ function lrztar_local() { local p="${@:1:$(($#-1))}" s="${!#}" tname= fname= \ v_w=0 v_O=0 v_S=0 v_D=0 v_P=0 v_q=0 v_L=0 \ v_n=0 v_l=0 v_b=0 v_g=0 v_z=0 v_M=0 v_T=0 \ - v_N=0 v_v=0 v_f=0 v_d=0 v_h=0 x= + v_N=0 v_v=0 v_f=0 v_d=0 v_h=0 x= i= OPTERR=0 trap '[[ -z $tname ]] || rm -rf "$tname" &> /dev/null' 1 2 3 15 which tar &> /dev/null || { printf "lrztar: no tar in your path\n"; return 1; } @@ -20,7 +20,8 @@ function lrztar_local() { [[ $x == [otV] ]] || ((v_$x=1)) &> /dev/null \ || { printf "lrztar: invalid option for lrztar %s\n" "$x"; return 1; } done - [[ $(basename "$0") == lrzuntar ]] && { v_d=1; p="-d $p"; } + [[ $(basename "$0") == lrzuntar ]] \ + && { v_d=1; p="-d $p"; } { ! (($#)) || ((v_h)); } && { printf "lrztar wrapper for compressing/decompressing whole directories with lrzip.\n" printf "usage: lrztar [lrzip options] will compress directory to directory.tar.lrz\n" @@ -34,11 +35,10 @@ function lrztar_local() { printf "lrztar: ${tname%.tar} already present, aborting\n" return 1 } - [[ ${s%/*} != $s ]] && s="${s%/*}" || s="." - pushd "$s" &> /dev/null - lrzip $p "$fname" && tar xf "$tname" + [[ ${s%/*} != $s ]] && i="${s%/*}/" || i="./" + tname="$i$tname" + lrzip $p "$i$fname" && tar xf "$tname" x=$? - popd &> /dev/null } || { fname="$(basename "$s")"; tname="$fname.tar" [[ $fname == *.lrz ]] && { From 0ac7b8703b1bd1e52099645ed4848de40842077a Mon Sep 17 00:00:00 2001 From: George Makrydakis Date: Sat, 3 Apr 2010 12:34:16 +0300 Subject: [PATCH 5/9] Adding authors and putting GPL notice on the script itself. --- lrztar | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/lrztar b/lrztar index e662007..a1ce5dd 100755 --- a/lrztar +++ b/lrztar @@ -1,11 +1,24 @@ #!/bin/bash -# A basic skeleton for making a new lrzip tar wrapper place messages etc -# where you think you want them, it kind of self - documents itself. -# For the time being, lrzip does not like pipes. +# Copyright (C) George Makrydakis 2009, 2010 +# Copyright (C) Con Kolivas 2010 -# Public domain with no warranties or suitability whatsoever etc. -# G.M. +# A bash wrapper for Con Kolivas' excellent lrzip utility. For the time +# being, lrzip does not like pipes, so we had to do this. It is kind of +# self - documenting, spawned out of a test tube bash shell script. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . function lrztar_local() { local p="${@:1:$(($#-1))}" s="${!#}" tname= fname= \ From d64bf643ff913075e7921e315cb70a1101aed53d Mon Sep 17 00:00:00 2001 From: George Makrydakis Date: Sat, 3 Apr 2010 12:36:56 +0300 Subject: [PATCH 6/9] Added lrzuntar help message. --- lrztar | 1 + 1 file changed, 1 insertion(+) diff --git a/lrztar b/lrztar index a1ce5dd..f232988 100755 --- a/lrztar +++ b/lrztar @@ -39,6 +39,7 @@ function lrztar_local() { printf "lrztar wrapper for compressing/decompressing whole directories with lrzip.\n" printf "usage: lrztar [lrzip options] will compress directory to directory.tar.lrz\n" printf "lrztar -d [lrzip options] will extract directory from directory.tar.lrz\n" + printf "lrzuntar [lrzip options] will extract directory from directory.tar.lrz\n" printf "lrzip -h will list lrzip options\n" return } From eb2d2215ed69b4e614d3e9d912d0cfdfedebb336 Mon Sep 17 00:00:00 2001 From: George Makrydakis Date: Sat, 3 Apr 2010 12:49:33 +0300 Subject: [PATCH 7/9] Adding lrzuntar symlink during installation and adjusting help messages. --- Makefile.in | 2 ++ lrztar | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 7178202..cf702c7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -103,6 +103,8 @@ install: all ${INSTALLCMD} -m 755 lrzip $(DESTDIR)${INSTALL_BIN} ( cd $(DESTDIR)${INSTALL_BIN} && ${LN_S} -f lrzip lrunzip ) ${INSTALLCMD} -m 755 lrztar $(DESTDIR)${INSTALL_BIN} + ln -sf $(DESTDIR)${INSTALL_BIN}/lrztar $(DESTDIR)${INSTALL_BIN}/lrzuntar + chmod 755 $(DESTDIR)${INSTALL_BIN}/lrzuntar mkdir -p $(DESTDIR)${INSTALL_MAN1} ${INSTALLCMD} -m 644 $(MAN1FILES) $(DESTDIR)${INSTALL_MAN1} mkdir -p $(DESTDIR)${INSTALL_MAN5} diff --git a/lrztar b/lrztar index f232988..dcc1c1b 100755 --- a/lrztar +++ b/lrztar @@ -40,7 +40,8 @@ function lrztar_local() { printf "usage: lrztar [lrzip options] will compress directory to directory.tar.lrz\n" printf "lrztar -d [lrzip options] will extract directory from directory.tar.lrz\n" printf "lrzuntar [lrzip options] will extract directory from directory.tar.lrz\n" - printf "lrzip -h will list lrzip options\n" + printf "lrz[un]tar -h will display this help message\n" + printf "lrzip -h will display lrzip options\n" return } ((v_d)) && { From 8eb0734e5c989fc495548977d86af8a377fc857b Mon Sep 17 00:00:00 2001 From: George Makrydakis Date: Sat, 3 Apr 2010 13:12:18 +0300 Subject: [PATCH 8/9] Minor fixes and adding an uninstall section to the Makefile.in file. --- Makefile.in | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index cf702c7..ae2743d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -103,7 +103,7 @@ install: all ${INSTALLCMD} -m 755 lrzip $(DESTDIR)${INSTALL_BIN} ( cd $(DESTDIR)${INSTALL_BIN} && ${LN_S} -f lrzip lrunzip ) ${INSTALLCMD} -m 755 lrztar $(DESTDIR)${INSTALL_BIN} - ln -sf $(DESTDIR)${INSTALL_BIN}/lrztar $(DESTDIR)${INSTALL_BIN}/lrzuntar + ${LN_S} -f $(DESTDIR)${INSTALL_BIN}/lrztar $(DESTDIR)${INSTALL_BIN}/lrzuntar chmod 755 $(DESTDIR)${INSTALL_BIN}/lrzuntar mkdir -p $(DESTDIR)${INSTALL_MAN1} ${INSTALLCMD} -m 644 $(MAN1FILES) $(DESTDIR)${INSTALL_MAN1} @@ -113,7 +113,11 @@ install: all ${INSTALLCMD} -m 644 $(DOCFILES) $(DESTDIR)${INSTALL_DOC} mkdir -p $(DESTDIR)${INSTALL_DOC_LZMA} ${INSTALLCMD} -m 644 $(DOCFILES_LZMA) $(DESTDIR)${INSTALL_DOC_LZMA} - +uninstall: + rm -rf $(DESTDIR)${INSTALL_BIN}/{lrztar,lrzuntar,lrunzip,lrzip} + rm -rf $(DESTDIR)${INSTALL_DOC} + rm -rf $(DESTDIR)${INSTALL_MAN1}/{lrunzip.1,lrzip.1,lrztar.1} + rm -rf $(DESTDIR)${INSTALL_MAN5}/lrzip.conf.5 lrzip: $(OBJS) $(CXX) $(LDFLAGS) -o lrzip $(OBJS) $(LIBS) From 3e12204fbea81d5ecc951356a0b5b4859da9f92d Mon Sep 17 00:00:00 2001 From: George Makrydakis Date: Sat, 3 Apr 2010 14:03:41 +0300 Subject: [PATCH 9/9] Stylistic fix on Makefile. --- Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index ae2743d..20a0889 100644 --- a/Makefile.in +++ b/Makefile.in @@ -101,8 +101,8 @@ zpipe.o: zpipe.cpp install: all mkdir -p $(DESTDIR)${INSTALL_BIN} ${INSTALLCMD} -m 755 lrzip $(DESTDIR)${INSTALL_BIN} - ( cd $(DESTDIR)${INSTALL_BIN} && ${LN_S} -f lrzip lrunzip ) ${INSTALLCMD} -m 755 lrztar $(DESTDIR)${INSTALL_BIN} + ${LN_S} -f $(DESTDIR)${INSTALL_BIN}/lrzip $(DESTDIR)${INSTALL_BIN}/lrunzip ${LN_S} -f $(DESTDIR)${INSTALL_BIN}/lrztar $(DESTDIR)${INSTALL_BIN}/lrzuntar chmod 755 $(DESTDIR)${INSTALL_BIN}/lrzuntar mkdir -p $(DESTDIR)${INSTALL_MAN1}