]>
Commit | Line | Data |
---|---|---|
2c431e8e HH |
1 | #!/bin/bash |
2 | # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- | |
3 | # ex: ts=8 sw=4 sts=4 et filetype=sh | |
4 | ||
8bcfd683 | 5 | # called by dracut |
2c431e8e HH |
6 | check() { |
7 | [[ $mount_needs ]] && return 1 | |
e09048aa | 8 | if [[ -x $systemdutildir/systemd ]]; then |
dc7085ce HH |
9 | SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; }) |
10 | (( $SYSTEMD_VERSION >= 198 )) && return 0 | |
e09048aa | 11 | return 255 |
14b43bca | 12 | fi |
ee876e03 | 13 | |
2c431e8e HH |
14 | return 1 |
15 | } | |
16 | ||
8bcfd683 | 17 | # called by dracut |
2c431e8e HH |
18 | depends() { |
19 | return 0 | |
20 | } | |
21 | ||
31492992 CR |
22 | installkernel() { |
23 | instmods autofs4 ipv6 | |
24 | } | |
25 | ||
8bcfd683 | 26 | # called by dracut |
2c431e8e | 27 | install() { |
727543c1 | 28 | local _mods |
31737a05 | 29 | |
b093aa2d | 30 | if [[ "$prefix" == /run/* ]]; then |
e26d76dc | 31 | dfatal "systemd does not work with a prefix, which contains \"/run\"!!" |
e09048aa HH |
32 | exit 1 |
33 | fi | |
34 | ||
af119460 | 35 | inst_multiple -o \ |
14b43bca HH |
36 | $systemdutildir/systemd \ |
37 | $systemdutildir/systemd-cgroups-agent \ | |
14b43bca | 38 | $systemdutildir/systemd-shutdown \ |
14b43bca HH |
39 | $systemdutildir/systemd-reply-password \ |
40 | $systemdutildir/systemd-fsck \ | |
14b43bca HH |
41 | $systemdutildir/systemd-udevd \ |
42 | $systemdutildir/systemd-journald \ | |
2242cd92 | 43 | $systemdutildir/systemd-sysctl \ |
569ffe77 | 44 | $systemdutildir/systemd-modules-load \ |
f13deabd | 45 | $systemdutildir/systemd-vconsole-setup \ |
dbfaae0e HH |
46 | $systemdutildir/system-generators/systemd-fstab-generator \ |
47 | $systemdsystemunitdir/cryptsetup.target \ | |
14b43bca HH |
48 | $systemdsystemunitdir/emergency.target \ |
49 | $systemdsystemunitdir/sysinit.target \ | |
50 | $systemdsystemunitdir/basic.target \ | |
51 | $systemdsystemunitdir/halt.target \ | |
52 | $systemdsystemunitdir/kexec.target \ | |
85c85f07 | 53 | $systemdsystemunitdir/initrd.target \ |
c85cda9e | 54 | $systemdsystemunitdir/initrd-fs.target \ |
85c85f07 | 55 | $systemdsystemunitdir/initrd-root-fs.target \ |
14b43bca HH |
56 | $systemdsystemunitdir/local-fs.target \ |
57 | $systemdsystemunitdir/local-fs-pre.target \ | |
58 | $systemdsystemunitdir/remote-fs.target \ | |
59 | $systemdsystemunitdir/remote-fs-pre.target \ | |
60 | $systemdsystemunitdir/network.target \ | |
61 | $systemdsystemunitdir/nss-lookup.target \ | |
62 | $systemdsystemunitdir/nss-user-lookup.target \ | |
63 | $systemdsystemunitdir/poweroff.target \ | |
64 | $systemdsystemunitdir/reboot.target \ | |
65 | $systemdsystemunitdir/rescue.target \ | |
66 | $systemdsystemunitdir/rpcbind.target \ | |
67 | $systemdsystemunitdir/shutdown.target \ | |
68 | $systemdsystemunitdir/final.target \ | |
69 | $systemdsystemunitdir/sigpwr.target \ | |
70 | $systemdsystemunitdir/sockets.target \ | |
71 | $systemdsystemunitdir/swap.target \ | |
bfac4066 HH |
72 | $systemdsystemunitdir/timers.target \ |
73 | $systemdsystemunitdir/paths.target \ | |
f13deabd | 74 | $systemdsystemunitdir/umount.target \ |
d988dc30 HH |
75 | $systemdsystemunitdir/kmod-static-nodes.service \ |
76 | $systemdsystemunitdir/systemd-tmpfiles-setup-dev.service \ | |
14b43bca | 77 | $systemdsystemunitdir/systemd-ask-password-console.path \ |
99548764 | 78 | $systemdsystemunitdir/systemd-udevd-control.socket \ |
99548764 | 79 | $systemdsystemunitdir/systemd-udevd-kernel.socket \ |
14b43bca HH |
80 | $systemdsystemunitdir/systemd-ask-password-plymouth.path \ |
81 | $systemdsystemunitdir/systemd-journald.socket \ | |
14b43bca | 82 | $systemdsystemunitdir/systemd-ask-password-console.service \ |
569ffe77 | 83 | $systemdsystemunitdir/systemd-modules-load.service \ |
27a2c3a4 | 84 | $systemdsystemunitdir/systemd-halt.service \ |
27a2c3a4 | 85 | $systemdsystemunitdir/systemd-poweroff.service \ |
792b1893 | 86 | $systemdsystemunitdir/systemd-reboot.service \ |
27a2c3a4 | 87 | $systemdsystemunitdir/systemd-kexec.service \ |
27a2c3a4 | 88 | $systemdsystemunitdir/systemd-fsck@.service \ |
99548764 | 89 | $systemdsystemunitdir/systemd-udevd.service \ |
b4e20a89 HH |
90 | $systemdsystemunitdir/systemd-udev-trigger.service \ |
91 | $systemdsystemunitdir/systemd-udev-settle.service \ | |
14b43bca HH |
92 | $systemdsystemunitdir/systemd-ask-password-plymouth.service \ |
93 | $systemdsystemunitdir/systemd-journald.service \ | |
94 | $systemdsystemunitdir/systemd-vconsole-setup.service \ | |
5d68c80b | 95 | $systemdsystemunitdir/systemd-random-seed-load.service \ |
d988dc30 | 96 | \ |
14b43bca HH |
97 | $systemdsystemunitdir/sysinit.target.wants/systemd-modules-load.service \ |
98 | $systemdsystemunitdir/sysinit.target.wants/systemd-ask-password-console.path \ | |
99 | $systemdsystemunitdir/sysinit.target.wants/systemd-journald.service \ | |
99548764 | 100 | $systemdsystemunitdir/sockets.target.wants/systemd-udevd-control.socket \ |
99548764 | 101 | $systemdsystemunitdir/sockets.target.wants/systemd-udevd-kernel.socket \ |
14b43bca | 102 | $systemdsystemunitdir/sockets.target.wants/systemd-journald.socket \ |
99548764 | 103 | $systemdsystemunitdir/sysinit.target.wants/systemd-udevd.service \ |
b4e20a89 | 104 | $systemdsystemunitdir/sysinit.target.wants/systemd-udev-trigger.service \ |
d988dc30 HH |
105 | $systemdsystemunitdir/sysinit.target.wants/kmod-static-nodes.service \ |
106 | $systemdsystemunitdir/sysinit.target.wants/systemd-tmpfiles-setup-dev.service \ | |
cbd69dc6 | 107 | \ |
14b43bca | 108 | $systemdsystemunitdir/ctrl-alt-del.target \ |
14b43bca | 109 | $systemdsystemunitdir/syslog.socket \ |
14b43bca HH |
110 | $systemdsystemunitdir/initrd-switch-root.target \ |
111 | $systemdsystemunitdir/initrd-switch-root.service \ | |
dbfaae0e HH |
112 | $systemdsystemunitdir/initrd-cleanup.service \ |
113 | $systemdsystemunitdir/initrd-udevadm-cleanup-db.service \ | |
114 | $systemdsystemunitdir/initrd-parse-etc.service \ | |
cbd69dc6 | 115 | \ |
f13deabd HH |
116 | $systemdsystemunitdir/slices.target \ |
117 | $systemdsystemunitdir/system.slice \ | |
68cb510f | 118 | \ |
d124904f | 119 | journalctl systemctl echo swapoff systemd-cgls systemd-tmpfiles |
806572d0 | 120 | |
af119460 | 121 | inst_multiple -o \ |
b8060ef7 HH |
122 | /usr/lib/modules-load.d/*.conf \ |
123 | /usr/lib/sysctl.d/*.conf | |
569ffe77 | 124 | |
727543c1 HH |
125 | modules_load_get() { |
126 | local _line i | |
127 | for i in "$1"/*.conf; do | |
128 | [[ -f $i ]] || continue | |
129 | while read _line; do | |
130 | case $_line in | |
131 | \#*) | |
132 | ;; | |
133 | \;*) | |
134 | ;; | |
135 | *) | |
136 | echo $_line | |
137 | esac | |
138 | done < "$i" | |
139 | done | |
140 | } | |
141 | ||
142 | _mods=$(modules_load_get /usr/lib/modules-load.d) | |
143 | [[ $_mods ]] && instmods $_mods | |
144 | ||
ee876e03 | 145 | if [[ $hostonly ]]; then |
af119460 | 146 | inst_multiple -o \ |
569ffe77 | 147 | /etc/systemd/journald.conf \ |
ee876e03 HH |
148 | /etc/systemd/system.conf \ |
149 | /etc/hostname \ | |
150 | /etc/machine-id \ | |
151 | /etc/vconsole.conf \ | |
b8060ef7 HH |
152 | /etc/locale.conf \ |
153 | /etc/modules-load.d/*.conf \ | |
154 | /etc/sysctl.d/*.conf \ | |
155 | /etc/sysctl.conf | |
569ffe77 | 156 | |
727543c1 HH |
157 | _mods=$(modules_load_get /etc/modules-load.d) |
158 | [[ $_mods ]] && instmods $_mods | |
bf9cdc47 HH |
159 | fi |
160 | ||
161 | if ! [[ -e "$initdir/etc/machine-id" ]]; then | |
162 | > "$initdir/etc/machine-id" | |
ee876e03 HH |
163 | fi |
164 | ||
d04f16f6 | 165 | # install adm user/group for journald |
af119460 | 166 | inst_multiple nologin |
85c85f07 HH |
167 | egrep '^systemd-journal:' "$initdir/etc/passwd" 2>/dev/null >> "$initdir/etc/passwd" |
168 | egrep '^systemd-journal:' /etc/group >> "$initdir/etc/group" | |
d04f16f6 | 169 | |
256c91f8 HH |
170 | ln_r $systemdutildir/systemd "/init" |
171 | ln_r $systemdutildir/systemd "/sbin/init" | |
14b43bca | 172 | |
dbfaae0e HH |
173 | inst_script "$moddir/dracut-emergency.sh" /bin/dracut-emergency |
174 | inst_simple "$moddir/emergency.service" ${systemdsystemunitdir}/emergency.service | |
2242cd92 | 175 | inst_simple "$moddir/dracut-emergency.service" ${systemdsystemunitdir}/dracut-emergency.service |
dbfaae0e | 176 | inst_simple "$moddir/emergency.service" ${systemdsystemunitdir}/rescue.service |
bef2fd97 | 177 | |
256c91f8 | 178 | ln_r "${systemdsystemunitdir}/initrd.target" "${systemdsystemunitdir}/default.target" |
f653c862 | 179 | |
53fe81e7 | 180 | inst_script "$moddir/dracut-cmdline.sh" /bin/dracut-cmdline |
53fe81e7 | 181 | inst_script "$moddir/dracut-pre-udev.sh" /bin/dracut-pre-udev |
53fe81e7 | 182 | inst_script "$moddir/dracut-pre-trigger.sh" /bin/dracut-pre-trigger |
53fe81e7 | 183 | inst_script "$moddir/dracut-initqueue.sh" /bin/dracut-initqueue |
dbfaae0e | 184 | inst_script "$moddir/dracut-pre-mount.sh" /bin/dracut-pre-mount |
dbfaae0e | 185 | inst_script "$moddir/dracut-mount.sh" /bin/dracut-mount |
53fe81e7 | 186 | inst_script "$moddir/dracut-pre-pivot.sh" /bin/dracut-pre-pivot |
14b43bca | 187 | |
ac5bff2b HH |
188 | inst_script "$moddir/rootfs-generator.sh" /lib/systemd/system-generators/dracut-rootfs-generator |
189 | ||
8229d06b HH |
190 | inst_binary true |
191 | ln_r $(type -P true) "/usr/bin/loginctl" | |
192 | ln_r $(type -P true) "/bin/loginctl" | |
a0cab31a | 193 | inst_rules 71-seat.rules 73-seat-late.rules 99-systemd.rules |
528ae4f4 | 194 | |
6b095274 HH |
195 | for i in \ |
196 | emergency.target \ | |
197 | dracut-emergency.service \ | |
198 | rescue.service \ | |
199 | systemd-ask-password-console.service \ | |
200 | systemd-ask-password-plymouth.service \ | |
201 | ; do | |
373efa44 | 202 | mkdir -p "${initdir}${systemdsystemunitdir}/${i}.wants" |
6b095274 | 203 | ln_r "${systemdsystemunitdir}/systemd-vconsole-setup.service" \ |
373efa44 HH |
204 | "${systemdsystemunitdir}/${i}.wants/systemd-vconsole-setup.service" |
205 | done | |
206 | ||
207 | mkdir -p "${initdir}/$systemdsystemunitdir/initrd.target.wants" | |
208 | for i in \ | |
209 | dracut-cmdline.service \ | |
210 | dracut-initqueue.service \ | |
211 | dracut-mount.service \ | |
212 | dracut-pre-mount.service \ | |
213 | dracut-pre-pivot.service \ | |
214 | dracut-pre-trigger.service \ | |
215 | dracut-pre-udev.service \ | |
216 | ; do | |
217 | inst_simple "$moddir/${i}" "$systemdsystemunitdir/${i}" | |
218 | ln_r "$systemdsystemunitdir/${i}" "$systemdsystemunitdir/initrd.target.wants/${i}" | |
6b095274 HH |
219 | done |
220 | ||
4961910f | 221 | mkdir -p "$initdir/etc/systemd" |
528ae4f4 HH |
222 | # turn off RateLimit for journal |
223 | { | |
224 | echo "[Journal]" | |
225 | echo "RateLimitInterval=0" | |
226 | echo "RateLimitBurst=0" | |
227 | } >> "$initdir/etc/systemd/journald.conf" | |
228 | ||
2c431e8e HH |
229 | } |
230 |