diff --git a/internal/pkg/node/datastructure.go b/internal/pkg/node/datastructure.go index 58a3fda4..df9765c3 100644 --- a/internal/pkg/node/datastructure.go +++ b/internal/pkg/node/datastructure.go @@ -104,7 +104,7 @@ func init() { fmt.Fprintf(c, "nodeprofiles:\n") fmt.Fprintf(c, " default:\n") fmt.Fprintf(c, " comment: This profile is automatically included for each node\n") - fmt.Fprintf(c, " kernel args: crashkernel=no quiet\n") + fmt.Fprintf(c, " kernel args: crashkernel=no vga=791 rootfstype=ramfs quiet\n") fmt.Fprintf(c, "nodes: {}\n") c.Close() diff --git a/overlays/system/default/init.ww b/overlays/system/default/init.ww index 5b568c41..a05f3148 100755 --- a/overlays/system/default/init.ww +++ b/overlays/system/default/init.ww @@ -4,86 +4,36 @@ # know what you are doing and even then you should make a backup. # # Edit at your own risk! DANGER DANGER. -mkdir /newroot -mount wwroot /newroot -t tmpfs -cat </newroot/wwinit -#!/bin/sh -mount -t proc none /proc -mount -t sysfs none /sys +echo "Warewulf v4 is now booting" + +chmod 755 /warewulf/wwinit + +echo "Mounting up kernel file systems" +mkdir /proc /dev /sys /run 2>/dev/null +mount -t proc proc /proc mount -t devtmpfs devtmpfs /dev +mount -t sysfs sysfs /sys +mount -t tmpfs tmpfs /run -# This will eventually be optional -if true; then - if [ -f "/etc/pam.d/system-auth" ]; then - sed -i -e '/^account.*pam_unix\.so\s*$/s/\s*$/\ broken_shadow/' /etc/pam.d/system-auth - fi +echo "Checking for 'rootfstype=ramfs'" +ROOTFSTYPE=`stat -f -c "%T" /` - if [ -f "/etc/pam.d/password-auth" ]; then - sed -i -e '/^account.*pam_unix\.so\s*$/s/\s*$/\ broken_shadow/' /etc/pam.d/password-auth - fi - - if [ -f "/etc/pam.d/common-account" ]; then - sed -i -e '/^account.*pam_unix\.so\s*$/s/\s*$/\ broken_shadow/' /etc/pam.d/common-account - fi +if test "$ROOTFSTYPE" == "ramfs"; then + echo "Running on ramfs, setting up tmpfs" + mkdir /newroot + mount wwroot /newroot -t tmpfs + echo "Moving RAMFS to TMPFS" + tar -cf - --exclude ./proc --exclude ./sys --exclude ./dev --exclude ./newroot . | tar -xf - -C /newroot + mkdir /newroot/proc /newroot/dev /newroot/sys /newroot/run 2>/dev/null + echo "Calling switch_root() and invoking WW Init" + exec /sbin/switch_root /newroot /warewulf/wwinit +else + echo "Running on tmpfs" + echo "Calling WW Init" + exec /warewulf/wwinit fi -/sbin/ip link set dev lo up - -nohup /warewulf/bin/wwclient >/var/log/wwclient.log 2>&1 /var/log/wwclient.log 2>&1 /var/log/ipmi.log 2>&1 /var/log/wwclient.log 2>&1