diff options
| author | torben | 2015-05-04 13:57:16 +0200 |
|---|---|---|
| committer | torben | 2015-05-04 13:57:16 +0200 |
| commit | 0ddd93e6daec1c2eadb025bbc7ab90b9e865516c (patch) | |
| tree | 58d84520e5a7f802f1fc0abdca7933f47c4d5b4d /testModule/module-setup.sh | |
| parent | Pepare merge. (diff) | |
| parent | working version - STILL TESTING (diff) | |
| download | systemd-init-0ddd93e6daec1c2eadb025bbc7ab90b9e865516c.tar.gz systemd-init-0ddd93e6daec1c2eadb025bbc7ab90b9e865516c.tar.xz systemd-init-0ddd93e6daec1c2eadb025bbc7ab90b9e865516c.zip | |
Merge branch 'master' of git.openslx.org:openslx-ng/systemd-init
Diffstat (limited to 'testModule/module-setup.sh')
| -rw-r--r-- | testModule/module-setup.sh | 56 |
1 files changed, 44 insertions, 12 deletions
diff --git a/testModule/module-setup.sh b/testModule/module-setup.sh index 74a79d57..839e5deb 100644 --- a/testModule/module-setup.sh +++ b/testModule/module-setup.sh @@ -1,7 +1,35 @@ #!/bin/bash check() { - return 0 + if ! type -f qemu-nbd >/dev/null; then + echo "'qemu-nbd' not found on this system, install it to use this module." + return 1 + fi + if ! type -f qemu-img >/dev/null; then + echo "'qemu-img' not found on this system, install it to use this module." + return 1 + fi + if ! type -f nbd-client >/dev/null; then + echo "'nbd-client' not found on this system, install it to use this module." + return 1 + else + # check version + local nbd_client_version="$(nbd-client --help 2>&1 | grep -oE '3\.[0-9]+')" + local nbd_client_version_major="${nbd_client_version%.*}" + local nbd_client_version_minor="${nbd_client_version#*.}" + if [ "${nbd_client_version_major}" -ne 3 ]; then + # nbd-client probably too old + echo "The nbd-client major version is not 3, meaning its probably too old." + return 1 + fi + if [ "${nbd_client_version_minor}" -gt 8 ]; then + # TODO check if ver = 3.9 has the same new syntax... + echo "The nbd-client minor version is greater than 8. A new syntax has been + introduced starting with 3.10 which we do not support." + return 1 + fi + return 0 + fi } depends() { @@ -10,15 +38,15 @@ depends() { } installkernel() { - instmods nbd ext4 + instmods ext4 } install() { - # Loads globally needed useful functions or fixes some native dracut ones. - inst "$moddir/library.sh" /usr/lib/test-library.sh - + # cause we need reboots + inst "$moddir/scripts/r" /usr/bin/r # Needed to mount remote dnbd3 filesystem. inst "$moddir/binaries/dnbd3-client" /usr/bin/dnbd3-client + inst "$moddir/binaries/busybox" /usr/bin/busybox # A generic wrapper program to prepend a "@" to each process spawned by # given nested programs. inst "$moddir/binaries/systemd-preserve-process-marker" \ @@ -32,17 +60,21 @@ install() { # NOTE: Priority has to be lower than the network cmdline parsing hooks # since we have to modify the some kernel parameter before. - inst_hook cmdline 1 "$moddir/hooks/cmdline.sh" + inst_hook cmdline 00 "$moddir/hooks/cmdline.sh" + inst_hook cmdline 90 "$moddir/hooks/nbd-cmdline.sh" + inst_hook pre-udev 00 "$moddir/hooks/pre-udev.sh" inst_hook pre-mount 10 "$moddir/hooks/pre-mount.sh" - # NOTE: Hook "mount" isn't executed on tested version. - inst_hook pre-pivot 10 "$moddir/hooks/mount.sh" + inst_hook mount 10 "$moddir/hooks/mount.sh" + inst "$moddir/scripts/setup-qcow2" /sbin/setup-qcow2 + inst "$moddir/scripts/setup-nbdroot" /sbin/setup-nbdroot + # Debugging Uncomment this version if you need some useful debugging tools # in your iniramfs. - #inst_multiple lsblk ping ip ifconfig sshd htop dhclient tail head cat vim \ - # touch sed lsmod insmod qemu-img sleep route wget find lsof strace \ - # chroot switch_root pivot_root qemu-nbd + 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 # Production: - inst_multiple insmod qemu-img qemu-nbd + # inst_multiple insmod qemu-img qemu-nbd return 0 } |
