From fb417f438e3c0525528cf4e82d1f442612c3a879 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Wed, 5 Oct 2016 19:28:44 +0000 Subject: [PATCH] collect-installed-pkg-changes.sh: Collect-installed-pkg-changes.sh some improvements - Usage message - Target option - Only copying files differing from local directory Signed-off-by: Jan Lindemann --- scripts/collect-installed-pkg-changes.sh | 33 ++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/scripts/collect-installed-pkg-changes.sh b/scripts/collect-installed-pkg-changes.sh index f1950dc2..7ee0eb07 100644 --- a/scripts/collect-installed-pkg-changes.sh +++ b/scripts/collect-installed-pkg-changes.sh @@ -21,6 +21,36 @@ lp() find . -name "$1" | grep -v "/dist/\|/include/" } +usage() +{ + echo "$myname [-h] [-t target-dir ] [ package-name ]" + [ "$1" ] && exit $1 +} + +# -- here we go + +set -- `getopt 'ht:' $*` +while [ "$1" != -- ]; do + case "$1" in + -h) + usage 0 + ;; + -t) + target="$2" + shift + ;; + *) + usage 1 + ;; + esac + shift +done +shift + +[ "$target" ] && { + cd $target || fatal "failed to change to target dir \"$target\"" +} + proj=$1 [ "$proj" ] || { proj=`pwd | xargs basename` @@ -47,6 +77,9 @@ for p in $changed_paths; do lp $b fatal exiting } + diff -q $lp $p >/dev/null 2>&1 && { + continue + } log copying $p $lp cp $p $lp done