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