summaryrefslogtreecommitdiffstats
path: root/remote
diff options
context:
space:
mode:
authorSimon Rettberg2013-05-29 17:19:27 +0200
committerSimon Rettberg2013-05-29 17:19:27 +0200
commitf1c4c48b1759e835720ef4472b05a9eecc9b0e17 (patch)
tree08f94175759ecd65c03850a8203828d09d7db671 /remote
parentMerge branch 'master' of git:openslx-ng/tm-scripts (diff)
downloadtm-scripts-f1c4c48b1759e835720ef4472b05a9eecc9b0e17.tar.gz
tm-scripts-f1c4c48b1759e835720ef4472b05a9eecc9b0e17.tar.xz
tm-scripts-f1c4c48b1759e835720ef4472b05a9eecc9b0e17.zip
Write network config from stage31 and stage32's udhcpd to /opt/openslx/config
Diffstat (limited to 'remote')
-rwxr-xr-xremote/rootfs/rootfs-stage31/data/init21
-rwxr-xr-xremote/rootfs/rootfs-stage32/data/etc/openslx/udhcpc.openslx.script4
-rwxr-xr-xremote/rootfs/rootfs-stage32/data/opt/openslx/bin/activate-sysconfig4
3 files changed, 20 insertions, 9 deletions
diff --git a/remote/rootfs/rootfs-stage31/data/init b/remote/rootfs/rootfs-stage31/data/init
index e5251025..32903439 100755
--- a/remote/rootfs/rootfs-stage31/data/init
+++ b/remote/rootfs/rootfs-stage31/data/init
@@ -55,18 +55,13 @@ for opts in ${KCL}; do
ip=*)
# process IP info
export IPINFO=${opts#ip=} ;;
- nfs=*)
- export NFS=${opts#nfs=}
- export NFSPATH=${nfs#*:}
- export NFSSERVER=${nfs%:/*}
- ;;
BOOTIF=*)
export MAC="$( echo "$opts" | cut -b 11- | tr '-' ':' )" ;;
esac
done
# suppress kernel output if DEBUG is not set
-[ $DEBUG -ge 1 ] && echo "0" >/proc/sys/kernel/printk
+[ "$DEBUG" -ge 1 ] && echo "0" >/proc/sys/kernel/printk || echo "4 4 1 7" >/proc/sys/kernel/printk
# start plymouth if activated
if [ "x$SPLASH" == "x1" -a "x$DEBUG" != "x1" ]; then
@@ -78,8 +73,8 @@ fi
mkdir -p /dev/shm/union /dev/shm/uniontmp /rorootfs
mount -n -t tmpfs none /dev/shm/uniontmp
-echo "Setup networking..."
-/bin/setup_network
+echo "Setup networking..." # Source script so the variables are still available to us
+. "/bin/setup_network" || echo "Error setting up network"
# mount rootfs
if [ -n "$NFS" ]; then
@@ -104,6 +99,16 @@ mount -n --move /dev/shm/uniontmp /mnt/uniontmp
# create udev rule for nic we booted from
echo 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="'$MAC'", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"' > "/mnt/etc/udev/rules.d/70-net-boot-nic-name.rules"
+# create ip config
+cat >> /mnt/opt/openslx/config <<HEREEND
+# IP Config written in stage31
+SLX_PXE_CLIENT_IP='$clientip'
+SLX_PXE_SERVER_IP='$serverip'
+SLX_PXE_GATEWAY='$gateway'
+SLX_PXE_DNS='$dns_srv'
+SLX_PXE_MAC='$MAC'
+HEREEND
+
for mnt in proc sys run ; do
umount -n $mnt
done
diff --git a/remote/rootfs/rootfs-stage32/data/etc/openslx/udhcpc.openslx.script b/remote/rootfs/rootfs-stage32/data/etc/openslx/udhcpc.openslx.script
index 444dc52c..b42549cc 100755
--- a/remote/rootfs/rootfs-stage32/data/etc/openslx/udhcpc.openslx.script
+++ b/remote/rootfs/rootfs-stage32/data/etc/openslx/udhcpc.openslx.script
@@ -64,6 +64,10 @@ search lp.ruf.uni-freiburg.de
[ "x$(grep -ci mount /proc/cmdline)" != "x0" ] && systemctl start nfs-mount.service
# Always mount virtlib directory
systemctl start var-lib-virt.service
+ # Write to openslx-config
+ echo "# Config written by openslx-dhcp-script" >> /opt/openslx/config
+ echo "SLX_DNS='$dns'" >> /opt/openslx/config
+ echo "SLX_HOSTNAME='$(hostname)'" >> /opt/openslx/config
;;
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 e50111ae..fe02d7eb 100755
--- a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/activate-sysconfig
+++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/activate-sysconfig
@@ -9,11 +9,13 @@ if [ -z "$URL" ]; then
exit 1
fi
-wget -q -O "/opt/openslx/config" "$URL"
+wget -q -O "/opt/openslx/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"
exit 0