summaryrefslogtreecommitdiffstats
path: root/satellit_upgrader/updater.template.sh
diff options
context:
space:
mode:
Diffstat (limited to 'satellit_upgrader/updater.template.sh')
-rw-r--r--satellit_upgrader/updater.template.sh30
1 files changed, 18 insertions, 12 deletions
diff --git a/satellit_upgrader/updater.template.sh b/satellit_upgrader/updater.template.sh
index 48d8cab..052de70 100644
--- a/satellit_upgrader/updater.template.sh
+++ b/satellit_upgrader/updater.template.sh
@@ -581,18 +581,24 @@ fi
if [ -n "$TGZ_LDADP" ]; then
[ -e "$TMPDIR/$TGZ_LDADP" ] || perror "$TGZ_LDADP missing from payload"
echo "* LDAP/AD Proxy"
- OLD=$(md5sum "$PATH_LDADP/ldadp")
- echo "Extracting new binary"
- tar -x -C "$PATH_LDADP" -f "$TMPDIR/$TGZ_LDADP" || perror "Could not extract $TGZ_LDADP to $PATH_LDADP"
- rm -rf -- "$PATH_LDADP/logs"
- mkdir -p "$PATH_LDADP/configs" "$PATH_LDADP/pid"
- fixperms "$PATH_LDADP/configs" taskmanager:ldadp
- chmod -R o-rwx "$PATH_LDADP/configs"
- fixperms "$PATH_LDADP/pid" ldadp:root
- mkdir -p "/var/log/ldadp"
- fixperms "/var/log/ldadp" ldadp:root
- NEW=$(md5sum "$PATH_LDADP/ldadp")
- if [ "x$OLD" != "x$NEW" ]; then
+ tmpdir="$TMPDIR/ldadp.tmp"
+ mkdir -p "$tmpdir"
+ tar -x -C "$tmpdir" -f "$TMPDIR/$TGZ_LDADP" || perror "Could not extract $TGZ_LDADP to $tmpdir"
+ cver=$( /opt/ldadp/ldadp --version 2> /dev/null | awk '{ if ($1 == "Commit:") print $2}' )
+ nver=$( awk '{if ($2 == "LDADP_COMMIT") {gsub("\"", "", $3); print $3}}' "$tmpdir/version.in.h" )
+ [ -z "$nver" ] && pwarning "BUG BUG! Updater package contains no ldadp version information!"
+ mkdir -p "/opt/ldadp"
+ if [ "$cver" != "$nver" ]; then
+ echo "Compiling new ldadp binary..."
+ cd "$tmpdir"
+ if ! failprint make -j2 ldadp; then
+ pwarning "Could not make new version $nver of ldadp"
+ elif ! cp -f ldadp "$PATH_LDADP/ldadp"; then
+ pwarning "Build successful, but could not copy ldadp to $PATH_LDADP"
+ else
+ cver=
+ fi
+ [ -n "$cver" ] && pwarning "Trying to keep going with current version $cver"
killall ldadp 2>/dev/null && pwarning "LDAP/AD Proxy was killed. Client logins might not work for a couple of minutes (see Server Status in webif)"
fi
fi