aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorKarel Kočí <karel.koci@nic.cz>2017-06-09 16:27:45 +0200
committerKarel Kočí <karel.koci@nic.cz>2017-06-09 16:27:45 +0200
commitaa7f2691f850d6ef7815510fa32deb751f3897ee (patch)
treeb7bb4a69cdc7803f910645df031f91cd469d40e3 /utils
parent67fb2bf06b08e987f5f6a4c644b08702f5ea95b9 (diff)
downloadturris-myrepo-aa7f2691f850d6ef7815510fa32deb751f3897ee.tar.gz
turris-myrepo-aa7f2691f850d6ef7815510fa32deb751f3897ee.tar.bz2
turris-myrepo-aa7f2691f850d6ef7815510fa32deb751f3897ee.zip
Build opkg-trans master automatically
Diffstat (limited to 'utils')
-rwxr-xr-xutils/opkg-trans-master.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/utils/opkg-trans-master.sh b/utils/opkg-trans-master.sh
new file mode 100755
index 0000000..a44910b
--- /dev/null
+++ b/utils/opkg-trans-master.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+# This script check if updater doesn't contain new commit and if so it bumps
+# automatically.
+
+UPDATER_REPO=https://kkoci@gitlab.labs.nic.cz/turris/updater.git
+UPDATER_REPO_PATH=/tmp/myrepo_updater_repo
+
+if [ ! -f $1/opkg-trans-master-auto/Makefile ]; then
+ # Skip this when we don't have opkg-trans-master-auto
+ exit
+fi
+
+# Update updater git repo
+GIT_ARGS="--git-dir="$UPDATER_REPO_PATH" --bare"
+if [ ! -d $UPDATER_REPO_PATH ]; then
+ git clone --bare $UPDATER_REPO $UPDATER_REPO_PATH
+else
+ git $GIT_ARGS fetch
+fi
+# Get info
+HASH="$(git $GIT_ARGS rev-parse HEAD)"
+VERSION="$(git $GIT_ARGS describe --abbrev=0 --tags)"
+RELEASE="$(($(git $GIT_ARGS rev-list --count $VERSION..HEAD) + 1))"
+
+# Now replace stuff in Makefile
+sed -i "s/^PKG_VERSION:=.*/PKG_VERSION:=$VERSION/;s/^PKG_RELEASE:=.*/PKG_RELEASE:=$RELEASE/;s/^PKG_SOURCE_VERSION:=.*/PKG_SOURCE_VERSION:=$HASH/" $1/opkg-trans-master-auto/Makefile