diff clean_repository_tarball.sh @ 4:d397f5a85464 draft

Uploaded
author petr-novak
date Wed, 18 Sep 2019 06:30:04 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/clean_repository_tarball.sh	Wed Sep 18 06:30:04 2019 -0400
@@ -0,0 +1,29 @@
+#!/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}"