summaryrefslogtreecommitdiffstats
path: root/testModule/module-setup.sh
blob: a31c111148b654f8a3f29c4d8b64046163873841 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash

check() {
    return 0
}

depends() {
    echo base network bash kernel-modules
    return 0
}

installkernel() {
    # Debugging:
    #instmods nbd 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 \
    #    ip6table_security ip6table_raw ip6table_filter ip6_tables \
    #    iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat \
    #    nf_conntrack iptable_mangle iptable_security iptable_raw \
    #    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 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
    # Production:
    instmods nbd ext4
}

install() {
    # Loads globally needed useful functions or fixes some native dracut ones.
    inst "$moddir/library.sh" /usr/lib/test-library.sh

    inst "$moddir/binaries/dnbd3-client" /usr/bin/dnbd3-client
    inst "$moddir/binaries/systemd-preserve-process-marker" \
        /usr/bin/systemd-preserve-process-marker

    inst "$moddir/kernel_modules/dnbd3.ko" \
        /usr/lib/modules/current/extra/dnbd3.ko
    inst "$moddir/kernel_modules/nbd.ko" \
        /usr/lib/modules/current/extra/nbd.ko

    # 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 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"

    # Debugging:
    #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
    return 0
}