comparison clean_repository_tarball.sh @ 4:d397f5a85464 draft

Uploaded
author petr-novak
date Wed, 18 Sep 2019 06:30:04 -0400
parents
children
comparison
equal deleted inserted replaced
3:e320ef2d105a 4:d397f5a85464
1 #!/bin/bash
2 containsElement () {
3 local e match="$1"
4 shift
5 for e; do [[ "$e" == "$match" ]] && return 0; done
6 return 1
7 }
8 ARCHIVE_GZ=../re_utilities.tar.gz
9 TMP_TAR=`mktemp`
10 echo $TMP_TAR
11 ARCHIVE_GZ_CLEAN=../re_utilities_clean.tar.gz
12 zcat $ARCHIVE_GZ > $TMP_TAR
13 ARCHIVE_FILE_LIST=`tar -tz -f ../re_utilities.tar.gz`
14 ls -l $TMP_TAR
15 GIT_LIST=`git ls-files`
16
17 for FILE in $ARCHIVE_FILE_LIST
18 do
19 containsElement $FILE ${GIT_LIST[@]}
20 if [ $? != 0 ]
21 then
22 echo "Deleting ${FILE}"
23 tar --delete -f $TMP_TAR $FILE
24 fi
25 done
26 ls -l $TMP_TAR
27 echo "compressing.."
28 gzip -c $TMP_TAR > $ARCHIVE_GZ_CLEAN
29 echo "output in ${ARCHIVE_GZ_CLEAN}"