summaryrefslogtreecommitdiffstats
path: root/builder/dnbd3-rootfs/module-setup.sh
diff options
context:
space:
mode:
Diffstat (limited to 'builder/dnbd3-rootfs/module-setup.sh')
-rwxr-xr-xbuilder/dnbd3-rootfs/module-setup.sh79
1 files changed, 79 insertions, 0 deletions
diff --git a/builder/dnbd3-rootfs/module-setup.sh b/builder/dnbd3-rootfs/module-setup.sh
new file mode 100755
index 00000000..b9134871
--- /dev/null
+++ b/builder/dnbd3-rootfs/module-setup.sh
@@ -0,0 +1,79 @@
+#!/bin/bash
+
+source "$moddir/scripts/utils.sh"
+
+check() {
+ compile_nbd && \
+ compile_dnbd3 && \
+ compile_systemd_preserve_process_marker
+ return $?
+}
+
+depends() {
+ echo base network bash kernel-modules
+}
+
+installkernel() {
+ inst "$moddir/binaries/dnbd3/build/dnbd3.ko" \
+ /usr/lib/modules/current/extra/dnbd3.ko
+ inst "$moddir/binaries/nbd/nbd.ko" \
+ /usr/lib/modules/current/extra/nbd.ko
+
+ instmods ext4 btrfs
+}
+
+install() {
+
+ # region binaries
+
+ inst "$moddir/binaries/dnbd3/build/dnbd3-client" /usr/bin/dnbd3-client
+ inst "$moddir/binaries/systemd-preserve-process-marker/systemd-preserve-process-marker" \
+ /usr/bin/systemd-preserve-process-marker
+
+ # endregion
+
+ # region hooks
+
+ inst_hook cmdline 00 "$moddir/hooks/cmdline/enable-sysrq.sh"
+ inst_hook cmdline 10 "$moddir/hooks/cmdline/prepare-network-kcl-parameter.sh"
+ inst_hook cmdline 90 "$moddir/hooks/cmdline/set-dracut-environment-variables.sh"
+
+ inst_hook pre-udev 00 "$moddir/hooks/pre-udev/load-custom-kernel-modules.sh"
+ inst_hook pre-udev 00 "$moddir/hooks/pre-udev/setup-loopback-device.sh"
+
+ # this is the configuration hook where the config stuff is wget'ed
+ # TODO
+ #inst_hook pre-mount 00 "$moddir/hooks/pre-mount/fetch-config.sh"
+ # this is the main hook where all the magic is triggered
+ #inst_hook pre-mount 10 "$moddir/hooks/pre-mount/mount-qcow.sh"
+
+ inst_hook pre-mount 10 "$moddir/hooks/pre-mount/prepare-root-partition.sh"
+
+ inst_hook mount 10 "$moddir/hooks/mount/mount-root-device.sh"
+
+ inst_hook pre-pivot 00 "$moddir/hooks/pre-pivot/mount-tmp.sh"
+
+ # endregion
+
+ ## TODO deprecated
+ ### SCRIPTS
+ # the main magic script containing all the functions needed
+ # to prepare the qcow2-based root filesystem
+ #inst "$moddir/scripts/setup-qcow2" /sbin/setup-qcow2
+ #
+ # the script triggered by udev upon finding the right partitions
+ #inst "$moddir/scripts/prepare-disks" /sbin/prepare-disks
+ ##
+ # udev rules detecting 44, 45, 46 partitions and running
+ # 'prepare-disks' to do then format/mount/use them
+ #inst "$moddir/udev/70-openslx-disk.rules" /etc/udev/rules.d/70-openslx-disk.rules
+ ##
+
+ # Debugging Uncomment this version if you need some useful debugging tools
+ # in your iniramfs.
+ inst_multiple lsblk ping ip ifconfig sshd htop tail head cat vim \
+ touch sed lsmod insmod qemu-img sleep route wget find lsof strace \
+ chroot switch_root pivot_root qemu-nbd mount nbd-client fdisk mkfs.xfs
+ # Production:
+ # inst_multiple insmod qemu-img qemu-nbd
+}