diff options
Diffstat (limited to 'testModule/hooks')
| -rw-r--r-- | testModule/hooks/cmdline.sh | 29 | ||||
| -rw-r--r-- | testModule/hooks/pre-mount.sh | 10 | ||||
| -rw-r--r-- | testModule/hooks/pre-pivot.sh | 12 |
3 files changed, 51 insertions, 0 deletions
diff --git a/testModule/hooks/cmdline.sh b/testModule/hooks/cmdline.sh new file mode 100644 index 00000000..340467df --- /dev/null +++ b/testModule/hooks/cmdline.sh @@ -0,0 +1,29 @@ +# Converts ip configuration format given by the pxe pre boot provider to a +# dracut compatible static ip configuration. + +source /usr/lib/test-library.sh + +for parameter in $(getargs ip=); do + local temp="$parameter:" + set -- + while [ -n "$temp" ]; do + set -- "$@" "${temp%%:*}" + temp=${temp#*:} + done + + [ -n "$1" ] && ip=$1 + [ -n "$2" ] && server_ip=$2 + [ -n "$3" ] && gateway_ip=$3 + [ -n "$4" ] && net_mask=$4 + + warn "PXE given net configuration: ip: $ip server_ip: $server_ip gateway_ip: $gateway_ip net_mask: $net_mask" + local final_dracut_ip_config="$ip::$gateway_ip:$net_mask:dracut_test_client:enp0s3:none" + warn "Final dracut ip config: $final_dracut_ip_config" + replace_cmd ip "$final_dracut_ip_config" +done + +# NOTE: Doesn't work since dracuts needed version of mount doesn't support +# binds. +#cat /proc/cmdline | sed --regexp-extended 's/ip=[^ ]+//g' \ +# >"$temporary_kernel_commandline_file_path" && \ +#mount -n --rbind -o ro "$temporary_kernel_commandline_file_path" /proc/cmdline diff --git a/testModule/hooks/pre-mount.sh b/testModule/hooks/pre-mount.sh new file mode 100644 index 00000000..7798622e --- /dev/null +++ b/testModule/hooks/pre-mount.sh @@ -0,0 +1,10 @@ +# TODO +warn '............START.............' + +insmod /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/dnbd3.ko +local dnbd3_device_node="$(dnbd3-client -h 132.230.4.1 -i stage4/torben/test \ + -r 1 -d /dev/dnbd0)" +#qemu-img create -f qcow2 -o \ +# backing_file="$dnbd3_device_node",backing_fmt=qcow2 /test.qcow2 +#insmod /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/nbd.ko +#systemd_preserve_process_marker qemu-nbd -c /dev/nbd0 /test.qcow2 diff --git a/testModule/hooks/pre-pivot.sh b/testModule/hooks/pre-pivot.sh new file mode 100644 index 00000000..8b01779a --- /dev/null +++ b/testModule/hooks/pre-pivot.sh @@ -0,0 +1,12 @@ +# TODO +warn '............MOUNT.............' +# TODO +dnbd3_device_node='/dev/dnbd0' +mount -o remount,rw /sysroot +rm /sysroot/test.qcow2 +qemu-img create -f qcow2 -o \ + backing_file="$dnbd3_device_node",backing_fmt=qcow2 /sysroot/test.qcow2 +insmod /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/nbd.ko +systemd_preserve_process_marker qemu-nbd --connect /dev/nbd0 /sysroot/test.qcow2 --socket /sysroot/var/lock/qemu-nbd-TEST +mount /dev/nbd0 /sysroot/TEST +# strace -ff -o /sysroot/log.txt -p PID |
