[compression_utils] Bug fixes on xzize
xzize: - Fix bug with file names with spaces. - Fix bug when invoking program without arguments. - Handle error when input file is not a regular file instead of delegate to xz. - Add an info message when compressing an uncompressed file. lz: - Info message on stdout instead of stderr when uncompressing.
This commit is contained in:
parent
f7c2f3aec7
commit
93601c6310
|
@ -45,7 +45,7 @@ for F in "$@" ; do
|
|||
if [ "$ACTION" = "t" ] ; then
|
||||
echo "*** Listing « $F » ***" >&2
|
||||
else
|
||||
echo "Extracting « $F »…" >&2
|
||||
echo "Extracting « $F »…"
|
||||
fi
|
||||
|
||||
# Simple Tar archive
|
||||
|
|
|
@ -41,7 +41,7 @@ do_recompress()
|
|||
return 0
|
||||
fi
|
||||
echo "Recompressing « $SOURCE » to « $DEST »…"
|
||||
$ACTION -c $SOURCE | xz -9 >$DEST
|
||||
$ACTION -c "$SOURCE" | xz -9 >"$DEST"
|
||||
return $?
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ do_recompress()
|
|||
## Verify number of arguments ##
|
||||
|
||||
if [ $# -lt 1 ] ; then
|
||||
echo "$PROGRAM requires at least one argument!" >&2
|
||||
echo "$0 requires at least one argument!" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
|
@ -57,6 +57,11 @@ fi
|
|||
## Process files ##
|
||||
|
||||
for SOURCE in "$@" ; do
|
||||
# Regular file?
|
||||
if [ ! -f "$SOURCE" ] ; then
|
||||
echo "Skipping source file « $SOURCE »: is not a regular file!" >&2
|
||||
continue
|
||||
fi
|
||||
|
||||
# GZip
|
||||
test_extension "$SOURCE" gz
|
||||
|
@ -92,11 +97,12 @@ for SOURCE in "$@" ; do
|
|||
|
||||
# XZ
|
||||
if test_extension "$SOURCE" xz ; then
|
||||
echo "Skipping source file « $DEST »: it has already .xz suffix!" >&2
|
||||
echo "Skipping source file « $DEST »: has already .xz suffix!" >&2
|
||||
continue
|
||||
fi
|
||||
|
||||
# Uncompressed file: fall back to simple compression
|
||||
echo "Compressing « $SOURCE » to xz…"
|
||||
xz -9 "$SOURCE"
|
||||
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue