summaryrefslogtreecommitdiffstats
path: root/dracut/anaconda-diskroot
blob: 21c8afec2dc6ef245d8a6687602e8977d5bf331d (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
#!/bin/sh
# anaconda-diskroot: find our root image on the given disk device
# usage: anaconda-diskroot DEVICE [PATH]

. /lib/anaconda-lib.sh
command -v getargbool >/dev/null || . /lib/dracut-lib.sh

# Run checkisomd5 on a device
run_checkisomd5() {
    livedev=$1
    if getargbool 0 rd.live.check -d check; then
        [ -b $livedev ] && fs=$(blkid -s TYPE -o value $livedev)
        if [ "$fs" = "iso9660" -o "$fs" = "udf" ]; then
            [ -x /bin/plymouth ] && /bin/plymouth --hide-splash
            if [ -n "$DRACUT_SYSTEMD" ]; then
                p=$(str_replace "$livedev" "-" '\x2d')
                systemctl start checkisomd5@${p}.service
            else
                checkisomd5 --verbose $livedev
            fi
            if [ $? -ne 0 ]; then
                die "CD check failed!"
                exit 1
            fi
            [ -x /bin/plymouth ] && /bin/plymouth --show-splash
        fi
    fi
}

dev="$1"
path="$2" # optional, could be empty

[ -e "/dev/root" ] && exit 1 # we already have a root device!

info "anaconda using disk root at $dev"
mount $dev $repodir || warn "Couldn't mount $dev"
anaconda_live_root_dir $repodir $path
run_checkisomd5 $dev