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