diff options
author | Karel Kočí <karel.koci@nic.cz> | 2017-05-22 12:39:26 +0200 |
---|---|---|
committer | Karel Kočí <karel.koci@nic.cz> | 2017-05-22 12:39:26 +0200 |
commit | 311065139eabf33be78f99f4c3aa692bc1f5193b (patch) | |
tree | d1448799e43b48ea8fd9d733d3a1e65e7fbf61ea | |
parent | 9f154e163451844bfe692ca81b966ab9b963e8f4 (diff) | |
download | turris-mymedkit-311065139eabf33be78f99f4c3aa692bc1f5193b.tar.gz turris-mymedkit-311065139eabf33be78f99f4c3aa692bc1f5193b.tar.bz2 turris-mymedkit-311065139eabf33be78f99f4c3aa692bc1f5193b.zip |
Add root build script
-rwxr-xr-x | build_medkit.sh | 53 | ||||
-rwxr-xr-x | scripts/build_tools.sh | 2 | ||||
-rwxr-xr-x | scripts/updater-medkit.sh | 8 |
3 files changed, 60 insertions, 3 deletions
diff --git a/build_medkit.sh b/build_medkit.sh new file mode 100755 index 0000000..54004d8 --- /dev/null +++ b/build_medkit.sh @@ -0,0 +1,53 @@ +#!/bin/sh +set -e +cd `dirname $0` + +BRANCH= +MODEL=omnia +while [ $# -gt 0 ]; do + case "$1" in + -h|--help) + echo "This script generates Turris medkit using user lists and updater-ng." + echo "Usage: $0 [OPTION]..." + echo + echo "Options:" + echo " --help, -h" + echo " --version VERSION" + echo " --branch BRANCH" + echo " --model MODEL" + exit 0 + ;; + --version) + shift + VERSION="$1" + ;; + --branch) + shift + BRANCH="$1" + ;; + --model) + shift + MODEL="$1" + ;; + *) + echo "Unknown option: $1" >&2 + exit 1 + ;; + esac + shift +done + +if [ -z "$VERSION" ]; then + [ -n "$BRANCH" ] && VBRANCH="-$BRANCH" + VERSION="$(curl https://repo.turris.cz/$BOARD$VBRANCH/root/etc/turris-version)" +fi + +# Ensure that we tools +./scripts/build_tools.sh + +# Download api crl +chmod +x .get-api-crl +./.get-api-crl + +# Now build medkit +fakeroot ./scripts/updater-medkit.sh --version "$VERSION" --branch "$BRANCH" --model "$MODEL" diff --git a/scripts/build_tools.sh b/scripts/build_tools.sh index 2adb27b..b161f87 100755 --- a/scripts/build_tools.sh +++ b/scripts/build_tools.sh @@ -12,7 +12,7 @@ git_pull() { else pushd $1 >/dev/null git fetch - if ! git diff --quiet HEAD origin/master; then + if ! git diff --quiet HEAD origin/HEAD; then git clean -Xdf git reset --hard origin/master git submodule update --init --recursive diff --git a/scripts/updater-medkit.sh b/scripts/updater-medkit.sh index 0ab5078..d7324ce 100755 --- a/scripts/updater-medkit.sh +++ b/scripts/updater-medkit.sh @@ -2,7 +2,6 @@ # This script is real medkit generator using updater set -e -VERSION="3.7" MODEL=omnia BRANCH= while [ $# -gt 0 ]; do @@ -27,6 +26,11 @@ while [ $# -gt 0 ]; do shift done +if [ -z "$VERSION" ]; then + echo "Missing --version argument!" >&2 + exit 1 +fi + ROOT=root-$MODEL [ -n "$BRANCH" ] && ROOT=$ROOT-$BRANCH rm -rf $ROOT @@ -34,7 +38,7 @@ mkdir $ROOT OUTPUT=medkit-$MODEL [ -n "$BRANCH" ] && OUTPUT=$OUTPUT-$BRANCH -OUTPUT=$PWD/$OUTPUT.tar.gz +OUTPUT=$PWD/$OUTPUT-$VERSION.tar.gz ## Create base filesystem for updater ln -s tmp $ROOT/var |