summaryrefslogtreecommitdiffstats
path: root/satellit_upgrader
diff options
context:
space:
mode:
authorSimon Rettberg2019-02-14 12:21:48 +0100
committerSimon Rettberg2019-02-14 12:21:48 +0100
commit7c519618aa2a8eb554edd87b43db523161aa9de0 (patch)
tree31ef02ddb900af42014de9f84050e2ed89c9028c /satellit_upgrader
parent[SSUS] php.ini patching: Look for php5 and php7 (diff)
downloadsetup-scripts-7c519618aa2a8eb554edd87b43db523161aa9de0.tar.gz
setup-scripts-7c519618aa2a8eb554edd87b43db523161aa9de0.tar.xz
setup-scripts-7c519618aa2a8eb554edd87b43db523161aa9de0.zip
[SSUS] Include dnbd3 source code, compile if version changed
Diffstat (limited to 'satellit_upgrader')
-rwxr-xr-xsatellit_upgrader/pack-update.sh15
-rw-r--r--satellit_upgrader/updater.template.sh26
2 files changed, 37 insertions, 4 deletions
diff --git a/satellit_upgrader/pack-update.sh b/satellit_upgrader/pack-update.sh
index 3997b98..e0238d2 100755
--- a/satellit_upgrader/pack-update.sh
+++ b/satellit_upgrader/pack-update.sh
@@ -19,18 +19,31 @@ patchtgz () {
}
declare -rg UPDATER="updater.sh"
+
declare -rg TGZ_SLXADMIN="files/slx-admin.tar.gz"
+
declare -rg TGZ_DOZMOD="files/dozmod.tar.gz"
+
declare -rg TGZ_TASKMANAGER="files/taskmanager.tar.gz"
+
declare -rg TGZ_TFTP="files/tftpdir.tar.gz"
+
declare -rg TGZ_IPXE="files/ipxe.tar.gz"
+
declare -rg FILES_IPXE="
pxelinux.0
src/
.git/
"
+
declare -rg TGZ_LDADP="files/ldadp.tar.gz"
-declare -rg TGZ_DNBD3="files/dnbd3-server.tar.gz"
+
+declare -rg TGZ_DNBD3="files/dnbd3.tar.gz"
+declare -rg FILES_DNBD3="
+ CMakeLists.txt
+ src/
+ version.txt
+"
checkfiles () {
tar tf "$1" | awk -v strings="$2" '
diff --git a/satellit_upgrader/updater.template.sh b/satellit_upgrader/updater.template.sh
index 88f6639..48d8cab 100644
--- a/satellit_upgrader/updater.template.sh
+++ b/satellit_upgrader/updater.template.sh
@@ -139,7 +139,7 @@ declare -rg PATH_TFTP="/srv/openslx/tftp"
declare -rg PATH_IPXE="/opt/openslx/ipxe"
declare -rg PATH_LDADP="/opt/ldadp"
declare -rg PATH_DNBD3="/opt/openslx/dnbd3"
-declare -rg PACKAGE_LIBJANSSON="libjansson4" # needed by dnbd3
+declare -rg PACKAGE_LIBJANSSON="libjansson-dev" # needed by dnbd3
# ** Check if constants have been filled, bail out otherwise
if [ -z "$TARGET_WEBIF_VERSION" ] || [[ "$TARGET_WEBIF_VERSION" == %*% ]]; then
@@ -547,8 +547,28 @@ diffcp "dnbd3/rpc.acl" "/etc/dnbd3-server/rpc.acl"
diffcp "dnbd3/is-enabled" "$PATH_DNBD3/is-enabled"
if [ -n "$TGZ_DNBD3" ]; then
- echo "Extracting new dnbd3-server binary"
- tar -x -C "$PATH_DNBD3" -f "$TMPDIR/$TGZ_DNBD3" || perror "Could not extract $TGZ_DNBD3 to $PATH_DNBD3"
+ mkdir -p "$TMPDIR/dnbd3.tmp"
+ tar -x -C "$TMPDIR/dnbd3.tmp" -f "$TMPDIR/$TGZ_DNBD3" || perror "Could not extract $TGZ_DNBD3 to $TMPDIR/dnbd3.tmp"
+ cver=$( /opt/openslx/dnbd3/dnbd3-server --version 2> /dev/null )
+ nver=$( cat "$TMPDIR/dnbd3.tmp/version.txt" )
+ [ -z "$nver" ] && pwarning "BUG BUG! Updater package contains no dnbd3 version information!"
+ mkdir -p /opt/openslx/dnbd3
+ if [ "$cver" != "$nver" ]; then
+ echo "Compiling new dnbd3-server binary..."
+ cd "$TMPDIR/dnbd3.tmp"
+ mkdir build
+ cd build
+ if ! failprint cmake -DBUILD_FUSE_CLIENT=OFF -DBUILD_KERNEL_MODULE=OFF -DBUILD_STRESSTEST=OFF -DBUILD_SERVER=ON -DCMAKE_BUILD_TYPE=Release ..; then
+ pwarning "Could not cmake new version $nver of dnbd3-server"
+ elif ! failprint make -j2 dnbd3-server; then
+ pwarning "Could not compile new version $nver of dnbd3-server"
+ elif ! cp -f dnbd3-server /opt/openslx/dnbd3/dnbd3-server; then
+ pwarning "Successfully built new dnbd3-server, but could not copy binary to /opt/openslx/dnbd3/dnbd3-server"
+ else # Clear this so we know not to print the "trying to keep going.." message
+ cver=
+ fi
+ [ -n "$cver" ] && pwarning "Trying to keep going with current version $cver"
+ fi
fi
# ********************** dnbd3.service *******************