From 81e7552e02341e6bff0ac1daccbe9156fbd1d147 Mon Sep 17 00:00:00 2001 From: torben Date: Mon, 20 Apr 2015 14:44:12 +0200 Subject: Cleanup refactoring. Evaluate minimal needed dependencies. --- testModule/binaries/busybox | Bin 931664 -> 0 bytes testModule/binaries/dnbd3-client | Bin 31150 -> 0 bytes testModule/binaries/endless | Bin 6752 -> 0 bytes testModule/binaries/nbd-client | Bin 59639 -> 0 bytes testModule/binaries/qemu-nbd-systemd-mark | Bin 7131834 -> 0 bytes .../binaries/qemu-nbd-systemd-mark-alternate | Bin 7128103 -> 0 bytes .../binaries/systemd-preserve-process-marker | Bin 0 -> 7728 bytes .../binaries/systemd_preserve_process_marker | Bin 7728 -> 0 bytes testModule/debugging_tools/busybox | Bin 0 -> 931664 bytes testModule/debugging_tools/dnbd3-client | Bin 0 -> 31150 bytes testModule/debugging_tools/endless | Bin 0 -> 6752 bytes testModule/debugging_tools/endless.c | 10 +++ testModule/debugging_tools/nbd-client | Bin 0 -> 59639 bytes testModule/debugging_tools/nbd-debugging.ko | Bin 0 -> 463248 bytes testModule/debugging_tools/network.functions | 23 ++++++ testModule/debugging_tools/qemu-nbd-systemd-mark | Bin 0 -> 7131834 bytes .../qemu-nbd-systemd-mark-alternate | Bin 0 -> 7128103 bytes testModule/debugging_tools/setup_network.sh | 84 +++++++++++++++++++++ testModule/deprecated/network.functions | 23 ------ testModule/deprecated/setup_network.sh | 84 --------------------- testModule/endless.c | 10 --- testModule/hooks/mount.sh | 2 +- testModule/hooks/pre-mount.sh | 17 +++-- testModule/hooks/pre-pivot.sh | 8 -- testModule/kernel_modules/nbd.ko | Bin 463248 -> 463216 bytes testModule/kernel_modules/nbd.ko.backup | Bin 463216 -> 0 bytes testModule/kernel_modules/nbd.ko.old | Bin 458623 -> 0 bytes testModule/module-setup.sh | 16 +--- testModule/systemd-preserve-process-marker.c | 31 ++++++++ testModule/systemd_preserve_process_marker.c | 31 -------- 30 files changed, 162 insertions(+), 177 deletions(-) delete mode 100755 testModule/binaries/busybox delete mode 100755 testModule/binaries/dnbd3-client delete mode 100755 testModule/binaries/endless delete mode 100755 testModule/binaries/nbd-client delete mode 100755 testModule/binaries/qemu-nbd-systemd-mark delete mode 100755 testModule/binaries/qemu-nbd-systemd-mark-alternate create mode 100755 testModule/binaries/systemd-preserve-process-marker delete mode 100755 testModule/binaries/systemd_preserve_process_marker create mode 100755 testModule/debugging_tools/busybox create mode 100755 testModule/debugging_tools/dnbd3-client create mode 100755 testModule/debugging_tools/endless create mode 100644 testModule/debugging_tools/endless.c create mode 100755 testModule/debugging_tools/nbd-client create mode 100644 testModule/debugging_tools/nbd-debugging.ko create mode 100644 testModule/debugging_tools/network.functions create mode 100755 testModule/debugging_tools/qemu-nbd-systemd-mark create mode 100755 testModule/debugging_tools/qemu-nbd-systemd-mark-alternate create mode 100644 testModule/debugging_tools/setup_network.sh delete mode 100644 testModule/deprecated/network.functions delete mode 100644 testModule/deprecated/setup_network.sh delete mode 100644 testModule/endless.c delete mode 100755 testModule/hooks/pre-pivot.sh delete mode 100644 testModule/kernel_modules/nbd.ko.backup delete mode 100644 testModule/kernel_modules/nbd.ko.old create mode 100644 testModule/systemd-preserve-process-marker.c delete mode 100644 testModule/systemd_preserve_process_marker.c (limited to 'testModule') diff --git a/testModule/binaries/busybox b/testModule/binaries/busybox deleted file mode 100755 index 1212ae20..00000000 Binary files a/testModule/binaries/busybox and /dev/null differ diff --git a/testModule/binaries/dnbd3-client b/testModule/binaries/dnbd3-client deleted file mode 100755 index 76924b49..00000000 Binary files a/testModule/binaries/dnbd3-client and /dev/null differ diff --git a/testModule/binaries/endless b/testModule/binaries/endless deleted file mode 100755 index de7a8c0a..00000000 Binary files a/testModule/binaries/endless and /dev/null differ diff --git a/testModule/binaries/nbd-client b/testModule/binaries/nbd-client deleted file mode 100755 index 7bb2207f..00000000 Binary files a/testModule/binaries/nbd-client and /dev/null differ diff --git a/testModule/binaries/qemu-nbd-systemd-mark b/testModule/binaries/qemu-nbd-systemd-mark deleted file mode 100755 index 26fefe9d..00000000 Binary files a/testModule/binaries/qemu-nbd-systemd-mark and /dev/null differ diff --git a/testModule/binaries/qemu-nbd-systemd-mark-alternate b/testModule/binaries/qemu-nbd-systemd-mark-alternate deleted file mode 100755 index 03c2a6b1..00000000 Binary files a/testModule/binaries/qemu-nbd-systemd-mark-alternate and /dev/null differ diff --git a/testModule/binaries/systemd-preserve-process-marker b/testModule/binaries/systemd-preserve-process-marker new file mode 100755 index 00000000..0181cd80 Binary files /dev/null and b/testModule/binaries/systemd-preserve-process-marker differ diff --git a/testModule/binaries/systemd_preserve_process_marker b/testModule/binaries/systemd_preserve_process_marker deleted file mode 100755 index 0181cd80..00000000 Binary files a/testModule/binaries/systemd_preserve_process_marker and /dev/null differ diff --git a/testModule/debugging_tools/busybox b/testModule/debugging_tools/busybox new file mode 100755 index 00000000..1212ae20 Binary files /dev/null and b/testModule/debugging_tools/busybox differ diff --git a/testModule/debugging_tools/dnbd3-client b/testModule/debugging_tools/dnbd3-client new file mode 100755 index 00000000..76924b49 Binary files /dev/null and b/testModule/debugging_tools/dnbd3-client differ diff --git a/testModule/debugging_tools/endless b/testModule/debugging_tools/endless new file mode 100755 index 00000000..de7a8c0a Binary files /dev/null and b/testModule/debugging_tools/endless differ diff --git a/testModule/debugging_tools/endless.c b/testModule/debugging_tools/endless.c new file mode 100644 index 00000000..22c9bc50 --- /dev/null +++ b/testModule/debugging_tools/endless.c @@ -0,0 +1,10 @@ +#include +#include +#include +#include + +int main(int argc, char *argv[]) { + // Provides a dummy worker. + while (1) + sleep(999999999); +} diff --git a/testModule/debugging_tools/nbd-client b/testModule/debugging_tools/nbd-client new file mode 100755 index 00000000..7bb2207f Binary files /dev/null and b/testModule/debugging_tools/nbd-client differ diff --git a/testModule/debugging_tools/nbd-debugging.ko b/testModule/debugging_tools/nbd-debugging.ko new file mode 100644 index 00000000..47cf6cd6 Binary files /dev/null and b/testModule/debugging_tools/nbd-debugging.ko differ diff --git a/testModule/debugging_tools/network.functions b/testModule/debugging_tools/network.functions new file mode 100644 index 00000000..89ca5a20 --- /dev/null +++ b/testModule/debugging_tools/network.functions @@ -0,0 +1,23 @@ +wait_for_iface() { + local DEVICE=$1 + local TIMEOUT=10 + echo -n "Waiting for interface $DEVICE: " + # Some systems don't have operstate. Seems to be hardware dependent + [ ! -e "/sys/class/net/${DEVICE}/operstate" ] && usleep 10000 + if [ -e "/sys/class/net/${DEVICE}/operstate" ]; then + while true; do + # check linkstate + [ "x$(cat "/sys/class/net/${DEVICE}/operstate")" == "xup" ] && break + TIMEOUT=$(( $TIMEOUT - 1 )) # don't wait forever, the pcnet iface of vmware will never be "up" although it's working + [ "$TIMEOUT" -le 0 ] && break + # else + echo -n "." + usleep 500000 + done + else + # we really don't have a operstate .. then just wait a sec and hope for the best. + sleep 1 + fi + echo ".$(cat "/sys/class/net/${DEVICE}/operstate" 2>/dev/null)" +} +true diff --git a/testModule/debugging_tools/qemu-nbd-systemd-mark b/testModule/debugging_tools/qemu-nbd-systemd-mark new file mode 100755 index 00000000..26fefe9d Binary files /dev/null and b/testModule/debugging_tools/qemu-nbd-systemd-mark differ diff --git a/testModule/debugging_tools/qemu-nbd-systemd-mark-alternate b/testModule/debugging_tools/qemu-nbd-systemd-mark-alternate new file mode 100755 index 00000000..03c2a6b1 Binary files /dev/null and b/testModule/debugging_tools/qemu-nbd-systemd-mark-alternate differ diff --git a/testModule/debugging_tools/setup_network.sh b/testModule/debugging_tools/setup_network.sh new file mode 100644 index 00000000..3b32a68c --- /dev/null +++ b/testModule/debugging_tools/setup_network.sh @@ -0,0 +1,84 @@ +#!/bin/bash + +echo "Setting up network..." + +echo "Main MAC address is '$MAC'" + +# setup network +source /inc/network.functions + +# set up loopback networking +echo "Setting up loopback" +ip link set dev lo up 2>/dev/null +ip addr add 127.0.0.1/8 dev lo 2>/dev/null + +echo "Setting up bridge" +BRIDGE="br0" + +# Following was supposed to prevent scripts from getting confused by multiple interfaces with same MAC - does not work though +## Flip mac address of original interface - this var is not local so init sees the changes too +#MAC="$(echo "$MAC" | awk -F ':' '{printf $1 ":" $2 ":" $5 ":" $3 ":" $6 ":" $4}')" +#ip link set addr "$MAC" "$SLAVE" + +mkdir -p "${FUTURE_ROOT}/etc/udev/rules.d" + +#IP_OUT=$(ip a | sed -r ':a;N;$!ba;s/: ([a-z0-9]+): /####\1####/g;s/ether ([a-f0-9:]+) /####\1####/g'| grep -E -o '####[^ ]+####' | sed 's/#//g' | grep -B 1 ':') +IP_OUT=$(ip a | grep -B 1 "/ether" | sed -r '/^--$/d;$!N;s#^[0-9]+: ([a-z0-9\.:]+): .*?/ether ([0-9a-fA-Z:]+) .*$#\1==\2#') + +if ! echo "$IP_OUT" | grep -q -- "$MAC"; then + drop_shell "Boot interface not found in interface list. NIC driver missing?" +fi + +for LINE in $IP_OUT; do + IFACE=$(echo "$LINE" | awk -F '==' '{printf $1}') + IFMAC=$(echo "$LINE" | awk -F '==' '{printf $2}' | tr '[A-Z]' '[a-z]') # udev requires mac addesses to be lowercase (a-f), see http://www.debianhelp.co.uk/udev.htm + echo "${IFACE} = ${IFMAC}" + + if [ "x$IFMAC" == "x$MAC" ]; then + brctl addbr "$BRIDGE" || drop_shell "Could not create bridge $BRIDGE" + brctl stp "$BRIDGE" 0 + brctl setfd "$BRIDGE" 0.000000000001 + ip link set addr "$IFMAC" "$BRIDGE" || drop_shell "Could not set mac of $BRIDGE" + ip link set dev "$IFACE" up + wait_for_iface "$IFACE" + brctl addif "$BRIDGE" "$IFACE" || drop_shell "Could not add $IFACE to $BRIDGE" + + # save our variables for retry on fail + echo "IFACE=$IFACE" > /run/network.conf + + # analyze ip information from the kernel command line and put parts + # of it into several variables + if [ -n "$CLIENTIP" ] ; then + # set static ip address + ip addr add "$CLIENTIP/$(ipcalc -s -p "$CLIENTIP" "$SUBNET_MASK" | sed "s/.*=//")" broadcast "$BROADCAST_ADDRESS" dev "$BRIDGE" + ip link set dev "$BRIDGE" up + [ -n "$GATEWAY" ] && ip route add default via "$GATEWAY" dev "$BRIDGE" + else + NOIPYET="yes" + fi + # Ignore this device later on when systemd handles network interfaces (see hacked 99-systemd.rules in systemd data dir) + echo "SUBSYSTEM==\"net\", ACTION==\"add\", KERNEL==\"eth*\", ATTR{address}==\"$IFMAC\", TAG+=\"openslxignore\"" >> "${FUTURE_ROOT}/etc/udev/rules.d/01-ignore-boot-interface.rules" + fi + # youdev + echo "SUBSYSTEM==\"net\", ACTION==\"add\", DRIVERS==\"?*\", ATTR{address}==\"$IFMAC\", ATTR{dev_id}==\"0x0\", ATTR{type}==\"1\", KERNEL==\"eth*\", NAME=\"$IFACE\"" >> "${FUTURE_ROOT}/etc/udev/rules.d/70-net-boot-nic-name.rules" + # continue... + IFACE="" +done + +wait_for_iface "$BRIDGE" + +# udhcpc +PARAM= +if [ -n "$CLIENTIP" ]; then + PARAM="-r $CLIENTIP" +fi +echo -n "$CLIENTIP" > "/run/firstip" +echo -n "$GATEWAY" > "/run/firstgw" + +# save our variables for retry on fail ff. +echo "CLIENTIP=$CLIENTIP" >> /run/network.conf +echo "GATEWAY=$GATEWAY" >> /run/network.conf +echo "BRIDGE=$BRIDGE" >> /run/network.conf + +udhcpc $PARAM -O domain -O nissrv -O nisdomain -O wpad -O search -t 5 -T 2 -s "/inc/udhcpc-trigger" -f -n -q -i "$BRIDGE" +# udhcpc return value will be return value of this script diff --git a/testModule/deprecated/network.functions b/testModule/deprecated/network.functions deleted file mode 100644 index 89ca5a20..00000000 --- a/testModule/deprecated/network.functions +++ /dev/null @@ -1,23 +0,0 @@ -wait_for_iface() { - local DEVICE=$1 - local TIMEOUT=10 - echo -n "Waiting for interface $DEVICE: " - # Some systems don't have operstate. Seems to be hardware dependent - [ ! -e "/sys/class/net/${DEVICE}/operstate" ] && usleep 10000 - if [ -e "/sys/class/net/${DEVICE}/operstate" ]; then - while true; do - # check linkstate - [ "x$(cat "/sys/class/net/${DEVICE}/operstate")" == "xup" ] && break - TIMEOUT=$(( $TIMEOUT - 1 )) # don't wait forever, the pcnet iface of vmware will never be "up" although it's working - [ "$TIMEOUT" -le 0 ] && break - # else - echo -n "." - usleep 500000 - done - else - # we really don't have a operstate .. then just wait a sec and hope for the best. - sleep 1 - fi - echo ".$(cat "/sys/class/net/${DEVICE}/operstate" 2>/dev/null)" -} -true diff --git a/testModule/deprecated/setup_network.sh b/testModule/deprecated/setup_network.sh deleted file mode 100644 index 3b32a68c..00000000 --- a/testModule/deprecated/setup_network.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash - -echo "Setting up network..." - -echo "Main MAC address is '$MAC'" - -# setup network -source /inc/network.functions - -# set up loopback networking -echo "Setting up loopback" -ip link set dev lo up 2>/dev/null -ip addr add 127.0.0.1/8 dev lo 2>/dev/null - -echo "Setting up bridge" -BRIDGE="br0" - -# Following was supposed to prevent scripts from getting confused by multiple interfaces with same MAC - does not work though -## Flip mac address of original interface - this var is not local so init sees the changes too -#MAC="$(echo "$MAC" | awk -F ':' '{printf $1 ":" $2 ":" $5 ":" $3 ":" $6 ":" $4}')" -#ip link set addr "$MAC" "$SLAVE" - -mkdir -p "${FUTURE_ROOT}/etc/udev/rules.d" - -#IP_OUT=$(ip a | sed -r ':a;N;$!ba;s/: ([a-z0-9]+): /####\1####/g;s/ether ([a-f0-9:]+) /####\1####/g'| grep -E -o '####[^ ]+####' | sed 's/#//g' | grep -B 1 ':') -IP_OUT=$(ip a | grep -B 1 "/ether" | sed -r '/^--$/d;$!N;s#^[0-9]+: ([a-z0-9\.:]+): .*?/ether ([0-9a-fA-Z:]+) .*$#\1==\2#') - -if ! echo "$IP_OUT" | grep -q -- "$MAC"; then - drop_shell "Boot interface not found in interface list. NIC driver missing?" -fi - -for LINE in $IP_OUT; do - IFACE=$(echo "$LINE" | awk -F '==' '{printf $1}') - IFMAC=$(echo "$LINE" | awk -F '==' '{printf $2}' | tr '[A-Z]' '[a-z]') # udev requires mac addesses to be lowercase (a-f), see http://www.debianhelp.co.uk/udev.htm - echo "${IFACE} = ${IFMAC}" - - if [ "x$IFMAC" == "x$MAC" ]; then - brctl addbr "$BRIDGE" || drop_shell "Could not create bridge $BRIDGE" - brctl stp "$BRIDGE" 0 - brctl setfd "$BRIDGE" 0.000000000001 - ip link set addr "$IFMAC" "$BRIDGE" || drop_shell "Could not set mac of $BRIDGE" - ip link set dev "$IFACE" up - wait_for_iface "$IFACE" - brctl addif "$BRIDGE" "$IFACE" || drop_shell "Could not add $IFACE to $BRIDGE" - - # save our variables for retry on fail - echo "IFACE=$IFACE" > /run/network.conf - - # analyze ip information from the kernel command line and put parts - # of it into several variables - if [ -n "$CLIENTIP" ] ; then - # set static ip address - ip addr add "$CLIENTIP/$(ipcalc -s -p "$CLIENTIP" "$SUBNET_MASK" | sed "s/.*=//")" broadcast "$BROADCAST_ADDRESS" dev "$BRIDGE" - ip link set dev "$BRIDGE" up - [ -n "$GATEWAY" ] && ip route add default via "$GATEWAY" dev "$BRIDGE" - else - NOIPYET="yes" - fi - # Ignore this device later on when systemd handles network interfaces (see hacked 99-systemd.rules in systemd data dir) - echo "SUBSYSTEM==\"net\", ACTION==\"add\", KERNEL==\"eth*\", ATTR{address}==\"$IFMAC\", TAG+=\"openslxignore\"" >> "${FUTURE_ROOT}/etc/udev/rules.d/01-ignore-boot-interface.rules" - fi - # youdev - echo "SUBSYSTEM==\"net\", ACTION==\"add\", DRIVERS==\"?*\", ATTR{address}==\"$IFMAC\", ATTR{dev_id}==\"0x0\", ATTR{type}==\"1\", KERNEL==\"eth*\", NAME=\"$IFACE\"" >> "${FUTURE_ROOT}/etc/udev/rules.d/70-net-boot-nic-name.rules" - # continue... - IFACE="" -done - -wait_for_iface "$BRIDGE" - -# udhcpc -PARAM= -if [ -n "$CLIENTIP" ]; then - PARAM="-r $CLIENTIP" -fi -echo -n "$CLIENTIP" > "/run/firstip" -echo -n "$GATEWAY" > "/run/firstgw" - -# save our variables for retry on fail ff. -echo "CLIENTIP=$CLIENTIP" >> /run/network.conf -echo "GATEWAY=$GATEWAY" >> /run/network.conf -echo "BRIDGE=$BRIDGE" >> /run/network.conf - -udhcpc $PARAM -O domain -O nissrv -O nisdomain -O wpad -O search -t 5 -T 2 -s "/inc/udhcpc-trigger" -f -n -q -i "$BRIDGE" -# udhcpc return value will be return value of this script diff --git a/testModule/endless.c b/testModule/endless.c deleted file mode 100644 index 22c9bc50..00000000 --- a/testModule/endless.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include -#include - -int main(int argc, char *argv[]) { - // Provides a dummy worker. - while (1) - sleep(999999999); -} diff --git a/testModule/hooks/mount.sh b/testModule/hooks/mount.sh index 93a11e7c..28958fb6 100755 --- a/testModule/hooks/mount.sh +++ b/testModule/hooks/mount.sh @@ -3,5 +3,5 @@ if [ $MOUNT_READY ]; then else export MOUNT_READY=true warn '............MOUNT.............' - #mount /dev/nbd0 /sysroot/TEST + mount /dev/nbd0 /sysroot fi diff --git a/testModule/hooks/pre-mount.sh b/testModule/hooks/pre-mount.sh index 548e748d..ed36db84 100755 --- a/testModule/hooks/pre-mount.sh +++ b/testModule/hooks/pre-mount.sh @@ -1,15 +1,16 @@ +#!/usr/bin/bash + if [ $PRE_MOUNT_READY ]; then warn '............PRE-MOUNT ALREADY DONE.............' else export PRE_MOUNT_READY=true warn '............PRE-MOUNT.............' - #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)" - #dnbd3_device_node='/dev/dnbd0' - #qemu-img create -f qcow2 -o backing_file="$dnbd3_device_node",backing_fmt=qcow2 /test.qcow2 - qemu-img create -f qcow2 /run/test.qcow2 100M + 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)" + dnbd3_device_node='/dev/dnbd0' + qemu-img create -f qcow2 -o backing_file="$dnbd3_device_node",backing_fmt=qcow2 /run/test.qcow2 insmod /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/nbd.ko - /usr/bin/qemu-nbd-systemd-mark-alternate --connect=/dev/nbd0 /run/test.qcow2 --socket /run/qemu-nbd-TEST --aio=native - #--persistent + /usr/bin/qemu-nbd-systemd-mark-alternate --connect=/dev/nbd0 \ + /run/test.qcow2 --socket /run/qemu-nbd-TEST fi diff --git a/testModule/hooks/pre-pivot.sh b/testModule/hooks/pre-pivot.sh deleted file mode 100755 index fcc6a977..00000000 --- a/testModule/hooks/pre-pivot.sh +++ /dev/null @@ -1,8 +0,0 @@ -if [ $PRE_PIVOT_READY ]; then - warn '............PRE-PIVOT ALREADY DONE.............' -else - export PRE_PIVOT_READY=true - warn '............PRE-PIVOT.............' - #mount /dev/nbd0 /sysroot/TEST/ - # strace -ff -o /sysroot/log.txt -p PID -fi diff --git a/testModule/kernel_modules/nbd.ko b/testModule/kernel_modules/nbd.ko index 47cf6cd6..e8c3f40f 100644 Binary files a/testModule/kernel_modules/nbd.ko and b/testModule/kernel_modules/nbd.ko differ diff --git a/testModule/kernel_modules/nbd.ko.backup b/testModule/kernel_modules/nbd.ko.backup deleted file mode 100644 index e8c3f40f..00000000 Binary files a/testModule/kernel_modules/nbd.ko.backup and /dev/null differ diff --git a/testModule/kernel_modules/nbd.ko.old b/testModule/kernel_modules/nbd.ko.old deleted file mode 100644 index 40b67a92..00000000 Binary files a/testModule/kernel_modules/nbd.ko.old and /dev/null differ diff --git a/testModule/module-setup.sh b/testModule/module-setup.sh index 009941fd..e9bf84f8 100644 --- a/testModule/module-setup.sh +++ b/testModule/module-setup.sh @@ -5,7 +5,7 @@ check() { } depends() { - echo base network rootfs-block bash kernel-modules debug systemd + echo base network bash kernel-modules return 0 } @@ -30,15 +30,8 @@ install() { # Loads globally needed useful functions or fixes some native dracut ones. inst "$moddir/library.sh" /usr/lib/test-library.sh - inst "$moddir/binaries/systemd_preserve_process_marker" /usr/bin/systemd_preserve_process_marker - inst "$moddir/binaries/endless" /usr/bin/endless - inst "$moddir/binaries/endless" /usr/bin/@endless - inst "$moddir/binaries/dnbd3-client" /usr/bin/dnbd3-client - inst "$moddir/binaries/busybox" /usr/bin/busybox - inst "$moddir/binaries/nbd-client" /usr/bin/nbd-client + inst "$moddir/binaries/systemd-preserve-process-marker" /usr/bin/systemd-preserve-process-marker inst "$moddir/binaries/qemu-nbd" /usr/bin/qemu-nbd - inst "$moddir/binaries/qemu-nbd" /usr/bin/@qemu-nbd - inst "$moddir/binaries/qemu-nbd-systemd-mark" /usr/bin/qemu-nbd-systemd-mark inst "$moddir/binaries/qemu-nbd-systemd-mark-alternate" /usr/bin/qemu-nbd-systemd-mark-alternate inst "$moddir/kernel_modules/dnbd3.ko" /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/dnbd3.ko @@ -48,13 +41,12 @@ install() { # since we have to modify the some kernel parameter before. inst_hook cmdline 1 "$moddir/hooks/cmdline.sh" inst_hook pre-mount 10 "$moddir/hooks/pre-mount.sh" - inst_hook mount 10 "$moddir/hooks/mount.sh" - inst_hook pre-pivot 10 "$moddir/hooks/pre-pivot.sh" + # NOTE: Hook "mount" isn't executed on tested version. + inst_hook pre-pivot 10 "$moddir/hooks/mount.sh" 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 # Production: inst_multiple insmod qemu-img # qemu-nbd - #dracut_need_initqueue return 0 } diff --git a/testModule/systemd-preserve-process-marker.c b/testModule/systemd-preserve-process-marker.c new file mode 100644 index 00000000..172a5546 --- /dev/null +++ b/testModule/systemd-preserve-process-marker.c @@ -0,0 +1,31 @@ +#include +#include +#include +#include + +void print_array(int argc, char *argv[]) { + // Helper function to print given array with given length. + int i = 0; + int j = 0; + for (i = 0; i < argc; i ++) { + j = 0; + while(argv[i][j] != '\0') + printf("%c", argv[i][j++]); + printf(" "); + } + printf("\n"); +} +int main(int argc, char *argv[]) { + int count; + char **copy = malloc(sizeof(char *) * (argc-1)); + for (count = 0; count < argc - 1; count++) + copy[count] = strdup(argv[count + 1]); + // Adding systemd indicator to preserve wrapped process during changing + // root filesystem. We mark wrapper and child process. + copy[0][0] = '@'; + argv[0][0] = '@'; + if (-1 == execvp(argv[1], copy)) { + perror("child process execve failed [%m]"); + return -1; + } +} diff --git a/testModule/systemd_preserve_process_marker.c b/testModule/systemd_preserve_process_marker.c deleted file mode 100644 index 172a5546..00000000 --- a/testModule/systemd_preserve_process_marker.c +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include -#include -#include - -void print_array(int argc, char *argv[]) { - // Helper function to print given array with given length. - int i = 0; - int j = 0; - for (i = 0; i < argc; i ++) { - j = 0; - while(argv[i][j] != '\0') - printf("%c", argv[i][j++]); - printf(" "); - } - printf("\n"); -} -int main(int argc, char *argv[]) { - int count; - char **copy = malloc(sizeof(char *) * (argc-1)); - for (count = 0; count < argc - 1; count++) - copy[count] = strdup(argv[count + 1]); - // Adding systemd indicator to preserve wrapped process during changing - // root filesystem. We mark wrapper and child process. - copy[0][0] = '@'; - argv[0][0] = '@'; - if (-1 == execvp(argv[1], copy)) { - perror("child process execve failed [%m]"); - return -1; - } -} -- cgit v1.2.3-55-g7522