New warewulf-dracut subpackage
warewulf-dracut includes a dracut module to be installed in a container image to support building an initramfs that can boot from Warewulf. Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
13
dracut/modules.d/90wwinit/load-wwinit.sh
Executable file
13
dracut/modules.d/90wwinit/load-wwinit.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
info "Mounting tmpfs at $NEWROOT"
|
||||
mount -t tmpfs ${wwinit_tmpfs_size_option} tmpfs "$NEWROOT"
|
||||
|
||||
for archive in "${wwinit_container}" "${wwinit_kmods}" "${wwinit_system}" "${wwinit_runtime}"
|
||||
do
|
||||
if [ -n "${archive}" ]
|
||||
then
|
||||
info "Loading ${archive}"
|
||||
(curl --silent -L "${archive}" | gzip -d | cpio -im --directory="${NEWROOT}") || die "Unable to load ${archive}"
|
||||
fi
|
||||
done
|
||||
20
dracut/modules.d/90wwinit/module-setup.sh
Executable file
20
dracut/modules.d/90wwinit/module-setup.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
check() {
|
||||
# Don't include in hostonly mode
|
||||
[[ $hostonly ]] && return 1
|
||||
|
||||
# Don't include by default
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
echo network
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
inst_multiple cpio curl
|
||||
inst_hook cmdline 30 "$moddir/parse-wwinit.sh"
|
||||
inst_hook pre-mount 30 "$moddir/load-wwinit.sh"
|
||||
}
|
||||
28
dracut/modules.d/90wwinit/parse-wwinit.sh
Executable file
28
dracut/modules.d/90wwinit/parse-wwinit.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
# root=wwinit
|
||||
|
||||
[ -z "$root" ] && root=$(getarg root=)
|
||||
|
||||
if [ "${root}" = "wwinit" ]
|
||||
then
|
||||
info "root=${root}"
|
||||
export wwinit_container=$(getarg wwinit.container=); info "wwinit.container=${wwinit_container}"
|
||||
export wwinit_system=$(getarg wwinit.system=); info "wwinit.system=${wwinit_system}"
|
||||
export wwinit_runtime=$(getarg wwinit.runtime=); info "wwinit.runtime=${wwinit_runtime}"
|
||||
export wwinit_kmods=$(getarg wwinit.kmods=); info "wwinit.kmods=${wwinit_kmods}"
|
||||
|
||||
wwinit_tmpfs_size=$(getarg wwinit.tmpfs.size=)
|
||||
if [ -n "$wwinit_tmpfs_size" ]
|
||||
then
|
||||
info "wwinit.tmpfs.size=${wwinit_tmpfs_size}"
|
||||
export wwinit_tmpfs_size_option="-o size=${wwinit_tmpfs_size}"
|
||||
fi
|
||||
|
||||
if [ -n "${wwinit_container}" ]
|
||||
then
|
||||
info "Found root=${root} and a Warewulf container image. Will boot from Warewulf."
|
||||
rootok=1
|
||||
else
|
||||
die "Found root=${root} but no container image. Cannot boot from Warewulf."
|
||||
fi
|
||||
fi
|
||||
Reference in New Issue
Block a user