summaryrefslogtreecommitdiffstats
path: root/modules.d/91zipl/install_zipl_cmdline.sh
blob: 9332d31431d8884b891e739ee3c8e0c2fc00958b (plain)
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
#!/bin/bash

DEV="$1"
MNT=/boot/zipl

if [ -z "$DEV" ]; then
    echo "No IPL device given"
    : > /tmp/install.zipl.cmdline-done
    exit 1
fi

[ -d ${MNT} ] || mkdir -p ${MNT}

if ! mount -o ro "${DEV}" ${MNT}; then
    echo "Failed to mount ${MNT}"
    : > /tmp/install.zipl.cmdline-done
    exit 1
fi

if [ -f ${MNT}/dracut-cmdline.conf ]; then
    cp ${MNT}/dracut-cmdline.conf /etc/cmdline.d/99zipl.conf
fi

if [ -f ${MNT}/active_devices.txt ]; then
    while read -r dev _ || [[ $dev ]]; do
        [ "$dev" = "#" -o "$dev" = "" ] && continue
        cio_ignore -r "$dev"
    done < ${MNT}/active_devices.txt
fi

umount ${MNT}

if [ -f /etc/cmdline.d/99zipl.conf ]; then
    systemctl restart dracut-cmdline.service
    systemctl restart systemd-udev-trigger.service
fi
: > /tmp/install.zipl.cmdline-done

exit 0