aboutsummaryrefslogtreecommitdiff
path: root/utils/opkg-trans-master.sh
blob: b16845ce810b3b9bc817f7af7bd38a83be8a17ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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 $UPDATER_REPO master:master
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