summaryrefslogtreecommitdiffstats
path: root/modules.d/80test-root/test-init.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 14:01:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 14:01:35 +0000
commite6f2eaf47a177a8eca054d1d70a1b6287e8c3521 (patch)
treec5719e819a9e37df4b54affd61438f382ec38a8f /modules.d/80test-root/test-init.sh
parentAdding upstream version 060+5. (diff)
downloaddracut-e6f2eaf47a177a8eca054d1d70a1b6287e8c3521.tar.xz
dracut-e6f2eaf47a177a8eca054d1d70a1b6287e8c3521.zip
Adding upstream version 102.upstream/102
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'modules.d/80test-root/test-init.sh')
-rwxr-xr-xmodules.d/80test-root/test-init.sh50
1 files changed, 50 insertions, 0 deletions
diff --git a/modules.d/80test-root/test-init.sh b/modules.d/80test-root/test-init.sh
new file mode 100755
index 0000000..bd6e485
--- /dev/null
+++ b/modules.d/80test-root/test-init.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+export PATH=/usr/sbin:/usr/bin:/sbin:/bin
+
+[ -e /proc/self/mounts ] \
+ || (mkdir -p /proc && mount -t proc -o nosuid,noexec,nodev proc /proc)
+
+grep -q '^sysfs /sys sysfs' /proc/self/mounts \
+ || (mkdir -p /sys && mount -t sysfs -o nosuid,noexec,nodev sysfs /sys)
+
+grep -q '^devtmpfs /dev devtmpfs' /proc/self/mounts \
+ || (mkdir -p /dev && mount -t devtmpfs -o mode=755,noexec,nosuid,strictatime devtmpfs /dev)
+
+grep -q '^tmpfs /run tmpfs' /proc/self/mounts \
+ || (mkdir -p /run && mount -t tmpfs -o mode=755,noexec,nosuid,strictatime tmpfs /run)
+
+: > /dev/watchdog
+
+exec > /dev/console 2>&1
+
+if [ -s /failed ]; then
+ echo "**************************FAILED**************************"
+ cat /failed
+ echo "**************************FAILED**************************"
+else
+ echo "dracut-root-block-success" | dd oflag=direct,dsync status=none of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
+ echo "All OK"
+fi
+
+export TERM=linux
+export PS1='initramfs-test:\w\$ '
+[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab
+[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
+stty sane
+echo "made it to the rootfs!"
+
+. /lib/dracut-lib.sh
+
+if getargbool 0 rd.shell; then
+ strstr "$(setsid --help)" "control" && CTTY="-c"
+ # shellcheck disable=SC2086
+ setsid $CTTY sh -i
+fi
+
+echo "Powering down."
+mount -n -o remount,ro /
+if [ -d /run/initramfs/etc ]; then
+ echo " rd.debug=0 " >> /run/initramfs/etc/cmdline
+fi
+poweroff -f