summaryrefslogtreecommitdiffstats
path: root/satellit_upgrader/pack-update.sh
diff options
context:
space:
mode:
authorSimon Rettberg2016-07-05 17:44:39 +0200
committerSimon Rettberg2016-07-05 17:44:39 +0200
commitc98979078ae1c872664e35d8b3c8de0fb959537e (patch)
treeb086961eda7cd71524599d2e7325fcc0fa279501 /satellit_upgrader/pack-update.sh
parent[SSUS] Include lighttpd.conf from installer (diff)
downloadsetup-scripts-c98979078ae1c872664e35d8b3c8de0fb959537e.tar.gz
setup-scripts-c98979078ae1c872664e35d8b3c8de0fb959537e.tar.xz
setup-scripts-c98979078ae1c872664e35d8b3c8de0fb959537e.zip
[SSUS] Various minor fixes/improvements
Diffstat (limited to 'satellit_upgrader/pack-update.sh')
-rwxr-xr-xsatellit_upgrader/pack-update.sh30
1 files changed, 27 insertions, 3 deletions
diff --git a/satellit_upgrader/pack-update.sh b/satellit_upgrader/pack-update.sh
index 5f7e559..15768c1 100755
--- a/satellit_upgrader/pack-update.sh
+++ b/satellit_upgrader/pack-update.sh
@@ -18,8 +18,6 @@ patchtgz () {
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"
declare -rg TGZ_DOZMOD="files/dozmod.tar.gz"
@@ -28,9 +26,31 @@ declare -rg TGZ_TFTP="files/tftpdir.tar.gz"
declare -rg TGZ_IPXE="files/ipxe.tar.gz"
declare -rg TGZ_LDADP="files/ldadp.tar.gz"
+# Prepare installer
cp "updater.template.sh" "$UPDATER" || perror "could not copy template"
chmod +x "$UPDATER"
+# Prepare source directory
+declare -rg SRCDIR=$1
+if [ -z "$SRCDIR" ]; then
+ echo "Usage: $0 <srcdir>"
+ echo "Where <srcdir> is the directory you put all the file to pack as payload"
+ exit 1
+fi
+
+if [ "x$(stat -c "%d:%i" "$SRCDIR")" != "x$(stat -c "%d:%i" files)" ]; then
+ rm -rf "files"
+ [ -d "files" ] && perror "files still exists..."
+ cp -r "$SRCDIR" "files"
+fi
+
+if [ ! -d "$SRCDIR" ]; then
+ echo "Source dir '$SRCDIR' not found!"
+fi
+
+#declare -rg TMPDIR=$(mktemp -d)
+#[ -d "$TMPDIR" ] || perror "TMPDIR fail."
+
addpayload () {
echo -n "Includes $2: "
local FILEVAR=$1
@@ -63,7 +83,7 @@ addinstallfile () {
echo -n "Includes SLX-Admin: "
if [ -e "$TGZ_SLXADMIN" ]; then
echo "yes"
- VERS=$(tar -xOf "$TGZ_SLXADMIN" "inc/database.inc.php" | grep -A3 'function getExpectedSchemaVersion' | grep -o -E 'return [0-9]+' | grep -o -E '[0-9]+')
+ VERS=$(date +%Y%j%H)
[ -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"
@@ -82,6 +102,10 @@ addpayload "TGZ_LDADP" "ldap/ad proxy"
addinstallfile "atftpd.service"
addinstallfile "lighttpd.conf"
+# TODO: Unify more
+source ../satellit_installer/includes/10-sudo_config.inc
+sudo_config files/tm-sudo-config
+
# Last patch: Payload offset
# Calc payload offset, which is tricky as the size changes as we patch
SIZE=$(stat -c %s "$UPDATER")