]>
git.ipfire.org Git - thirdparty/dracut.git/blob - modules.d/90livenet/livenetroot.sh
747a0706ac17b8646770f22f376f86155397fc83
2 # livenetroot - fetch a live image from the network and run it
4 type getarg
>/dev
/null
2>&1 || .
/lib
/dracut-lib.sh
8 PATH
=/usr
/sbin
:/usr
/bin
:/sbin
:/bin
9 RETRIES
={$RETRIES:-100}
12 [ -e /tmp
/livenet.downloaded
] && exit 0
14 # args get passed from 40network/netroot
16 liveurl
="${netroot#livenet:}"
17 info
"fetching $liveurl"
20 #retry until the imgfile is populated with data or the max retries
21 for (( i
=1; i
<=$RETRIES; i
++))
23 imgfile
=$
(fetch_url
"$liveurl")
26 warn
"failed to download live image: error $?"
30 if [ ! -z "$imgfile" -a -s "$imgfile" ]; then
33 if [ $i -ge $RETRIES ]; then
34 warn
"failed to download live image after $i attempts."
40 done > /tmp
/livenet.downloaded
42 # TODO: couldn't dmsquash-live-root handle this?
43 if [ ${imgfile##*.} = "iso" ]; then
45 losetup
$root $imgfile
50 exec /sbin
/dmsquash-live-root
$root