summaryrefslogtreecommitdiffstats
path: root/satellit_upgrader/pack-update.sh
diff options
context:
space:
mode:
authorSimon Rettberg2016-02-09 17:49:56 +0100
committerSimon Rettberg2016-02-09 17:49:56 +0100
commit1c558f5bff8f1f9a17778babf0979b6668f2db3d (patch)
tree5c537169664e766a6676408008e51a948edd3e2e /satellit_upgrader/pack-update.sh
parent[SSUS] Some progress, appending archive works, detecting slxadmin version works (diff)
downloadsetup-scripts-1c558f5bff8f1f9a17778babf0979b6668f2db3d.tar.gz
setup-scripts-1c558f5bff8f1f9a17778babf0979b6668f2db3d.tar.xz
setup-scripts-1c558f5bff8f1f9a17778babf0979b6668f2db3d.zip
[SSUS] Finish update functionality for slx-admin
Diffstat (limited to 'satellit_upgrader/pack-update.sh')
-rwxr-xr-xsatellit_upgrader/pack-update.sh14
1 files changed, 12 insertions, 2 deletions
diff --git a/satellit_upgrader/pack-update.sh b/satellit_upgrader/pack-update.sh
index 71f24b6..33bbfc5 100755
--- a/satellit_upgrader/pack-update.sh
+++ b/satellit_upgrader/pack-update.sh
@@ -11,9 +11,17 @@ perror () {
exit 1
}
+patchtgz () {
+ [ -z "$1" ] && perror "patchtgz call failure"
+ local VARNAME="$1"
+ local VALUE="$2"
+ sed -i "s,%${VARNAME}%,${VALUE},g" "$UPDATER" || perror "could not patchtgz $VARNAME in updater"
+}
+
#declare -rg TMPDIR=$(mktemp -d)
#[ -d "$TMPDIR" ] || perror "TMPDIR fail."
declare -rg UPDATER="updater.sh"
+declare -rg TGZ_SLXADMIN="files/slx-admin.tar.gz"
cp "updater.template.sh" "$UPDATER" || perror "could not copy template"
chmod +x "$UPDATER"
@@ -21,14 +29,16 @@ chmod +x "$UPDATER"
# Replace variables
# slxadmin version
echo -n "Includes SLX-Admin: "
-if [ -e "files/slx-admin.tar.gz" ]; then
+if [ -e "$TGZ_SLXADMIN" ]; then
echo "yes"
- VERS=$(tar -xOf "files/slx-admin.tar.gz" "inc/database.inc.php" | grep -A3 'function getExpectedSchemaVersion' | grep -o -E 'return [0-9]+' | grep -o -E '[0-9]+')
+ VERS=$(tar -xOf "$TGZ_SLXADMIN" "inc/database.inc.php" | grep -A3 'function getExpectedSchemaVersion' | grep -o -E 'return [0-9]+' | grep -o -E '[0-9]+')
[ -n "$VERS" ] || perror "Could not extract slx-admin version!"
echo "Version: $VERS"
sed -i "s/%TARGET_WEBIF_VERSION%/${VERS}/" "$UPDATER" || perror "could not patch slxadmin version in updater"
+ patchtgz "TGZ_SLXADMIN" "$TGZ_SLXADMIN"
else
echo "no"
+ patchtgz "TGZ_SLXADMIN"
fi
# Last patch: Payload offset
# Calc payload offset, which is tricky as the size changes as we patch