summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <karel.koci@nic.cz>2018-03-01 12:38:55 +0100
committerKarel Kočí <karel.koci@nic.cz>2018-03-01 12:38:55 +0100
commit69284c66e818bfcce1d2ac09980680a83f192487 (patch)
tree954fe3660b02c6c6f277e2c3cdc5768021568119
parent6e2a80fac70400ddee97b47becc96070371f4a84 (diff)
downloadturris-mymedkit-master.tar.gz
turris-mymedkit-master.tar.bz2
turris-mymedkit-master.zip
Fix how updater configuration is generatedHEADmaster
The branch override was added.
-rwxr-xr-xbuild_medkit.sh37
1 files changed, 22 insertions, 15 deletions
diff --git a/build_medkit.sh b/build_medkit.sh
index 96f91fa..9b42cb2 100755
--- a/build_medkit.sh
+++ b/build_medkit.sh
@@ -65,10 +65,8 @@ while [ $# -gt 0 ]; do
if [ -z "$MODEL" ]; then
MODEL="$1"
elif [ -z "$BRANCH" ]; then
- if [ "$1" == "deploy" ]; then
- BRANCH=
- else
- BRANCH="-$1"
+ if [ "$1" != "deploy" ]; then
+ BRANCH="$1"
TEST_BRANCH=true
case "$1" in
rc)
@@ -90,6 +88,9 @@ done
exit 1
}
+# Branch name with dash (yes for real)
+DBRANCH="-$BRANCH"
+
## Build needed tools ##
# Git puller helper function (git_pull output_path source_url)
@@ -144,11 +145,11 @@ export L10N
export LISTS
export OVERLAY
export TEST_BRANCH
-export ROOT="$(readlink -f "root-$MODEL$BRANCH")"
+export ROOT="$(readlink -f "root-$MODEL$DBRANCH")"
## Dump updater-ng entry script ##
-export UPDATER_CONFIG=".updater-$MODEL$BRANCH.lua"
+export UPDATER_CONFIG=".updater-$MODEL$DBRANCH.lua"
cat > "$UPDATER_CONFIG" <<EOF
-- Load requested localizations
l10n = {}
@@ -176,7 +177,7 @@ local script_options = {
'file://./.test.pub'
}
}
-base_url = 'https://repo.turris.cz/$MODEL$BRANCH/lists/'
+base_url = 'https://repo.turris.cz/$MODEL$DBRANCH/lists/'
-- Aways include base script
Script('base', base_url .. 'base.lua', script_options)
@@ -233,17 +234,23 @@ mkdir -p "$ROOT/usr/share/updater"
--batch "file://$UPDATER_CONFIG"
## Change /etc/config/updater to match given preferences
-sed -i '/^config pkglist/,/^$/d;/^config l10n/,/^$/d' "$ROOT/etc/config/updater"
-echo >> "$ROOT/etc/config/updater"
-echo "config pkglists 'pkglists'" >> "$ROOT/etc/config/updater"
+UPDCNF="$ROOT/etc/config/updater"
+echo > "\$UPDCNF"
+[ -z "$BRANCH" ] || cat >> "\$UPDCNF" <<EEOF
+config override 'override'
+ option branch '$BRANCH'
+
+EEOF
+echo "config pkglists 'pkglists'" >> "\$UPDCNF"
while IFS=',' read LIST; do
- echo " list lists '\$LIST'" >> "$ROOT/etc/config/updater"
+ echo " list lists '\$LIST'" >> "\$UPDCNF"
done <<< "\$LISTS"
-echo >> "$ROOT/etc/config/updater"
-echo "config l10n 'l10n'" >> "$ROOT/etc/config/updater"
+echo >> "\$UPDCNF"
+echo "config l10n 'l10n'" >> "\$UPDCNF"
while IFS=',' read LANG; do
- echo " list langs '\$LANG'" >> "$ROOT/etc/config/updater"
+ echo " list langs '\$LANG'" >> "\$UPDCNF"
done <<< "\$L10N"
+echo >> "\$UPDCNF"
## Overlay user's files
if [ -n "$OVERLAY" ]; then
@@ -259,7 +266,7 @@ rm -f usr/share/updater/flags
rm -rf usr/share/updater/unpacked
rm -rf var/opkg-collided
# Create archive
-tar -czf "../medkit-$MODEL$BRANCH.tar.gz" .
+tar -czf "../medkit-$MODEL$DBRANCH.tar.gz" .
)
EOF