summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-02-14 22:58:45 +0100
committerSimon Rettberg2019-02-14 22:58:45 +0100
commit80731a2a2333de9acbd3f6278c6c27ece655fcaf (patch)
treef5d04cb3dd4c133127aba0d019d9c4f9b80562b9
parent[SSUS] Add file checks for remaining tarballs (diff)
downloadsetup-scripts-80731a2a2333de9acbd3f6278c6c27ece655fcaf.tar.gz
setup-scripts-80731a2a2333de9acbd3f6278c6c27ece655fcaf.tar.xz
setup-scripts-80731a2a2333de9acbd3f6278c6c27ece655fcaf.zip
[SSUS] apt-install wrapper, install dev libs, refactoring..
-rw-r--r--satellit_upgrader/updater.template.sh63
1 files changed, 36 insertions, 27 deletions
diff --git a/satellit_upgrader/updater.template.sh b/satellit_upgrader/updater.template.sh
index 89e4d18..7ea0bca 100644
--- a/satellit_upgrader/updater.template.sh
+++ b/satellit_upgrader/updater.template.sh
@@ -16,11 +16,12 @@ fi
MAJOR=$(lsb_release -sr)
MAJOR=${MAJOR%%.*}
+readonly MAJOR
if [ "${MAJOR}" -lt 8 ]; then
echo "This Version of the bwLehrpool Satellite Server is too old!"
exit 1
fi
-if [ "${MAJOR}" -gt 8 ]; then
+if [ "${MAJOR}" -gt 9 ]; then
echo "This Version of the bwLehrpool Satellite Server is too new!"
exit 1
fi
@@ -118,6 +119,29 @@ failprint () {
return "$ret"
}
+aptupdate=false
+aptinst () {
+ local pkg=$1
+ if ! dpkg -l "$pkg" | grep -q "^ii\\s.*$pkg"; then
+ if ! $aptupdate; then
+ echo "Updating apt db"
+ failprint apt-get update || perror "Cannot run apt-get update"
+ aptupdate=true
+ fi
+ echo "Installing $pkg"
+ if ! failprint apt-get install -y "$pkg"; then
+ pwarning "*"
+ pwarning "* Warning: Could not install $pkg!"
+ pwarning "*"
+ pwarning "* Please do either \"apt-get install $pkg\" by hand or"
+ pwarning "* install $pkg otherwise."
+ pwarning "*"
+ return 1
+ fi
+ fi
+ return 0
+}
+
# ** Constants - to be patched by the packaging script
declare -rg TARGET_WEBIF_VERSION="%TARGET_WEBIF_VERSION%"
declare -rg TGZ_SLXADMIN="%TGZ_SLXADMIN%"
@@ -242,9 +266,7 @@ if [ -n "$TGZ_IPXE" ]; then
IPXE_PID=$!
fi
# Need mtools for creating floppy images for iPXE
-if ! which mformat &>/dev/null; then
- failprint apt-get install -y mtools
-fi
+aptinst mtools
# ************************** SLX-Admin *********************
if [ -n "$TGZ_SLXADMIN" ]; then
@@ -480,7 +502,7 @@ if which "atftpd" &>/dev/null || dpkg-query -W -f='${db:Status-Abbrev}' "atftpd"
echo "Replacing atftpd with tftpd-hpa"
systemctl stop atftpd.service
failprint apt-get purge -y atftpd || pwarning "Could not uninstall atftpd"
- failprint apt-get install -y tftpd-hpa || perror "Could not install tftpd-hpa"
+ aptinst tftpd-hpa || perror "Could not install tftpd-hpa. Netboot is now broken."
chg=true
fi
fi
@@ -528,19 +550,6 @@ if ! id -u dnbd3 &> /dev/null; then
useradd --no-create-home -d /nonexistent -s /bin/false --gid "$dnbd3group" --uid 10002 dnbd3 || perror "Could not add user dnbd3!"
fi
-if ! dpkg -l "$PACKAGE_LIBJANSSON" | grep -q "^ii\\s.*$PACKAGE_LIBJANSSON"; then
- echo "Installing $PACKAGE_LIBJANSSON"
- if ! failprint apt-get install -y "$PACKAGE_LIBJANSSON"; then
- pwarning "*"
- pwarning "* Warning: Could not install $PACKAGE_LIBJANSSON!"
- pwarning "*"
- pwarning "* This means the dnbd3 server will not work."
- pwarning "* Please do either \"apt-get install $PACKAGE_LIBJANSSON\" by hand or"
- pwarning "* install $PACKAGE_LIBJANSSON otherwise."
- pwarning "*"
- fi
-fi
-
# config
diffcp "dnbd3/server.conf" "/etc/dnbd3-server/server.conf"
diffcp "dnbd3/rpc.acl" "/etc/dnbd3-server/rpc.acl"
@@ -555,6 +564,8 @@ if [ -n "$TGZ_DNBD3" ]; then
[ -z "$nver" ] && pwarning "BUG BUG! Updater package contains no dnbd3 version information!"
mkdir -p "$PATH_DNBD3"
if [ "$cver" != "$nver" ]; then
+ aptinst libjansson-dev
+ aptinst libfuse-dev
echo "Compiling new dnbd3-server binary..."
cd "$tmpdir"
mkdir build
@@ -590,6 +601,8 @@ if [ -n "$TGZ_LDADP" ]; then
[ -z "$nver" ] && pwarning "BUG BUG! Updater package contains no ldadp version information!"
mkdir -p "/opt/ldadp"
if [ "$cver" != "$nver" ]; then
+ aptinst libssl-dev
+ aptinst libowfat-dev
echo "Compiling new ldadp binary..."
cd "$tmpdir"
if ! failprint make -j2 ldadp; then
@@ -605,23 +618,19 @@ if [ -n "$TGZ_LDADP" ]; then
fi
# ************************** tmate ************************
-if [ "$( lsb_release -cs )" != "jessie" ]; then
+if [ "$MAJOR" -gt 8 ]; then
# Kill this file; was accidentally put there on stretch
rm -f -- "/etc/apt/sources.list.d/10-added_repos.list"
fi
if ! which tmate &> /dev/null; then
echo "* Installing tmate"
- if [ "$( lsb_release -cs )" = "jessie" ]; then
+ if [ "$MAJOR" -eq 8 ]; then
echo "deb http://ftp.debian.org/debian jessie-backports main" > "/etc/apt/sources.list.d/10-added_repos.list"
- echo "Running apt update..."
- if ! failprint apt-get update; then
- pwarning "Adding backports repo: update failed"
- fi
+ aptupdate=false
fi
- echo "Installing package..."
- if ! failprint apt-get install -y tmate; then
+ if ! aptinst tmate; then
pwarning "Could not install tmate. Easy remote assistance will not be available."
- pwarning "Please check whether repo 'jessie-backports' was added and install by hand."
+ [ "$MAJOR" -eq 8 ] && pwarning "Please check whether repo 'jessie-backports' was added and install by hand."
fi
echo "Writing config..."
cat > /root/.tmate.conf <<-JUSTANOTHERDOC