inst_script "${dracutbasedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
inst_script "${dracutbasedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
+ inst_script "$moddir/test-init.sh" "/test-init.sh"
+
inst_multiple -o plymouth
}
--- /dev/null
+#!/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 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
#!/bin/sh
-: > /dev/watchdog
-. /lib/dracut-lib.sh
-
-export PATH=/usr/sbin:/usr/bin:/sbin:/bin
-command -v plymouth > /dev/null 2>&1 && plymouth --quit
-exec > /dev/console 2>&1
-
-echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
-
-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!"
-if getargbool 0 rd.shell; then
- strstr "$(setsid --help)" "control" && CTTY="-c"
- setsid $CTTY sh -i
-fi
-echo "Powering down."
-mount -n -o remount,ro /
-poweroff -f
+. /test-init.sh
#!/bin/sh
-: > /dev/watchdog
-. /lib/dracut-lib.sh
-
-export PATH=/usr/sbin:/usr/bin:/sbin:/bin
-command -v plymouth > /dev/null 2>&1 && plymouth --quit
-exec > /dev/console 2>&1
-
-echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
-
-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!"
-if getargbool 0 rd.shell; then
- strstr "$(setsid --help)" "control" && CTTY="-c"
- setsid $CTTY sh -i
-fi
-echo "Powering down."
-mount -n -o remount,ro /
-poweroff -f
+. /test-init.sh
#!/bin/sh
-: > /dev/watchdog
-. /lib/dracut-lib.sh
-
-export PATH=/usr/sbin:/usr/bin:/sbin:/bin
-command -v plymouth > /dev/null 2>&1 && plymouth --quit
-exec > /dev/console 2>&1
-
-echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
-
-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!"
-if getargbool 0 rd.shell; then
- strstr "$(setsid --help)" "control" && CTTY="-c"
- setsid $CTTY sh -i
-fi
-echo "Powering down."
-mount -n -o remount,ro /
-poweroff -f
+. /test-init.sh
#!/bin/sh
: > /dev/watchdog
-. /lib/dracut-lib.sh
-
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
command -v plymouth > /dev/null 2>&1 && plymouth --quit
exec > /dev/console 2>&1
systemctl --failed --no-legend --no-pager > /failed
+ismounted() {
+ findmnt "$1" > /dev/null 2>&1
+}
+
if ! ismounted /usr; then
echo "**************************FAILED**************************"
echo "/usr not mounted!!"
- cat /proc/mounts
+ cat /proc/mounts >> /failed
echo "**************************FAILED**************************"
-else
- if [ -s /failed ]; then
- echo "**************************FAILED**************************"
- cat /failed
- echo "**************************FAILED**************************"
-
- else
- echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
- echo "All OK"
- fi
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!"
-if getargbool 0 rd.shell; then
- strstr "$(setsid --help)" "control" && CTTY="-c"
- setsid $CTTY sh -i
-fi
-echo "Powering down."
-poweroff -f
+. /test-init.sh
"$DRACUT" -l --keep --tmpdir "$TESTDIR" \
-m "test-root systemd" \
-i ./test-init.sh /sbin/test-init \
+ -I "findmnt" \
-i ./fstab /etc/fstab \
--no-hostonly --no-hostonly-cmdline --nomdadmconf --nohardlink \
-f "$TESTDIR"/initramfs.root "$KVERSION" || return 1
#!/bin/sh
-: > /dev/watchdog
-. /lib/dracut-lib.sh
-
-export PATH=/usr/sbin:/usr/bin:/sbin:/bin
-command -v plymouth > /dev/null 2>&1 && plymouth --quit
-exec > /dev/console 2>&1
-
-echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
-
-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!"
-if getargbool 0 rd.shell; then
- strstr "$(setsid --help)" "control" && CTTY="-c"
- setsid $CTTY sh -i
-fi
-echo "Powering down."
-mount -n -o remount,ro /
-poweroff -f
+. /test-init.sh
#!/bin/sh
-: > /dev/watchdog
-. /lib/dracut-lib.sh
-
-export PATH=/usr/sbin:/usr/bin:/sbin:/bin
-command -v plymouth > /dev/null 2>&1 && plymouth --quit
-exec > /dev/console 2>&1
-
-echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
-
-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!"
-if getargbool 0 rd.shell; then
- strstr "$(setsid --help)" "control" && CTTY="-c"
- setsid $CTTY sh -i
-fi
-echo "Powering down."
-mount -n -o remount,ro /
-poweroff -f
+. /test-init.sh
#!/bin/sh
-: > /dev/watchdog
-. /lib/dracut-lib.sh
-
-export PATH=/usr/sbin:/usr/bin:/sbin:/bin
-command -v plymouth > /dev/null 2>&1 && plymouth --quit
-exec > /dev/console 2>&1
-
-echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
-
-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!"
-if getargbool 0 rd.shell; then
- strstr "$(setsid --help)" "control" && CTTY="-c"
- 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
+. /test-init.sh
#!/bin/sh
-: > /dev/watchdog
-. /lib/dracut-lib.sh
-
-export PATH=/usr/sbin:/usr/bin:/sbin:/bin
-command -v plymouth > /dev/null 2>&1 && plymouth --quit
-exec > /dev/console 2>&1
-
-echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
-
-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!"
-if getargbool 0 rd.shell; then
- strstr "$(setsid --help)" "control" && CTTY="-c"
- 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
+. /test-init.sh
#!/bin/sh
-: > /dev/watchdog
-. /lib/dracut-lib.sh
-
-export PATH=/usr/sbin:/usr/bin:/sbin:/bin
-command -v plymouth > /dev/null 2>&1 && plymouth --quit
-exec > /dev/console 2>&1
-
-echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
-
-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!"
-if getargbool 0 rd.shell; then
- strstr "$(setsid --help)" "control" && CTTY="-c"
- 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
+. /test-init.sh
#!/bin/sh
-: > /dev/watchdog
-. /lib/dracut-lib.sh
-
-export PATH=/usr/sbin:/usr/bin:/sbin:/bin
-command -v plymouth > /dev/null 2>&1 && plymouth --quit
-exec > /dev/console 2>&1
-
-echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
-
-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!"
-if getargbool 0 rd.shell; then
- strstr "$(setsid --help)" "control" && CTTY="-c"
- setsid $CTTY sh -i
-fi
-echo "Powering down."
-mount -n -o remount,ro /
-
-poweroff -f
+. /test-init.sh
#!/bin/sh
-: > /dev/watchdog
-
-. /lib/dracut-lib.sh
-
-export PATH=/usr/sbin:/usr/bin:/sbin:/bin
-command -v plymouth > /dev/null 2>&1 && plymouth --quit
-exec > /dev/console 2>&1
-
-echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
if grep -qF ' rd.live.overlay=LABEL=persist ' /proc/cmdline; then
# Writing to a file in the root filesystem lets test_run() verify that the autooverlay module successfully created
echo "dracut-autooverlay-success" > /overlay-marker
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!"
-if getargbool 0 rd.shell; then
- strstr "$(setsid --help)" "control" && CTTY="-c"
- setsid $CTTY sh -i
-fi
-echo "Powering down."
-mount -n -o remount,ro /
-
-poweroff -f
+. /test-init.sh
#!/bin/sh
-: > /dev/watchdog
-. /lib/dracut-lib.sh
-
-export PATH=/usr/sbin:/usr/bin:/sbin:/bin
-command -v plymouth > /dev/null 2>&1 && plymouth --quit
-exec > /dev/console 2>&1
-
-echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
-
-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!"
-if getargbool 0 rd.shell; then
- strstr "$(setsid --help)" "control" && CTTY="-c"
- setsid $CTTY sh -i
-fi
-echo "Powering down."
-mount -n -o remount,ro /
-poweroff -f
+. /test-init.sh
#!/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
-
-echo "made it to the rootfs! Powering down."
-echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
-poweroff -f
+. /test-init.sh