File: module-setup.sh

package info (click to toggle)
dracut 109-11
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,864 kB
  • sloc: sh: 24,529; ansic: 5,234; makefile: 346; perl: 186; python: 48; javascript: 19
file content (66 lines) | stat: -rwxr-xr-x 1,695 bytes parent folder | download | duplicates (2)
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
59
60
61
62
63
64
65
66
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

get_boot_zipl_dev() {
    local _boot_zipl
    _boot_zipl=$(sed -n -e '/^[[:space:]]*#/d' -e 's/\(.*\)\w*\/boot\/zipl.*/\1/p' "${dracutsysrootdir-}"/etc/fstab)
    printf "%s" "$(trim "$_boot_zipl")"
}

# called by dracut
check() {
    local _arch=${DRACUT_ARCH:-$(uname -m)}
    # Only for systems on s390 using indirect booting via userland grub
    [ "$_arch" = "s390" ] || [ "$_arch" = "s390x" ] || return 1
    # /boot/zipl contains a first stage kernel used to launch grub in initrd
    [ -d /boot/zipl ] || return 1
    return 0
}

# called by dracut
depends() {
    echo bash initqueue
}

# called by dracut
installkernel() {
    local _boot_zipl

    _boot_zipl=$(get_boot_zipl_dev)
    if [ -n "$_boot_zipl" ]; then
        eval "$(blkid -s TYPE -o udev "${_boot_zipl}")"
        if [ -n "$ID_FS_TYPE" ]; then
            case "$ID_FS_TYPE" in
                ext?)
                    ID_FS_TYPE=ext4
                    ;;
            esac
            instmods "${ID_FS_TYPE}"
        fi
    fi
}

# called by dracut
cmdline() {
    local _boot_zipl

    _boot_zipl=$(get_boot_zipl_dev)
    if [ -n "$_boot_zipl" ]; then
        printf "%s" " rd.zipl=${_boot_zipl}"
    fi
}

# called by dracut
install() {
    inst_multiple mount umount

    inst_hook cmdline 91 "$moddir/parse-zipl.sh"
    inst_script "${moddir}/install_zipl_cmdline.sh" /sbin/install_zipl_cmdline.sh
    if [[ $hostonly_cmdline == "yes" ]]; then
        local _zipl
        _zipl=$(cmdline)

        [[ $_zipl ]] && printf "%s\n" "$_zipl" > "${initdir}/etc/cmdline.d/19-zipl.conf"
    fi
}