summaryrefslogtreecommitdiffstats
path: root/remote
diff options
context:
space:
mode:
authorSimon Rettberg2013-08-21 13:43:56 +0200
committerSimon Rettberg2013-08-21 13:45:56 +0200
commitc9c0dffa05c00428595b5ddebbeeb396418d3f65 (patch)
tree66e9e3389b419ecf8f7820724cbd4b76c587d63d /remote
parent[export_target] Fix creation of squashFS (diff)
downloadtm-scripts-c9c0dffa05c00428595b5ddebbeeb396418d3f65.tar.gz
tm-scripts-c9c0dffa05c00428595b5ddebbeeb396418d3f65.tar.xz
tm-scripts-c9c0dffa05c00428595b5ddebbeeb396418d3f65.zip
[remote] Renamed functions to functions.inc; make setup-addons not fail if no addons are configured; try random server order when downloading
Diffstat (limited to 'remote')
-rw-r--r--remote/rootfs/rootfs-stage31/data/etc/functions.inc (renamed from remote/rootfs/rootfs-stage31/data/etc/functions)8
-rwxr-xr-xremote/rootfs/rootfs-stage31/data/init4
-rwxr-xr-xremote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_slx_addons10
3 files changed, 13 insertions, 9 deletions
diff --git a/remote/rootfs/rootfs-stage31/data/etc/functions b/remote/rootfs/rootfs-stage31/data/etc/functions.inc
index 37bb7d89..362943ae 100644
--- a/remote/rootfs/rootfs-stage31/data/etc/functions
+++ b/remote/rootfs/rootfs-stage31/data/etc/functions.inc
@@ -63,11 +63,13 @@ download() {
echo "SLX_KCL_SERVERS='$SLX_KCL_SERVERS'" >> "${FUTURE_ROOT}/opt/openslx/config"
fi
- local FILE_URL="$1"
- local TARGET_PATH="$2"
+ local FILE_URL="$1"
+ local TARGET_PATH="$2"
+
+ local SERVERS=$(for SERVER in $SLX_CONFIG_SERVERS $SLX_KCL_SERVERS; do echo "$RANDOM $SERVER"; done | sort -u | sed -r 's/^[0-9]+ //')
for TIMEOUT in 1 2 3 4 5; do
- for SERVER in $SLX_CONFIG_SERVERS $SLX_KCL_SERVERS; do
+ for SERVER in $SERVERS; do
wget -T 5 -q -O "$TARGET_PATH" "http://${SERVER}/${FILE_URL}"
RET=$?
if [ "x$RET" != "x0" ]; then
diff --git a/remote/rootfs/rootfs-stage31/data/init b/remote/rootfs/rootfs-stage31/data/init
index 35e898b5..db4ef484 100755
--- a/remote/rootfs/rootfs-stage31/data/init
+++ b/remote/rootfs/rootfs-stage31/data/init
@@ -17,7 +17,7 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin
export LD_LIBRARY_PATH=/usr/lib64
# import common functions
-. /etc/functions
+. /etc/functions.inc
# mount the important standard directories
mount -n -t tmpfs -o 'mode=755' run "/run"
@@ -91,7 +91,7 @@ fi
# copy files needed for stage3.2 to FUTURE_ROOT
[ $DEBUG -ge 1 ] && echo "Copying busybox etc. to stage32..."
-tar -cp "/bin" "/sbin" "/usr/bin" "/usr/sbin" "/etc/functions" | tar -xp -C "${FUTURE_ROOT}/opt/openslx/"
+tar -cp "/bin" "/sbin" "/usr/bin" "/usr/sbin" "/etc/functions.inc" | tar -xp -C "${FUTURE_ROOT}/opt/openslx/"
#echo 'blacklist pcspkr' >> /mnt/etc/modprobe.d/blacklist.conf
# one last debug shell if activated
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 a3350424..70a09924 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,12 +6,14 @@
#
#
-. /opt/openslx/etc/functions
+. /opt/openslx/config || { echo "Could not source config!"; exit 23; }
+[ -z "${SLX_ADDONS}" ] && { echo "No addons configured. Nothing to do :-)."; exit 0; }
+
+. /opt/openslx/etc/functions.inc || { echo "functions.inc not found!"; exit 1337; }
+
export FUTURE_ROOT="/"
# read openslx config
-. /opt/openslx/config
-[ -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
@@ -31,7 +33,7 @@ for ADDON in ${SLX_ADDONS}; do
download "${SLX_BASE_PATH}/${ADDON}.sqfs" "${ADDON_TARGET_PATH}"
# now mount it to $SLX_MNT/<addon-name>
- 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; }