diff options
author | Will Woods <wwoods@redhat.com> | 2012-03-06 18:30:44 -0500 |
---|---|---|
committer | Will Woods <wwoods@redhat.com> | 2012-03-16 12:36:58 -0400 |
commit | 6e96a9bad1a51e9ff375fd17464a3aa5a7a21ed0 (patch) | |
tree | e5aa5456fae7a617bb9da902696a9048deece611 /dracut/anaconda-netroot.sh | |
parent | e0713b1028667c1ad01ab12c5645ac2d5f18825c (diff) | |
download | anaconda-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-x | dracut/anaconda-netroot.sh | 42 |
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 |