diff options
| author | torben | 2015-04-13 17:16:26 +0200 |
|---|---|---|
| committer | torben | 2015-04-13 17:16:26 +0200 |
| commit | a232649db621930758e80e9be6e5834e8d91517e (patch) | |
| tree | d6191dc704f57d972c06013962296084939cfe9e | |
| parent | basic wrapper (diff) | |
| download | systemd-init-a232649db621930758e80e9be6e5834e8d91517e.tar.gz systemd-init-a232649db621930758e80e9be6e5834e8d91517e.tar.xz systemd-init-a232649db621930758e80e9be6e5834e8d91517e.zip | |
Adding remotly notifyable test initramfs service.
| -rwxr-xr-x | grub2.conf | 4 | ||||
| -rw-r--r-- | testModule/module-setup.sh | 8 | ||||
| -rw-r--r-- | testModule/mount-dnbd3.sh | 21 | ||||
| -rw-r--r-- | testModule/parse-ip.sh | 11 | ||||
| -rwxr-xr-x | testModule/process-name-wrapper.sh | 5 | ||||
| -rwxr-xr-x | testModule/test-service.sh | 6 | ||||
| -rwxr-xr-x | testModule/wrap | bin | 0 -> 7752 bytes | |||
| -rw-r--r-- | testModule/wrap.c | 46 |
8 files changed, 57 insertions, 44 deletions
@@ -6,10 +6,10 @@ menuentry 'test' --class centos --class gnu-linux --class gnu --class os --unres insmod part_msdos insmod xfs set root='hd0,msdos1' - linux16 /vmlinuz-3.10.0-229.1.2.el7.x86_64 ro vconsole.font=latarcyrheb-sun16 vconsole.keymap=de rd.break=cleanup root=UUID=6c06919a-389a-4a50-8c6b-b086e65db9b0 rd.udev.log-priority=debug ip=10.0.2.15:132.230.4.2:10.0.2.2:255.255.255.0 # NOTE: Prevents dracut console: console=tty0 console=ttyS0,9600 ip=enp0s3:dhcp - # selxsrv=132.230.4.2 slxbase=boot/openselx-productive quiet splash vga=current wurstgesicht initrd=http://132.230.4.2/boot/openslx-productive/initramfs-stage31 ip=132.230.4.67:132.230.4.2:132.230.4.254:255.255.255.0 BOOTIF=01-08-00-27-60-49-62 BOOT_IMAGE=http://132.230.4.2/boot/openslx-productive/kernel + linux16 /vmlinuz-3.10.0-229.1.2.el7.x86_64 ro vconsole.font=latarcyrheb-sun16 vconsole.keymap=de rd.break root=UUID=6c06919a-389a-4a50-8c6b-b086e65db9b0 rd.udev.log-priority=debug ip=10.0.2.15:132.230.4.2:10.0.2.2:255.255.255.0 # NOTE: Prevents dracut console: console=tty0 console=ttyS0,9600 ip=enp0s3:dhcp rd.debug rd.shell rd.info root=/dev/nbd0 rootfstype=ext4 initrd16 /initramfs-test.img + # fully given: selxsrv=132.230.4.2 slxbase=boot/openselx-productive quiet splash vga=current wurstgesicht initrd=http://132.230.4.2/boot/openslx-productive/initramfs-stage31 ip=132.230.4.67:132.230.4.2:132.230.4.254:255.255.255.0 BOOTIF=01-08-00-27-60-49-62 BOOT_IMAGE=http://132.230.4.2/boot/openslx-productive/kernel # given: ip=132.230.4.67:132.230.4.2:132.230.4.254:255.255.255.0 # test: ip=10.0.2.15:132.230.4.2:10.0.2.2:255.255.255.0 # working dracut configuration: ip=10.0.2.15::10.0.2.2:255.255.255.0:test:enp0s3:none diff --git a/testModule/module-setup.sh b/testModule/module-setup.sh index ae30de9f..d0086300 100644 --- a/testModule/module-setup.sh +++ b/testModule/module-setup.sh @@ -10,7 +10,7 @@ depends() { } installkernel() { - instmods dnbd3 nbd ext4 \ + instmods ext4 mbcache jbd2 \ ip6t_rpfilter ip6t_REJEiCT ipt_REJECT xt_conntrack ebtable_nat \ ebtable_broute bridge stp llc ebtable_filter ebtables ip6table_nat \ nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle \ @@ -20,7 +20,7 @@ installkernel() { iptable_filter ip_tables vboxsf sg ppdev snd_intel8x0 snd_ac97_codec \ ac97_bus serio_raw snd_seq snd_seq_device i2c_piix4 pcspkr snd_pcm \ parport_pc parport snd_page_alloc snd_timer snd video soundcore e1000 \ - mperf xfs libcrc32c sd_mod crc_t10dif crct10dif_common sr_mod cdrom \ + mperf libcrc32c sd_mod crc_t10dif crct10dif_common sr_mod cdrom \ ata_generic pata_acpi ahci libahci vboxvideo drm i2c_core ata_piix \ libata vboxguest dm_mirror dm_region_hash dm_log dm_mod } @@ -28,6 +28,8 @@ 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/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 @@ -37,6 +39,6 @@ install() { inst_hook pre-mount 100 "$moddir/mount-dnbd3.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 + inst_multiple lsblk ping ip ifconfig sshd htop dhclient tail head cat vim touch sed lsmod insmod qemu-img qemu-nbd sleep route wget return 0 } diff --git a/testModule/mount-dnbd3.sh b/testModule/mount-dnbd3.sh index 9629a153..c8b7f267 100644 --- a/testModule/mount-dnbd3.sh +++ b/testModule/mount-dnbd3.sh @@ -1,15 +1,14 @@ -insmod /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/dnbd3.ko +# TODO +warn '............JAU.............' +warn '............JAU.............' -dnbd3-client --daemon & -sleep 2 -local dnbd3_device_node="$(dnbd3-client -h 132.230.4.1 -i stage4/torben/test -r 1)" +insmod /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/dnbd3.ko +#dnbd3-client --daemon & +#sleep 3 +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 /tmp/test.qcow2 insmod /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/nbd.ko -qemu-nbd -c /dev/nbd0 /tmp/test.qcow2 -mkdir /mnt -mount /dev/nbd0 /mnt - -warn '............JAU.............' -warn '............JAU.............' -warn '............JAU.............' +wrap qemu-nbd -c /dev/nbd0 /tmp/test.qcow2 +#mount /dev/nbd0 /sysroot diff --git a/testModule/parse-ip.sh b/testModule/parse-ip.sh index 3349787b..5731242f 100644 --- a/testModule/parse-ip.sh +++ b/testModule/parse-ip.sh @@ -1,12 +1,11 @@ # Converts ip configuration format given by the pxe pre boot provider to a # dracut compatible static ip configuration. -source /usr/lib/test-library.sh - # TODO warn 'LOAD ...........................' warn 'LOAD ...........................' -warn 'LOAD ...........................' + +source /usr/lib/test-library.sh for parameter in $(getargs ip=); do local temp="$parameter:" @@ -22,8 +21,10 @@ for parameter in $(getargs ip=); do [ -n "$4" ] && net_mask=$4 warn "PXE given net configuration: ip: $ip server_ip: $server_ip gateway_ip: $gateway_ip net_mask: $net_mask" - # TODO - replace_cmd ip "$ip::$gateway_ip:$net_mask:dracut_test_client:enp0s3:none" + local final_dracut_ip_config="$ip::$gateway_ip:$net_mask:dracut_test_client:enp0s3:none" + warn "Final dracut ip config: $final_dracut_ip_config" + #final_dracut_ip_config="enp0s3:dhcp" + replace_cmd ip "$final_dracut_ip_config" done # NOTE: Doesn't work since dracuts needed version of mount doesn't support diff --git a/testModule/process-name-wrapper.sh b/testModule/process-name-wrapper.sh new file mode 100755 index 00000000..36712e51 --- /dev/null +++ b/testModule/process-name-wrapper.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +programPath="$(echo "$0" | sed --regexp-extended 's/^(.*)@([^/]+)$/\1\2/')" +echo "Run \"$programPath\" with arguments \"${@}\"." && \ +exec "$programPath" "$@" diff --git a/testModule/test-service.sh b/testModule/test-service.sh new file mode 100755 index 00000000..cc81da9e --- /dev/null +++ b/testModule/test-service.sh @@ -0,0 +1,6 @@ +#!/usr/bin/bash + +while true; do + wget http://10.126.2.184:8080 + sleep 2 +done diff --git a/testModule/wrap b/testModule/wrap Binary files differnew file mode 100755 index 00000000..bb5590d3 --- /dev/null +++ b/testModule/wrap diff --git a/testModule/wrap.c b/testModule/wrap.c index 0f118235..51ca2d8c 100644 --- a/testModule/wrap.c +++ b/testModule/wrap.c @@ -4,38 +4,38 @@ #include <stdio.h> void arg_print(int argc, char *argv[]) { - 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 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[]) { - arg_print(argc, argv); + arg_print(argc, argv); int count; - char **copy = malloc(sizeof(char *) * (argc-1)); - for ( count = 0; count < argc - 1; count++ ) { - copy[count] = strdup(argv[count + 1]); - } + char **copy = malloc(sizeof(char *) * (argc-1)); + for ( count = 0; count < argc - 1; count++ ) { + copy[count] = strdup(argv[count + 1]); + } - arg_print(argc - 1, copy); + arg_print(argc - 1, copy); - copy[0][0] = '@'; - argv[0][0] = '@'; + copy[0][0] = '@'; + argv[0][0] = '@'; - arg_print(argc - 1, copy); + arg_print(argc - 1, copy); - if (-1 == execvp(argv[1], copy)) { - perror("child process execve failed [%m]"); - return -1; - } + if (-1 == execvp(argv[1], copy)) { + perror("child process execve failed [%m]"); + return -1; + } } |
