crypt: check for crypttab before reading
[dracut.git] / modules.d / 90livenet / fetch-liveupdate.sh
blob024feaac6d9a6db6491f4f9723882cd8f8e54596
1 #!/bin/bash
2 # fetch-liveupdate - fetch an update image for dmsquash-live media.
3 # this gets called by the "initqueue/online" hook for each network interface
4 # that comes online.
6 # no updates requested? we're not needed.
7 [ -e /tmp/liveupdates.info ] || return 0
9 command -v getarg >/dev/null || . /lib/dracut-lib.sh
10 command -v fetch_url >/dev/null || . /lib/url-lib.sh
11 command -v unpack_img >/dev/null || . /lib/img-lib.sh
13 read url < /tmp/liveupdates.info
15 info "fetching live updates from $url"
17 fetch_url "$url" /tmp/updates.img
18 if [ $? != 0 ]; then
19 warn "failed to fetch update image!"
20 warn "url: $url"
21 return 1
24 unpack_img /tmp/updates.img /updates.tmp.$$
25 if [ $? != 0 ]; then
26 warn "failed to unpack update image!"
27 warn "url: $url"
28 return 1
30 copytree /updates.tmp.$$ /updates
31 mv /tmp/liveupdates.info /tmp/liveupdates.done