drop the need for the force flag by default and just delete the existing files automa...
authorMike Frysinger <vapier@gentoo.org>
Fri, 16 Mar 2007 23:38:47 +0000 (23:38 -0000)
committerMike Frysinger <vapier@gentoo.org>
Fri, 16 Mar 2007 23:38:47 +0000 (23:38 -0000)
svn path=/main/trunk/; revision=6219

bin/ecompress

index 2006f657bc8d5228582a9580675ba63126a89e6b..7e51e3c44622077a61b8a18353785543c9ae18ba 100755 (executable)
@@ -16,7 +16,7 @@ PORTAGE_COMPRESS=${PORTAGE_COMPRESS-bzip2}
 
 if [[ ${PORTAGE_COMPRESS_FLAGS+set} != "set" ]] ; then
        case ${PORTAGE_COMPRESS} in
-               bzip2|gzip)  PORTAGE_COMPRESS_FLAGS="-f9";;
+               bzip2|gzip)  PORTAGE_COMPRESS_FLAGS="-9";;
        esac
 fi
 
@@ -41,6 +41,12 @@ case $1 in
                echo "${PORTAGE_COMPRESS} ${PORTAGE_COMPRESS_FLAGS}"
                ;;
        *)
+               # If a compressed version of the file already exists, simply
+               # delete it so that the compressor doesn't whine (bzip2 will
+               # complain and skip, gzip will prompt for input)
+               suffix=$(ecompress --suffix)
+               [[ -n ${suffix} ]] && rm -f "${@/%/${suffix}}"
+               # Finally, let's actually do some real work
                exec "${PORTAGE_COMPRESS}" ${PORTAGE_COMPRESS_FLAGS} "$@"
                ;;
 esac