mirror of
https://github.com/dracutdevs/dracut.git
synced 2024-10-27 17:55:47 +03:00
systemd: switch to new initrd.target
(normal startup) : : v basic.target | ______________________/| / | | sysroot.mount | | | v | initrd-root-fs.target | | | v | initrd-parse-etc.service (custom initrd services) | | v | (sysroot-usr.mount and | various mounts marked | with fstab option | x-initrd.mount) | | | v | initrd-fs.target | | \______________________ | \| v initrd.target | v initrd-cleanup.service isolates to initrd-switch-root.target | v ______________________/| / | | initrd-udevadm-cleanup-db.service | | (custom initrd services) | | | \______________________ | \| v initrd-switch-root.target | v initrd-switch-root.service | v switch-root
This commit is contained in:
parent
c853dc72e9
commit
85c85f07e2
@ -11,8 +11,8 @@
|
||||
Description=dracut mount hook
|
||||
Documentation=man:dracut-mount.service(8)
|
||||
DefaultDependencies=no
|
||||
After=dracut-pre-mount.service dracut-initqueue.service initrd-parse-etc.service root-fs.target initrd-fs.target
|
||||
Wants=root-fs.target initrd-fs.target
|
||||
After=initrd-root-fs.target initrd-parse-etc.service
|
||||
|
||||
ConditionPathExists=/etc/initrd-release
|
||||
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/mount
|
||||
ConditionKernelCommandLine=|rd.break=mount
|
||||
|
@ -11,7 +11,7 @@
|
||||
Description=dracut pre-mount hook
|
||||
Documentation=man:dracut-pre-mount.service(8)
|
||||
DefaultDependencies=no
|
||||
Before=sysroot.mount root-fs.target
|
||||
Before=initrd-root-fs.target
|
||||
After=dracut-initqueue.service
|
||||
After=cryptsetup.target
|
||||
ConditionPathExists=/etc/initrd-release
|
||||
|
@ -11,8 +11,7 @@
|
||||
Description=dracut pre-pivot and cleanup hook
|
||||
Documentation=man:dracut-pre-pivot.service(8)
|
||||
DefaultDependencies=no
|
||||
After=dracut-mount.service dracut-initqueue.service initrd-parse-etc.service initrd-fs.target root-fs.target
|
||||
Wants=initrd-fs.target root-fs.target
|
||||
After=initrd-fs.target
|
||||
Before=initrd-cleanup.service
|
||||
ConditionPathExists=/etc/initrd-release
|
||||
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-pivot
|
||||
@ -25,6 +24,7 @@ StandardInput=null
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog+console
|
||||
KillMode=process
|
||||
RemainAfterExit=yes
|
||||
|
||||
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
|
||||
# terminates cleanly.
|
||||
|
@ -17,7 +17,7 @@ Wants=systemd-vconsole-setup.service
|
||||
Environment=HOME=/
|
||||
WorkingDirectory=/
|
||||
ExecStart=/bin/dracut-emergency
|
||||
ExecStopPost=-/usr/bin/systemctl --no-block isolate initrd.target
|
||||
ExecStopPost=-/usr/bin/systemctl --fail --no-block default
|
||||
Type=oneshot
|
||||
StandardInput=tty-force
|
||||
StandardOutput=inherit
|
||||
|
@ -46,8 +46,9 @@ install() {
|
||||
$systemdsystemunitdir/basic.target \
|
||||
$systemdsystemunitdir/halt.target \
|
||||
$systemdsystemunitdir/kexec.target \
|
||||
$systemdsystemunitdir/initrd.target \
|
||||
$systemdsystemunitdir/initrd-fs.target \
|
||||
$systemdsystemunitdir/root-fs.target \
|
||||
$systemdsystemunitdir/initrd-root-fs.target \
|
||||
$systemdsystemunitdir/local-fs.target \
|
||||
$systemdsystemunitdir/local-fs-pre.target \
|
||||
$systemdsystemunitdir/remote-fs.target \
|
||||
@ -148,8 +149,8 @@ install() {
|
||||
|
||||
# install adm user/group for journald
|
||||
dracut_install nologin
|
||||
egrep '^adm:' "$initdir/etc/passwd" 2>/dev/null >> "$initdir/etc/passwd"
|
||||
egrep '^adm:' /etc/group >> "$initdir/etc/group"
|
||||
egrep '^systemd-journal:' "$initdir/etc/passwd" 2>/dev/null >> "$initdir/etc/passwd"
|
||||
egrep '^systemd-journal:' /etc/group >> "$initdir/etc/group"
|
||||
|
||||
ln -fs $systemdutildir/systemd "$initdir/init"
|
||||
ln -fs $systemdutildir/systemd "$initdir/sbin/init"
|
||||
@ -163,15 +164,7 @@ install() {
|
||||
|
||||
mkdir -p "${initdir}${dracutsystemunitdir}/initrd.target.wants"
|
||||
|
||||
mkdir -p "${initdir}${systemdsystemunitdir}/sysinit.target.d"
|
||||
{
|
||||
echo "[Unit]"
|
||||
echo "After="
|
||||
echo "After=emergency.service emergency.target"
|
||||
} > "${initdir}${systemdsystemunitdir}/sysinit.target.d/nolocalfs.conf"
|
||||
|
||||
inst_simple "$moddir/initrd.target" ${dracutsystemunitdir}/initrd.target
|
||||
ln -fs ${dracutsystemunitdir}/initrd.target "${initdir}${systemdsystemunitdir}/default.target"
|
||||
ln -fs initrd.target "${initdir}${systemdsystemunitdir}/default.target"
|
||||
|
||||
inst_script "$moddir/dracut-cmdline.sh" /bin/dracut-cmdline
|
||||
inst_simple "$moddir/dracut-cmdline.service" ${dracutsystemunitdir}/dracut-cmdline.service
|
||||
@ -201,8 +194,6 @@ install() {
|
||||
inst_simple "$moddir/dracut-pre-pivot.service" ${dracutsystemunitdir}/dracut-pre-pivot.service
|
||||
ln -fs ../dracut-pre-pivot.service "${initdir}${dracutsystemunitdir}/initrd.target.wants/dracut-pre-pivot.service"
|
||||
|
||||
ln -fs ../initrd-parse-etc.service "${initdir}${dracutsystemunitdir}/initrd.target.wants/initrd-parse-etc.service"
|
||||
|
||||
inst_rules 99-systemd.rules
|
||||
|
||||
for i in \
|
||||
@ -224,6 +215,5 @@ install() {
|
||||
echo "RateLimitBurst=0"
|
||||
} >> "$initdir/etc/systemd/journald.conf"
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,22 +0,0 @@
|
||||
# This file is part of systemd.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
[Unit]
|
||||
Description=Cleanup udevd DB
|
||||
Documentation=man:udevadm-cleanup-db.service(8)
|
||||
DefaultDependencies=no
|
||||
ConditionPathExists=/etc/initrd-release
|
||||
Conflicts=systemd-udevd.service systemd-udevd-control.socket systemd-udevd-kernel.socket
|
||||
After=systemd-udevd.service systemd-udevd-control.socket systemd-udevd-kernel.socket
|
||||
Before=initrd-switch-root.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=-/usr/bin/udevadm info --cleanup-db
|
||||
StandardInput=null
|
||||
StandardOutput=null
|
||||
StandardError=null
|
@ -220,9 +220,9 @@ write_fs_tab() {
|
||||
[ -z "$_rootfstype" ] && _rootfstype="auto"
|
||||
|
||||
if [ -z "$_rootflags" ]; then
|
||||
_rootflags="ro"
|
||||
_rootflags="ro,x-initrd-rootfs.mount"
|
||||
else
|
||||
_rootflags="ro,$_rootflags"
|
||||
_rootflags="ro,$_rootflags,x-initrd-rootfs.mount"
|
||||
fi
|
||||
|
||||
_rw=0
|
||||
|
Loading…
Reference in New Issue
Block a user