-
Notifications
You must be signed in to change notification settings - Fork 248
/
Copy pathmodule-setup.sh
executable file
·126 lines (104 loc) · 3.94 KB
/
module-setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
# Only include this if another module requests it.
# In our case it'll be the distro provided module with integration and customizations
# (coreos-ignition/ignition-microos/...).
return 255
}
depends() {
echo qemu systemd url-lib network
}
install_ignition_unit() {
local unit="$1"; shift
local target="${1:-ignition-complete.target}"; shift
local instantiated="${1:-$unit}"; shift
inst_simple "$moddir/$unit" "$systemdsystemunitdir/$unit"
# note we `|| exit 1` here so we error out if e.g. the units are missing
# see https://github.com/coreos/fedora-coreos-config/issues/799
$SYSTEMCTL -q --root="$initdir" add-requires "$target" "$instantiated" || exit 1
}
install() {
inst_multiple \
basename \
lsblk
# Not all features of the configuration may be available on all systems
# (e.g. on embedded systems), so only add applications which are actually
# present
inst_multiple -o \
groupadd \
groupdel \
mkfs.btrfs \
mkfs.ext4 \
mkfs.fat \
mkfs.xfs \
mkswap \
partx \
sgdisk \
useradd \
userdel \
usermod \
wipefs
# Needed for clevis binding; note all binaries related to unlocking are
# included by the Clevis dracut modules.
inst_multiple -o \
clevis-encrypt-sss \
clevis-encrypt-tang \
clevis-encrypt-tpm2 \
clevis-luks-bind \
clevis-luks-common-functions \
clevis-luks-unlock \
pwmake \
tpm2_create \
tpm2_createpolicy
# Required by s390x's z/VM installation.
# Supporting https://github.com/coreos/ignition/pull/865
if [[ ${DRACUT_ARCH:-$(uname -m)} == s390x ]]; then
inst_multiple chccwdev vmur zkey zkey-cryptsetup
inst_simple "$moddir/ignition-cex" "/etc/luks/cex.key"
fi
# Required on system using SELinux.
inst_multiple -o setfiles
inst_script "$moddir/ignition-kargs-helper.sh" \
"/usr/sbin/ignition-kargs-helper"
# Distro packaging is expected to install the ignition binary into the
# module directory.
inst_simple "$moddir/ignition" \
"/usr/bin/ignition"
# Rule to allow udev to discover unformatted encrypted devices
inst_simple "$moddir/99-xx-ignition-systemd-cryptsetup.rules" \
"/usr/lib/udev/rules.d/99-xx-ignition-systemd-cryptsetup.rules"
# disable dictcheck
inst_simple "$moddir/ignition-luks.conf" \
"/etc/security/pwquality.conf.d/ignition-luks.conf"
inst_simple "$moddir/ignition-generator" \
"$systemdutildir/system-generators/ignition-generator"
for x in "complete" "subsequent" "diskful" "diskful-subsequent"; do
inst_simple "$moddir/ignition-$x.target" \
"$systemdsystemunitdir/ignition-$x.target"
done
install_ignition_unit ignition-fetch.service
install_ignition_unit ignition-fetch-offline.service
install_ignition_unit ignition-kargs.service
install_ignition_unit ignition-disks.service
install_ignition_unit ignition-mount.service
install_ignition_unit ignition-files.service
# units only started when we have a boot disk
# path generated by systemd-escape --path /dev/disk/by-label/root
install_ignition_unit ignition-remount-sysroot.service ignition-diskful.target
# needed for openstack config drive support
inst_rules 60-cdrom_id.rules
}
installkernel() {
# required by hyperv platform to read kvp from the kernel
instmods hv_utils
# required by applehv platform to read ignition file through vsock
instmods -c vsock
instmods -c vmw_vsock_virtio_transport_common
instmods -c vmw_vsock_virtio_transport
# required for cex card early initialization
if [[ ${DRACUT_ARCH:-$(uname -m)} == s390x ]]; then
instmods -c zcrypt_cex4
fi
}