]> git.ipfire.org Git - thirdparty/dracut.git/blob - modules.d/90livenet/livenetroot.sh
TEST-30-ISCSI/test.sh: factor out client runs
[thirdparty/dracut.git] / modules.d / 90livenet / livenetroot.sh
1 #!/bin/bash
2 # livenetroot - fetch a live image from the network and run it
3
4 type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
5 [ -f /tmp/root.info ] && . /tmp/root.info
6
7 . /lib/url-lib.sh
8
9 PATH=/usr/sbin:/usr/bin:/sbin:/bin
10
11 # args get passed from 40network/netroot
12 netroot="$2"
13 liveurl="${netroot#livenet:}"
14 info "fetching $liveurl"
15 imgfile=$(fetch_url "$liveurl")
16 [ $? = 0 ] || die "failed to download live image: error $?"
17
18 # TODO: couldn't dmsquash-live-root handle this?
19 if [ ${imgfile##*.} = "iso" ]; then
20 root=$(losetup -f)
21 losetup $root $imgfile
22 else
23 root=$imgfile
24 fi
25
26 exec /sbin/dmsquash-live-root $root