summaryrefslogtreecommitdiffstats
path: root/modules.d/slx-uuid/module-setup.sh
blob: 1cac712d555516e5f7a2669887da5a9c7395ecd6 (plain) (blame)
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
#!/usr/bin/env bash
check() {
	# Tell dracut that this module should only be included if it is required
	# explicitly.
	if ! hash dmidecode; then
		echo "dmidecode is missing from this system, please install it."
		return 1
	fi
	return 255
}
depends() {
	echo busybox
}
install() {
	mkdir -p "$initdir/etc/bad-uuid.d"
	# check if we have any uuid blacklists installed by openslx/mltk on this system
	for blacklist in /opt/openslx/bad-uuid.d/*; do
		[ -s "$blacklist" ] || continue
		inst_simple "$blacklist" "/etc/bad-uuid.d/${blacklist##*/}"
	done
	# add this module's default blacklist
	inst_simple "$moddir/bad-uuid-defaults.conf" "/etc/bad-uuid.d/bad-uuid-defaults.conf"

	inst_multiple dmidecode
	inst_hook pre-pivot 10 "$moddir/hooks/copy-system-uuid-to-newroot.sh"

	_name="s3-get-system-uuid"
	inst "$moddir/hooks/${_name}.sh" \
			"/usr/local/bin/${_name}.sh"
	inst_simple "${moddir}/services/${_name}.service" \
			"${systemdsystemunitdir}/${_name}.service"
	mkdir --parents \
			"${initdir}/${systemdsystemunitdir}/dracut-pre-udev.service.requires"
	ln_r "${systemdsystemunitdir}/${_name}.service" \
			"${systemdsystemunitdir}/dracut-pre-udev.service.requires/${_name}.service"
}