summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2013-08-19 18:07:39 +0200
committerJonathan Bauer2013-08-19 18:07:39 +0200
commitc64219dac35a0cb4450954b470dc39c1e4326d35 (patch)
tree6051f0e6a66aa1e12beec5d536ec5848b9768354
parent[busybox] add dirname to busybox (diff)
downloadtm-scripts-c64219dac35a0cb4450954b470dc39c1e4326d35.tar.gz
tm-scripts-c64219dac35a0cb4450954b470dc39c1e4326d35.tar.xz
tm-scripts-c64219dac35a0cb4450954b470dc39c1e4326d35.zip
fixes for the download function of etc/functions that is needed for the 'systemd-set_slx_addons'-script
-rwxr-xr-xremote/rootfs/rootfs-stage31/data/bin/activate_sysconfig2
-rw-r--r--remote/rootfs/rootfs-stage31/data/etc/functions9
-rwxr-xr-xremote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_slx_addons27
3 files changed, 21 insertions, 17 deletions
diff --git a/remote/rootfs/rootfs-stage31/data/bin/activate_sysconfig b/remote/rootfs/rootfs-stage31/data/bin/activate_sysconfig
index 1c942d7a..6192137a 100755
--- a/remote/rootfs/rootfs-stage31/data/bin/activate_sysconfig
+++ b/remote/rootfs/rootfs-stage31/data/bin/activate_sysconfig
@@ -54,8 +54,6 @@ SLX_PXE_SERVER_IP='$SERVERIP'
SLX_PXE_GATEWAY='$GATEWAY'
SLX_PXE_DNS='$DNS_SERVER'
SLX_PXE_MAC='$BRIDGEMAC'
-
-SLX_KCL_SERVERS='$SLX_KCL_SERVERS'
HEREEND
# setup hardware clock
diff --git a/remote/rootfs/rootfs-stage31/data/etc/functions b/remote/rootfs/rootfs-stage31/data/etc/functions
index b67da36a..37bb7d89 100644
--- a/remote/rootfs/rootfs-stage31/data/etc/functions
+++ b/remote/rootfs/rootfs-stage31/data/etc/functions
@@ -55,11 +55,12 @@ read_from_cmdline(){
download() {
[ $# -ne 2 ] && echo "Error - 'download' requires 2 arguments, $# given." && return 1
- if [ -e ${FUTURE_ROOT}/opt/openslx/config ]; then
- . ${FUTURE_ROOT}/opt/openslx/config || echo "Error - could not source '${FUTURE_ROOT}/opt/openslx/config'"
+ if [ -e "${FUTURE_ROOT}/opt/openslx/config" ]; then
+ . "${FUTURE_ROOT}/opt/openslx/config" || echo "Error - could not source '${FUTURE_ROOT}/opt/openslx/config'"
else
# read SLX_KCL_SERVERS from cmdline since we didn't get it from the config file.
- local SLX_KCL_SERVERS="$(read_from_cmdline "slxsrv" | tr ',' ' ')"
+ SLX_KCL_SERVERS="$(read_from_cmdline "slxsrv" | tr ',' ' ')"
+ echo "SLX_KCL_SERVERS='$SLX_KCL_SERVERS'" >> "${FUTURE_ROOT}/opt/openslx/config"
fi
local FILE_URL="$1"
@@ -75,7 +76,7 @@ download() {
[ $TIMEOUT -eq 5 ] && drop_shell "Max timeouts reached. Dropping shell..."
usleep $(($TIMEOUT * 500000))
else
- [ $DEBUG -ge 1 ] && echo "Successfully downloaded '$FILE_URL'."
+ [ "x$DEBUG" != "x" ] && echo "Successfully downloaded 'http://${SERVER}/$FILE_URL'."
return 0
fi
done
diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_slx_addons b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_slx_addons
index b6f04d55..a3350424 100755
--- a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_slx_addons
+++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_slx_addons
@@ -6,27 +6,32 @@
#
#
-# This script requires the addon to setup as its first parameter
-
-[ "x$1" == "x" ] && { echo "$0 requires the addon as parameter. None given." && exit 1; }
-ADDON="$1"
+. /opt/openslx/etc/functions
+export FUTURE_ROOT="/"
# read openslx config
. /opt/openslx/config
-[ -z "${SLX_ADDONS_BASE_URL}" ] && { echo "SLX_ADDONS_BASE_URL is not set in /opt/openslx/config." && exit 1; }
-[ -z "${SLX_ADDONS_LIST}" ] && { echo "SLX_ADDONS_LIST is not set in /opt/openslx/config." && exit 1; }
+[ -z "${SLX_ADDONS}" ] && { echo "SLX_ADDONS is not set in /opt/openslx/config." && exit 1; }
+if [ -z "${SLX_CONFIG_SERVERS}" ]; then
+ echo "SLX_CONFIG_SERVERS is not set in /opt/openslx/config. Will only try the base servers from the cmdline."
+ if [ -z "${SLX_KCL_SERVERS}" ]; then
+ SLX_KCL_SERVERS=$(read_from_cmdline "slxsrv")
+ fi
+fi
+
+# read base slx servers from cmdline
+SLX_BASE_PATH=$(read_from_cmdline "slxbase")
SLX_BASE_MNT="/opt/openslx/mnt"
SYS_TMP="/tmp"
-for ADDON in ${SLX_ADDONS_LIST}; do
+for ADDON in ${SLX_ADDONS}; do
# download the addon from the given URL
- local ADDON_TARGET_PATH="${SYS_TMP}/$(basename $(echo ${ADDON})).sqfs"
- echo "Downloading $SLX_ADDONS_BASE_URL/${ADDON}.sqfs to ${ADDON_TARGET_PATH}"
- wget -T 5 -q -O "${ADDON_TARGET_PATH}" "${SLX_ADDONS_BASE_URL}/${ADDON}.sqfs"|| { echo "Failed to download." && exit 1; }
+ ADDON_TARGET_PATH="${SYS_TMP}/$(basename $(echo ${ADDON})).sqfs"
+ download "${SLX_BASE_PATH}/${ADDON}.sqfs" "${ADDON_TARGET_PATH}"
# now mount it to $SLX_MNT/<addon-name>
- local ADDON_MOUNT_POINT="${SLX_BASE_MNT}/$(basename $(echo ${ADDON})|awk -F "." '{print $1}')"
+ ADDON_MOUNT_POINT="${SLX_BASE_MNT}/$(basename $(echo ${ADDON})|awk -F "." '{print $1}')"
mkdir -p "$ADDON_MOUNT_POINT"
echo "Mounting ${ADDON_TARGET_PATH} to ${ADDON_MOUNT_POINT}"
mount -t squashfs "$ADDON_TARGET_PATH" ${ADDON_MOUNT_POINT} || { echo "Failed to mount." && exit 1; }