summaryrefslogtreecommitdiffstats
path: root/dracut/anaconda-netroot.sh
diff options
context:
space:
mode:
authorWill Woods <wwoods@redhat.com>2012-03-06 18:30:44 -0500
committerWill Woods <wwoods@redhat.com>2012-03-16 12:36:58 -0400
commit6e96a9bad1a51e9ff375fd17464a3aa5a7a21ed0 (patch)
treee5aa5456fae7a617bb9da902696a9048deece611 /dracut/anaconda-netroot.sh
parente0713b1028667c1ad01ab12c5645ac2d5f18825c (diff)
downloadanaconda-6e96a9bad1a51e9ff375fd17464a3aa5a7a21ed0.tar.gz
anaconda-6e96a9bad1a51e9ff375fd17464a3aa5a7a21ed0.tar.xz
anaconda-6e96a9bad1a51e9ff375fd17464a3aa5a7a21ed0.zip
Use "online" hook to handle anaconda network root devices
replace anaconda{nfs,url}root with anaconda-netroot.sh fix up the arg parsing accordingly
Diffstat (limited to 'dracut/anaconda-netroot.sh')
-rwxr-xr-xdracut/anaconda-netroot.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/dracut/anaconda-netroot.sh b/dracut/anaconda-netroot.sh
new file mode 100755
index 000000000..8ca66b5f0
--- /dev/null
+++ b/dracut/anaconda-netroot.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+# network root script for anaconda.
+# runs in the "online" hook, every time an interface comes online.
+
+command -v getarg >/dev/null || . /lib/dracut-lib.sh
+
+# get repo and root info
+[ -e /tmp/root.info ] && . /tmp/root.info
+repo=$(getarg repo= inst.repo=)
+
+# no repo? non-net root? we're not needed here.
+[ "$root" = "anaconda-net" ] && [ -n "$repo" ] || return 0
+
+# get network/kickstart info
+[ -e /tmp/ks.info ] && . /tmp/ks.info
+# user requested a specific network device, but this isn't it - bail out
+[ -n "$ksdevice" ] && [ "$ksdevice" != "$netif" ] && return 0
+
+command -v config_get >/dev/null || . /lib/anaconda-lib.sh
+
+case $repo in
+ nfs*)
+ . /lib/nfs-lib.sh
+ info "anaconda mounting NFS repo at $repo"
+ mount_nfs "$repo" "$repodir" "$netif" || warn "Couldn't mount $repo"
+ anaconda_live_root_dir $repodir
+ ;;
+ http*|ftp*)
+ . /lib/url-lib.sh
+ info "anaconda fetching installer from $repo"
+ treeinfo=$(fetch_url $repo/.treeinfo) && \
+ stage2=$(config_get stage2 mainimage < $treeinfo)
+ if [ -z "$stage2" ]; then
+ warn "can't find installer mainimage path in .treeinfo"
+ stage2="LiveOS/squashfs.img"
+ fi
+ runtime=$(fetch_url $repo/$stage2) && /sbin/dmsquash-live-root $runtime
+ ;;
+ *)
+ warn "unknown network repo URL: $repo"
+ ;;
+esac