From 2cc6a822f02287aa3d0ce2ceb07a6278ffa927d6 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 14 Feb 2019 13:30:10 +0100 Subject: [SSUS] Update/Install ldadp from source --- satellit_upgrader/pack-update.sh | 10 ++++++++-- satellit_upgrader/updater.template.sh | 30 ++++++++++++++++++------------ 2 files changed, 26 insertions(+), 14 deletions(-) (limited to 'satellit_upgrader') diff --git a/satellit_upgrader/pack-update.sh b/satellit_upgrader/pack-update.sh index e0238d2..dc4112c 100755 --- a/satellit_upgrader/pack-update.sh +++ b/satellit_upgrader/pack-update.sh @@ -37,6 +37,12 @@ declare -rg FILES_IPXE=" " declare -rg TGZ_LDADP="files/ldadp.tar.gz" +declare -rg LIST_LDADP=" + Makefile + .localversion + version.in.h + ldadp.c +" declare -rg TGZ_DNBD3="files/dnbd3.tar.gz" declare -rg FILES_DNBD3=" @@ -170,8 +176,8 @@ addpayload "DOZMOD" "Dozmod server" addpayload "TASKMANAGER" "Taskmanager" addpayload "TFTP" "TFTP/PxeLinux data" addpayload "IPXE" "iPXE source code" -addpayload "LDADP" "ldap/ad proxy" -addpayload "DNBD3" "dnbd3-server" +addpayload "LDADP" "ldap/ad proxy source code" +addpayload "DNBD3" "dnbd3-server source code" if [ -z "$LEAN" ]; then addinstallfile "lighttpd.conf" 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 -- cgit v1.2.3-55-g7522