Mercurial > repos > petr-novak > re_utils
view clean_repository_tarball.sh @ 8:99569eccc583 draft
Uploaded
author | petr-novak |
---|---|
date | Mon, 09 Dec 2019 04:14:48 -0500 |
parents | d397f5a85464 |
children |
line wrap: on
line source
#!/bin/bash containsElement () { local e match="$1" shift for e; do [[ "$e" == "$match" ]] && return 0; done return 1 } ARCHIVE_GZ=../re_utilities.tar.gz TMP_TAR=`mktemp` echo $TMP_TAR ARCHIVE_GZ_CLEAN=../re_utilities_clean.tar.gz zcat $ARCHIVE_GZ > $TMP_TAR ARCHIVE_FILE_LIST=`tar -tz -f ../re_utilities.tar.gz` ls -l $TMP_TAR GIT_LIST=`git ls-files` for FILE in $ARCHIVE_FILE_LIST do containsElement $FILE ${GIT_LIST[@]} if [ $? != 0 ] then echo "Deleting ${FILE}" tar --delete -f $TMP_TAR $FILE fi done ls -l $TMP_TAR echo "compressing.." gzip -c $TMP_TAR > $ARCHIVE_GZ_CLEAN echo "output in ${ARCHIVE_GZ_CLEAN}"