summaryrefslogtreecommitdiff
path: root/name_firmware
diff options
context:
space:
mode:
authorKatze Miau <miaukatzemiau@priveasy.de>2011-12-08 14:02:50 (GMT)
committerKatze Miau <miaukatzemiau@priveasy.de>2011-12-08 14:02:50 (GMT)
commitb49f8093246a1ad8b4f1998f48690cfc20d09e52 (patch)
treec1299683e2f570ce83ee654575fabcd916be80c7 /name_firmware
parenta4fa439241252bb25559952aeffbffd7f6d9721f (diff)
generate files/etc/{banner, firmware} from repository state
The new script ./name_firmware is used to generates two files in openwrt/$REPO/files/ during `make image/...`: - /etc/firmware (see documentation on firmware id) - /etc/banner (login banner; generated from the template in /files/common/etc/banner)
Diffstat (limited to 'name_firmware')
-rwxr-xr-xname_firmware27
1 files changed, 27 insertions, 0 deletions
diff --git a/name_firmware b/name_firmware
new file mode 100755
index 0000000..bf062d3
--- /dev/null
+++ b/name_firmware
@@ -0,0 +1,27 @@
+#!/bin/bash -e
+
+[ -d "$1" ] || {
+ echo "Usage: $0 target-repo";
+ exit 1;
+}
+
+REPO=$1
+OB=$1/files/etc/banner
+OF=$1/files/etc/firmware
+
+HDATE="$(date +'%d.%m.%Y %H:%M')"
+VGIT=$(
+ git log --format=format:%cd_%h --date=short | head -n1 | tr -d "\n";
+ [ -n "$$(git status --porcelain)" ] && echo -n "-modified";
+)
+VWRT=$(basename $REPO)-$(cd $REPO; svn info | grep Revision | cut -f2 -d' ')
+MACHINE="$USER @ $HOST"
+
+# firmware id
+echo "${VGIT}_$VWRT" > $OF
+
+# banner
+sed < files/common/etc/banner > $OB \
+'s/$VWRT.\{'$(($(echo -n "$VWRT"|wc -c) - 5))'\}/'"$VWRT"'/
+s/$VGIT.\{'$(($(echo -n "$VGIT"|wc -c) - 5))'\}/'"$VGIT"'/
+s/$HDATE.\{'$(($(echo -n "$HDATE"|wc -c) - 6))'\}/'"$HDATE"'/'
contact: Jan Huwald // Impressum