Helper script to copy note files from one arch to another
authorSteve McIntyre <steve@einval.com>
Mon, 31 Dec 2018 15:56:06 +0000 (15:56 +0000)
committerSteve McIntyre <steve@einval.com>
Mon, 31 Dec 2018 15:56:06 +0000 (15:56 +0000)
bin/copy_note [new file with mode: 0755]

diff --git a/bin/copy_note b/bin/copy_note
new file mode 100755 (executable)
index 0000000..4d33f4f
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+if [ "$ARCH"x = ""x ]; then
+   echo "ARCH not set, aborting"
+   exit 1
+fi
+
+if [ "$OUTDIR"x = ""x ]; then
+    OUTDIR="."
+fi
+
+for NOTEFILE in $@; do
+    case $NOTEFILE in
+       *.note)
+           # OK
+       ;;
+       *)
+           echo "ERROR: non-notefile $NOTEFILE specified"
+           echo "ABORT"
+           exit 1
+           ;;
+    esac
+
+    if [ ! -f $NOTEFILE ]; then
+       echo "Can't find notefile $NOTEFILE, ignoring"
+    else
+       PKG_VER_ARCH=$(basename $NOTEFILE)
+       PKG=$(echo $PKG_VER_ARCH | cut -d _ -f1)
+       VER=$(echo $PKG_VER_ARCH | cut -d _ -f2)
+       OLDARCH=$(echo $PKG_VER_ARCH | cut -d _ -f3)
+       NEWNAME="${PKG}_${VER}_${ARCH}.note"
+       cp -v $NOTEFILE $OUTDIR/$NEWNAME
+    fi
+done
+