Convert ramfs to tmpfs and jump through the required hoops...

This commit is contained in:
Gregory Kurtzer
2020-12-20 01:17:37 -08:00
parent 4c655e82b2
commit 20109cee73

View File

@@ -4,10 +4,62 @@
# 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 <<EOF >/newroot/wwinit
#!/bin/sh
mount -t proc none /proc
mount -t sysfs none /sys
mount -t devtmpfs devtmpfs /dev
# 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
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
fi
/sbin/ip link set dev lo up
nohup /warewulf/bin/wwclient >/var/log/wwclient.log 2>&1 </dev/null &
if test -x /sbin/load_policy && test -x /sbin/restorecon; then
/sbin/load_policy -i
/sbin/restorecon -r /
fi
echo "Calling {{$.Init}}..."
echo
rm /wwinit
chmod 755 /
sleep 2
exec {{$.Init}}
EOF
chmod 755 /newroot/wwinit
tar -cf - --exclude /proc --exclude /sys --exclude /dev --exclude /newroot . | tar -xf - -C /newroot
mount proc /proc -t proc
exec /sbin/switch_root /newroot /wwinit
echo "Warewulf v4 is now booting"
/bin/bash
# Considering what to do if we are operating on a read only root
if false; then
@@ -25,27 +77,6 @@ if false; then
fi
# 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
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
fi
mount -t proc none /proc
mount -t sysfs none /sys
mount -t devtmpfs devtmpfs /dev
/sbin/ip link set dev lo up
nohup /warewulf/bin/wwclient >/var/log/wwclient.log 2>&1 </dev/null &
nohup /ipmi >/var/log/ipmi.log 2>&1 </dev/null &