summaryrefslogtreecommitdiffstats
path: root/testModule
diff options
context:
space:
mode:
authortorben2015-04-13 20:09:38 +0200
committertorben2015-04-13 20:09:38 +0200
commit91cc532a55fed3c6c27a2e14759e901ed3d72579 (patch)
tree18cc276173bc543b38e84143674429a306c26f0e /testModule
parentAdding endless test service. Fix some naming conventions. (diff)
downloadsystemd-init-91cc532a55fed3c6c27a2e14759e901ed3d72579.tar.gz
systemd-init-91cc532a55fed3c6c27a2e14759e901ed3d72579.tar.xz
systemd-init-91cc532a55fed3c6c27a2e14759e901ed3d72579.zip
Code refactoring.
Diffstat (limited to 'testModule')
-rwxr-xr-xtestModule/binaries/busybox (renamed from testModule/busybox)bin931664 -> 931664 bytes
-rwxr-xr-xtestModule/binaries/dnbd3-client (renamed from testModule/dnbd3-client)bin31150 -> 31150 bytes
-rwxr-xr-xtestModule/binaries/endless (renamed from testModule/endless)bin6752 -> 6752 bytes
-rwxr-xr-xtestModule/binaries/systemd_preserve_process_markerbin0 -> 7728 bytes
-rw-r--r--testModule/deprecated/network.functions (renamed from testModule/network.functions)0
-rw-r--r--testModule/deprecated/setup_network.sh (renamed from testModule/setup_network.sh)0
-rw-r--r--testModule/endless.c4
-rw-r--r--testModule/hooks/cmdline.sh (renamed from testModule/parse-ip.sh)0
-rw-r--r--testModule/hooks/pre-mount.sh (renamed from testModule/pre-mount.sh)0
-rw-r--r--testModule/hooks/pre-pivot.sh (renamed from testModule/pre-pivot.sh)0
-rwxr-xr-xtestModule/kernel_modules/dnbd3.ko (renamed from testModule/dnbd3.ko)bin1345285 -> 1345285 bytes
-rw-r--r--testModule/kernel_modules/nbd.ko (renamed from testModule/nbd.ko)bin458623 -> 458623 bytes
-rw-r--r--testModule/module-setup.sh18
-rwxr-xr-xtestModule/process-name-wrapper.sh5
-rw-r--r--testModule/systemd_preserve_process_marker.c (renamed from testModule/wrap.c)21
-rwxr-xr-xtestModule/wrapbin7752 -> 0 bytes
16 files changed, 17 insertions, 31 deletions
diff --git a/testModule/busybox b/testModule/binaries/busybox
index 1212ae20..1212ae20 100755
--- a/testModule/busybox
+++ b/testModule/binaries/busybox
Binary files differ
diff --git a/testModule/dnbd3-client b/testModule/binaries/dnbd3-client
index 76924b49..76924b49 100755
--- a/testModule/dnbd3-client
+++ b/testModule/binaries/dnbd3-client
Binary files differ
diff --git a/testModule/endless b/testModule/binaries/endless
index e3c61074..de7a8c0a 100755
--- a/testModule/endless
+++ b/testModule/binaries/endless
Binary files differ
diff --git a/testModule/binaries/systemd_preserve_process_marker b/testModule/binaries/systemd_preserve_process_marker
new file mode 100755
index 00000000..0181cd80
--- /dev/null
+++ b/testModule/binaries/systemd_preserve_process_marker
Binary files differ
diff --git a/testModule/network.functions b/testModule/deprecated/network.functions
index 89ca5a20..89ca5a20 100644
--- a/testModule/network.functions
+++ b/testModule/deprecated/network.functions
diff --git a/testModule/setup_network.sh b/testModule/deprecated/setup_network.sh
index 3b32a68c..3b32a68c 100644
--- a/testModule/setup_network.sh
+++ b/testModule/deprecated/setup_network.sh
diff --git a/testModule/endless.c b/testModule/endless.c
index e3598e88..22c9bc50 100644
--- a/testModule/endless.c
+++ b/testModule/endless.c
@@ -4,7 +4,7 @@
#include <stdio.h>
int main(int argc, char *argv[]) {
- // argv[0][0] = '@';
+ // Provides a dummy worker.
while (1)
- sleep(5);
+ sleep(999999999);
}
diff --git a/testModule/parse-ip.sh b/testModule/hooks/cmdline.sh
index 5731242f..5731242f 100644
--- a/testModule/parse-ip.sh
+++ b/testModule/hooks/cmdline.sh
diff --git a/testModule/pre-mount.sh b/testModule/hooks/pre-mount.sh
index 301381e6..301381e6 100644
--- a/testModule/pre-mount.sh
+++ b/testModule/hooks/pre-mount.sh
diff --git a/testModule/pre-pivot.sh b/testModule/hooks/pre-pivot.sh
index c868fc30..c868fc30 100644
--- a/testModule/pre-pivot.sh
+++ b/testModule/hooks/pre-pivot.sh
diff --git a/testModule/dnbd3.ko b/testModule/kernel_modules/dnbd3.ko
index d7b7ce3b..d7b7ce3b 100755
--- a/testModule/dnbd3.ko
+++ b/testModule/kernel_modules/dnbd3.ko
Binary files differ
diff --git a/testModule/nbd.ko b/testModule/kernel_modules/nbd.ko
index 40b67a92..40b67a92 100644
--- a/testModule/nbd.ko
+++ b/testModule/kernel_modules/nbd.ko
Binary files differ
diff --git a/testModule/module-setup.sh b/testModule/module-setup.sh
index 1718cca3..5451bb42 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 systemd shutdown udev-rules debug qemu btrfs
+ echo base network rootfs-block bash kernel-modules systemd debug
return 0
}
@@ -28,19 +28,19 @@ installkernel() {
install() {
# Loads globally needed useful functions or fixes some native dracut ones.
inst "$moddir/library.sh" /usr/lib/test-library.sh
- inst "$moddir/process-name-wrapper.sh" /usr/bin/process-name-wrapper
- inst "$moddir/wrap" /usr/bin/wrap
- inst "$moddir/endless" /usr/bin/endless
- inst "$moddir/dnbd3-client" /usr/bin/dnbd3-client
- inst "$moddir/dnbd3.ko" /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/dnbd3.ko
- inst "$moddir/nbd.ko" /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/nbd.ko
+ inst "$moddir/binaries/systemd_preserve_process_marker" /usr/bin/systemd_preserve_process_marker
+ 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/kernel_modules/dnbd3.ko" /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/dnbd3.ko
+ inst "$moddir/kernel_modules/nbd.ko" /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/nbd.ko
# NOTE: Priority has to be greater than the network cmdline parsing hooks
# since we have to modify the some kernel parameter before.
- inst_hook cmdline 100 "$moddir/parse-ip.sh"
+ inst_hook cmdline 100 "$moddir/cmdline.sh"
inst_hook pre-mount 100 "$moddir/pre-mount.sh"
inst_hook pre-pivot 100 "$moddir/pre-pivot.sh"
- inst_simple "$moddir/busybox" /usr/bin/busybox
#inst_hook pre-mount 20 "$moddir/setup_network.sh"
inst_multiple lsblk ping ip ifconfig sshd htop dhclient tail head cat vim touch sed lsmod insmod qemu-img qemu-nbd sleep route wget find
+ # FINAL: inst_multiple insmod qemu-img qemu-nbd
return 0
}
diff --git a/testModule/process-name-wrapper.sh b/testModule/process-name-wrapper.sh
deleted file mode 100755
index 36712e51..00000000
--- a/testModule/process-name-wrapper.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-
-programPath="$(echo "$0" | sed --regexp-extended 's/^(.*)@([^/]+)$/\1\2/')"
-echo "Run \"$programPath\" with arguments \"${@}\"." && \
-exec "$programPath" "$@"
diff --git a/testModule/wrap.c b/testModule/systemd_preserve_process_marker.c
index bfb0b881..172a5546 100644
--- a/testModule/wrap.c
+++ b/testModule/systemd_preserve_process_marker.c
@@ -3,7 +3,8 @@
#include <string.h>
#include <stdio.h>
-void arg_print(int argc, char *argv[]) {
+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 ++) {
@@ -14,25 +15,15 @@ void arg_print(int argc, char *argv[]) {
}
printf("\n");
}
-
-
int main(int argc, char *argv[]) {
-
- arg_print(argc, argv);
-
- int count;
+ int count;
char **copy = malloc(sizeof(char *) * (argc-1));
- for ( count = 0; count < argc - 1; count++ ) {
+ for (count = 0; count < argc - 1; count++)
copy[count] = strdup(argv[count + 1]);
- }
-
- arg_print(argc - 1, copy);
-
+ // Adding systemd indicator to preserve wrapped process during changing
+ // root filesystem. We mark wrapper and child process.
copy[0][0] = '@';
argv[0][0] = '@';
-
- arg_print(argc - 1, copy);
-
if (-1 == execvp(argv[1], copy)) {
perror("child process execve failed [%m]");
return -1;
diff --git a/testModule/wrap b/testModule/wrap
deleted file mode 100755
index bb5590d3..00000000
--- a/testModule/wrap
+++ /dev/null
Binary files differ