diff options
author | Simon Rettberg | 2013-06-20 17:18:03 +0200 |
---|---|---|
committer | Simon Rettberg | 2013-06-20 17:18:03 +0200 |
commit | 3037959b37c6cdfd9a2b43ec9b33e9470c0d8f2e (patch) | |
tree | 2bb704ab74c545366cbeda3c32c5ad39bb71e7b4 /remote/rootfs | |
parent | [vmplayer] Wait for host's udhcpc to write DNS servers to config before gener... (diff) | |
download | tm-scripts-3037959b37c6cdfd9a2b43ec9b33e9470c0d8f2e.tar.gz tm-scripts-3037959b37c6cdfd9a2b43ec9b33e9470c0d8f2e.tar.xz tm-scripts-3037959b37c6cdfd9a2b43ec9b33e9470c0d8f2e.zip |
[rootfs-stage31/32] Try to download slxconfig in stage31 already, retry in stage32 if it failed
Diffstat (limited to 'remote/rootfs')
3 files changed, 16 insertions, 6 deletions
diff --git a/remote/rootfs/rootfs-stage31/data/init b/remote/rootfs/rootfs-stage31/data/init index bf11d9aa..586b21df 100755 --- a/remote/rootfs/rootfs-stage31/data/init +++ b/remote/rootfs/rootfs-stage31/data/init @@ -106,10 +106,12 @@ mount -n --move /dev/shm/uniontmp /mnt/uniontmp || drop_shell "Problem moving un [ $DEBUG -ge 2 ] && drop_shell "Requested Debug Shell: after aufs'ing." +# Download config if available +/mnt/opt/openslx/bin/activate-sysconfig /mnt + # create udev rule for nic we booted from cat > "/mnt/etc/udev/rules.d/70-net-boot-nic-name.rules" <<HEREEND -SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="$MAC", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" -SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="$BRIDGEMAC", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="br0" +SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="$MAC", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="br0" HEREEND # create ip config diff --git a/remote/rootfs/rootfs-stage32/data/etc/systemd/system/download-config.service b/remote/rootfs/rootfs-stage32/data/etc/systemd/system/download-config.service index 8807d2ea..e60b28b7 100644 --- a/remote/rootfs/rootfs-stage32/data/etc/systemd/system/download-config.service +++ b/remote/rootfs/rootfs-stage32/data/etc/systemd/system/download-config.service @@ -1,5 +1,6 @@ [Unit] Description=Parse kernel command line for config URL and download +DefaultDependencies=no [Service] Type=oneshot diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/activate-sysconfig b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/activate-sysconfig index fe02d7eb..dbe23b21 100755 --- a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/activate-sysconfig +++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/activate-sysconfig @@ -1,6 +1,12 @@ #!/bin/bash -export PATH=/opt/openslx/bin:/opt/openslx/usr/bin +if [ $# -gt 0 ]; then + CONFIG="$1/opt/openslx/config" +else + CONFIG="/opt/openslx/config" +fi + +[ -e "$CONFIG" ] && grep '^#_RCONFIG_TAG$' "$CONFIG" > /dev/null && echo "Config already fetched." && exit 0 URL="$(grep -o -E "slxconfig=\S+" /proc/cmdline | cut -c 11-)" @@ -9,13 +15,14 @@ if [ -z "$URL" ]; then exit 1 fi -wget -q -O "/opt/openslx/config-remote" "$URL" +wget -T 5 -q -O "${CONFIG}-remote" "$URL" RET=$? if [ "x$RET" != "x0" ]; then echo "Error - downloading '$URL' via wget failed. Exit Code: $RET" exit 1 fi -echo "# Config fetched from $URL" >> "/opt/openslx/config" -cat "/opt/openslx/config-remote" >> "/opt/openslx/config" +echo "# Config fetched from $URL" >> "$CONFIG" +echo "#_RCONFIG_TAG" >> "$CONFIG" +cat "${CONFIG}-remote" >> "$CONFIG" exit 0 |