8 #XXX: fix installation of /usr/lib/tmpfileS.d/{dracut-tmpfiles,systemd}.conf
9 #XXX: should be removed when bug 18642 (mageia) or 1343230 (fedora) will be fixed in /usr/bin/dracut +1262-1282
10 [ -z "$tmpfilesdir" -o ! -d "$tmpfilesdir" -a -d /usr
/lib
/tmpfiles.d
] && tmpfilesdir
=/usr
/lib
/tmpfiles.d
11 [ -z "$tmpfilesdir" -o ! -d "$tmpfilesdir" -a -d /etc
/tmpfiles.d
] && tmpfilesdir
=/etc
/tmpfiles.d
12 [ -z "$tmpfilesdir" -o ! -d "$tmpfilesdir" -a -d /lib
/tmpfiles.d
] && tmpfilesdir
=/lib
/tmpfiles.d
14 # if cryptsetup is not installed, then we cannot support encrypted devices.
15 require_binaries cryptsetup
|| return 1
17 # if hostonly or mount_needs include if required by other module
18 # if one of fs types is crypto_LUKS include it
19 [[ $hostonly ]] || [[ $mount_needs ]] && {
20 for fs
in "${host_fs_types[@]}"; do
21 [[ $fs = "crypto_LUKS" ]] && return 0
31 # depend on crypt for /etc/crypttab
32 # depend on systemd-networkd for ip=dhcp and rd.neednet=1
33 # depend on dracut-systemd for appending to $tmpfilesdir/dracut-tmpfiles.conf
34 echo crypt systemd
-networkd dracut
-systemd
41 for fs
in "${host_fs_types[@]}"; do
42 if [[ "$fs" == "crypto_LUKS" ]]; then
43 printf "%s" " ip=dhcp rd.neednet=1"
51 local _ihttpdconf
=$(cmdline)
53 [[ $_ihttpdconf ]] && printf "%s\n" "$_ihttpdconf" >> "${initdir}/etc/cmdline.d/99ihttpd.conf"
56 inst_dir
/etc
/pki
/tls
/certs
57 inst_dir
/etc
/pki
/tls
/private
58 inst_dir
/etc
/systemd
/network
59 inst_dir
/var
/www
/html
60 inst_dir
$systemdsystemunitdir/ihttpd.service.wants
63 inst_simple
-o /var
/www
/html
/favicon.ico
66 for nc
in `ls /etc/systemd/network/`; do
67 inst_simple
/etc
/systemd
/network
/$nc
71 inst_simple
/usr
/lib
/ihttpd
/index.bin
/var
/www
/html
/index.bin
74 inst_simple
/usr
/lib
/ihttpd
/reboot.bin
/var
/www
/html
/reboot.bin
83 /etc
/pki
/tls
/certs
/ihttpd.pem \
84 /etc
/pki
/tls
/private
/ihttpd.pem \
85 $tmpfilesdir/ihttpd.conf \
86 $systemdsystemunitdir/ihttpd.path \
87 $systemdsystemunitdir/ihttpd.service \
88 $systemdsystemunitdir/systemd
-networkd.service \
89 $systemdsystemunitdir/systemd
-tmpfiles-setup.service \
95 ln -fs ..
/ihttpd.path
$initdir$systemdsystemunitdir/sysinit.target.wants
/
97 # Install resolv.conf as resolved service
98 #TODO: change this to have a content or depend on systemd-resolved
99 if [ -L /etc
/resolv.conf
]; then
101 # Install systemd-resolved
102 if [ `readlink /etc/resolv.conf` = '/run/systemd/resolve/resolv.conf' ]; then
104 # Install resolv.conf as symlink
105 ln -fs '/run/systemd/resolve/resolv.conf' $initdir/etc
/resolv.conf
107 # Install systemd-resolved
109 $systemdsystemunitdir/systemd
-resolved.service \
110 $systemdutildir/systemd
-resolved \
111 /etc
/systemd
/resolved.conf
113 # Require systemd-resolve user and group for our ihttpd process
114 `egrep -q '^systemd-resolve:' $initdir/etc/group` || egrep '^systemd-resolve:' /etc
/group
>> "$initdir/etc/group"
115 `egrep -q '^systemd-resolve:' $initdir/etc/passwd` || egrep '^systemd-resolve:' /etc
/passwd
>> "$initdir/etc/passwd"
117 # Install in ihttpd.service.wants
118 ln -fs ..
/systemd
-resolved.service
$initdir$systemdsystemunitdir/ihttpd.service.wants
/
120 # Cleanup resolved.conf
121 perl
-pne 'undef $_ if /^(?:#.*|Domains=|FallbackDNS=|DNS=(?:127.0.0.1|::1)$|$)/;/^DNS=/ && $_ =~ s/(?:127.0.0.1|::1)[ \t]*//g' \
122 -i "$initdir/etc/systemd/resolved.conf"
124 # Cleanup systemd-resolved.service
125 perl
-pne 'undef $_ if /^(?:#|(?:Wants|After)=org\.freedesktop\.resolve1\.busname)/' \
126 -i "$initdir$systemdsystemunitdir/systemd-resolved.service"
128 # Try install the target file
130 inst_simple
/etc
/resolv.conf
133 # Install resolv.conf as file
134 elif [ -e /etc
/resolv.conf
]; then
136 # Install resolv.conf as file
137 inst_simple
/etc
/resolv.conf
139 # Cleanup resolv.conf
140 #XXX: strip search, localhost and ipv6
141 perl
-pne 'undef $_ if /^(?:#.*|search\s+|nameserver\s+127.0.0.1|nameserver\s+[^:\s]+:[^\s]+|$)/' \
142 -i "$initdir/etc/resolv.conf"
144 # Touch resolv.conf file
146 # We did what we could
147 touch "$initdir/etc/resolv.conf"
151 ln -fs ..
/..
/..
/run
/ihttpd
/log
/{http
,https
,child.
{askpassword
,ihttpd
},error
}.log
$initdir/var
/www
/html
/
153 # Install in ihttpd.service.wants
154 ln -fs ..
/systemd
-networkd.service
$initdir$systemdsystemunitdir/ihttpd.service.wants
/
155 ln -fs ..
/systemd
-tmpfiles-setup.service
$initdir$systemdsystemunitdir/ihttpd.service.wants
/
157 # Include all ihttpd deps
161 "libaprutil-1.so.*" \
175 "libnss_files.so.*" \
177 "libnss_myhostname.so.*" \
178 {"tls/$_arch/",tls
/,"$_arch/",}"libssl.so.*"
180 # Cleanup nsswitch.conf
181 if [ -f "$initdir/etc/nsswitch.conf" ]; then
182 perl
-pne 'undef $_ if /^(?:#|$)/;s/compat/files/;s/ ?(?:nis|wins|mdns4_minimal |mdns4)( )?/\1/g' \
183 -i "$initdir/etc/nsswitch.conf"
186 # Cleanup systemd-networkd.service
187 if [ -f "$initdir$systemdsystemunitdir/systemd-networkd.service" ]; then
188 perl
-pne 'undef $_ if /^(?:#|(?:Wants|After)=org\.freedesktop\.network1\.busname)/;s/^After=(systemd-udevd.service )dbus.service network-pre.target systemd-sysusers.service /After=\1/' \
189 -i "$initdir$systemdsystemunitdir/systemd-networkd.service"
192 # Cleanup systemd-tmpfiles-setup.service
193 if [ -f "$initdir$systemdsystemunitdir/systemd-tmpfiles-setup.service" ]; then
194 perl
-pne 'undef $_ if /^#/;s/After=(.*) systemd-sysusers.service/After=\1/' \
195 -i "$initdir$systemdsystemunitdir/systemd-tmpfiles-setup.service"
198 #XXX: bug: fix /usr/lib/tmpfiles.d/{systemd,dracut-tmpfiles}.conf missing user and group
199 `egrep -q '^utmp:' $initdir/etc/group` || egrep '^utmp:' /etc
/group
>> "$initdir/etc/group"
200 # Require root user and group for our ihttpd process
201 `egrep -q '^root:' $initdir/etc/group` || egrep '^root:' /etc
/group
>> "$initdir/etc/group"
202 `egrep -q '^root:' $initdir/etc/passwd` || egrep '^root:' /etc
/passwd
>> "$initdir/etc/passwd"