inst_hook pre-pivot 20 "$moddir/apply-live-updates.sh"
inst_script "$moddir/dmsquash-live-root.sh" "/sbin/dmsquash-live-root"
inst_script "$moddir/iso-scan.sh" "/sbin/iso-scan"
+ inst_script "$moddir/dmsquash-generator.sh" $systemdutildir/system-generators/dracut-dmsquash-generator
# should probably just be generally included
inst_rules 60-cdrom_id.rules
inst_simple "$moddir/checkisomd5@.service" "/etc/systemd/system/checkisomd5@.service"
liveroot=$root
fi
-[ "${liveroot%%:*}" = "live" ] || return
+[ "${liveroot%%:*}" = "live" ] || return 1
modprobe -q loop
live:/*.[Ii][Mm][Gg]|/*.[Ii][Mm][Gg])
[ -f "${root#live:}" ] && rootok=1 ;;
esac
+
+[ "$rootok" = "1" ] || return 1
+
info "root was $liveroot, is now $root"
# make sure that init doesn't complain
[ -z "$root" ] && root="live"
wait_for_dev -n /dev/mapper/live-rw
+
+return 0
fi
_name=$(dev_unit_name "$1")
- if ! [ -L /run/systemd/generator/initrd.target.wants/${_name}.device ]; then
- [ -d /run/systemd/generator/initrd.target.wants ] || mkdir -p /run/systemd/generator/initrd.target.wants
- ln -s ../${_name}.device /run/systemd/generator/initrd.target.wants/${_name}.device
+ if ! [ -L "$GENERATOR_DIR"/initrd.target.wants/${_name}.device ]; then
+ [ -d "$GENERATOR_DIR"/initrd.target.wants ] || mkdir -p "$GENERATOR_DIR"/initrd.target.wants
+ ln -s ../${_name}.device "$GENERATOR_DIR"/initrd.target.wants/${_name}.device
fi
- if ! [ -f /run/systemd/generator/${_name}.device.d/timeout.conf ]; then
- mkdir -p /run/systemd/generator/${_name}.device.d
+ if ! [ -f "$GENERATOR_DIR"/${_name}.device.d/timeout.conf ]; then
+ mkdir -p "$GENERATOR_DIR"/${_name}.device.d
{
echo "[Unit]"
echo "JobTimeoutSec=$_timeout"
- } > /run/systemd/generator/${_name}.device.d/timeout.conf
+ } > "$GENERATOR_DIR"/${_name}.device.d/timeout.conf
fi
}
[ -z "$1" ] && return 0
_name=$(dev_unit_name "$1")
- [ -d /run/systemd/generator ] || mkdir -p /run/systemd/generator
- if ! [ -f /run/systemd/generator/sysroot.mount ]; then
+ [ -d "$GENERATOR_DIR" ] || mkdir -p "$GENERATOR_DIR"
+ if ! [ -f "$GENERATOR_DIR"/sysroot.mount ]; then
{
echo "[Unit]"
echo "Before=initrd-root-fs.target"
echo "What=$1"
echo "Options=${_flags}"
echo "Type=${_type}"
- } > /run/systemd/generator/sysroot.mount
+ } > "$GENERATOR_DIR"/sysroot.mount
fi
- if ! [ -L /run/systemd/generator/initrd-root-fs.target.requires/sysroot.mount ]; then
- [ -d /run/systemd/generator/initrd-root-fs.target.requires ] || mkdir -p /run/systemd/generator/initrd-root-fs.target.requires
- ln -s ../sysroot.mount /run/systemd/generator/initrd-root-fs.target.requires/sysroot.mount
+ if ! [ -L "$GENERATOR_DIR"/initrd-root-fs.target.requires/sysroot.mount ]; then
+ [ -d "$GENERATOR_DIR"/initrd-root-fs.target.requires ] || mkdir -p "$GENERATOR_DIR"/initrd-root-fs.target.requires
+ ln -s ../sysroot.mount "$GENERATOR_DIR"/initrd-root-fs.target.requires/sysroot.mount
fi
}
rootok=1 ;;
esac
+GENERATOR_DIR="$1"
+
if [ "${root%%:*}" = "block" ]; then
generator_wait_for_dev "${root#block:}" "$RDRETRY"
strstr "$(cat /proc/cmdline)" 'root=' || generator_mount_rootfs "${root#block:}" "$(getarg rootfstype=)" "$(getarg rootflags=)"