Try to read grml-autoconfig bootparameters from 9p virtio filesystem.
authorUlrich Dangel <mru@grml.org>
Mon, 16 Jan 2012 10:40:12 +0000 (11:40 +0100)
committerUlrich Dangel <mru@grml.org>
Mon, 16 Jan 2012 10:40:12 +0000 (11:40 +0100)
The idea is to share a filesystem with the mount-tag grml-parameters which
will be used to add additional commandline parameters to your system.

autoconfig.functions

index 6e0a6b8..b890f4c 100755 (executable)
@@ -40,6 +40,17 @@ if [ -z "$CMDLINE" ]; then
   CMDLINE="$(cat /proc/cmdline)"
   [ -d /cdrom/bootparams/ ]      && CMDLINE="$CMDLINE $(cat /cdrom/bootparams/* | tr '\n' ' ')"
   [ -d /live/image/bootparams/ ] && CMDLINE="$CMDLINE $(cat /live/image/bootparams/* | tr '\n' ' ')"
+  modprobe 9p 2>/dev/null || true
+  if grep -q 9p /proc/filesystems ; then
+      local TAG="grml-parameters"
+      if grep -q "$TAG" /sys/bus/virtio/devices/*/mount_tag 2>/dev/null ; then
+          local MOUNTDIR="$(mktemp -d)"
+          mount -t 9p -o trans=virtio,ro "$TAG" "$MOUNTDIR"
+          CMDLINE="$CMDLINE $(cat "$MOUNTDIR"/* 2>/dev/null | tr '\n' ' ')"
+          umount "$MOUNTDIR"
+          rmdir "$MOUNTDIR"
+      fi
+  fi
 fi
 # }}}