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