[PATCH] Make 'ks=cdrom' scan all optical media (#828589)

Will Woods wwoods at redhat.com
Fri Oct 25 18:18:32 UTC 2013


In Ye Olde Times, 'ks=cdrom' would make loader poll all optical drives
for media. We can do that pretty easily with udev these days, so let's
bring that behavior back.

The syntax for inst.ks=cdrom is now: inst.ks=cdrom[:<path>].

Note that there's no <dev> argument anymore; if you know what device
your kickstart is on, use "inst.ks=hd:<dev>[:<path>]" instead.

We'll still accept "inst.ks=cdrom:<dev>:<path>", but <dev> will be
ignored.

While I'm at it, I've cleaned up kickstart-genrules.sh so it's easier to
follow and it prints better log messages. Woo!
---
 dracut/kickstart-genrules.sh       | 30 ++++++++++++++++++------------
 dracut/parse-anaconda-kickstart.sh |  1 +
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/dracut/kickstart-genrules.sh b/dracut/kickstart-genrules.sh
index f29ad87..25165e6 100755
--- a/dracut/kickstart-genrules.sh
+++ b/dracut/kickstart-genrules.sh
@@ -4,22 +4,28 @@
 . /lib/anaconda-lib.sh
 
 case "${kickstart%%:*}" in
-    http|https|ftp|nfs)
+    http|https|ftp|nfs|nfs4)
         # handled by fetch-kickstart-net in the online hook
+        info "inst.ks: will fetch kickstart once network comes online"
         wait_for_kickstart
     ;;
-    cdrom|hd|bd) # cdrom, cdrom:<dev>:<path>, hd:<dev>:<path>, bd:<dev>:<path>
+    cdrom) # cdrom, cdrom:<path> - kickstart on optical media
+        splitsep ":" "$kickstart" kstype kspath
+        # if we get cdrom:<dev>:<path>, split out (and ignore) the ksdev
+        strstr "$kspath" ":" && splitsep ":" "$kickstart" kstype ksdev kspath
+        printf 'SUBSYSTEM=="block", ENV{ID_CDROM_MEDIA}=="1", RUN+="/sbin/initqueue --settled --onetime --name cdrom-ks fetch-kickstart-disk $env{DEVNAME} %s"\n' "$kspath" >> $rulesfile
+        info "inst.ks: will scan optical media for ${kspath:-/ks.cfg}"
+        wait_for_kickstart
+    ;;
+    hd) # hd:<dev>:<path> - kickstart on disk device
         splitsep ":" "$kickstart" kstype ksdev kspath
-        [ "$kstype" = "cdrom" ] && [ -z "$ksdev" ] && ksdev="/dev/cdrom"
         ksdev=$(disk_to_dev_path $ksdev)
-        if [ "$kstype" = "bd" ]; then # TODO FIXME: no biospart support yet
-            warn "inst.ks='$kickstart'"
-            warn "can't get kickstart: biospart isn't supported yet"
-            ksdev=""
-        else
-            when_diskdev_appears "$ksdev" \
-                fetch-kickstart-disk \$env{DEVNAME} "$kspath"
-            wait_for_kickstart
-        fi
+        when_diskdev_appears "$ksdev" \
+            fetch-kickstart-disk \$env{DEVNAME} "$kspath"
+        info "inst.ks: will look for ${kspath:-/ks.cfg} on $ksdev"
+        wait_for_kickstart
+    ;;
+    bd) # bd:<dev>:<path> - biospart (TODO... if anyone uses this anymore)
+        warn "inst.ks: can't get kickstart - biospart (bd:) isn't supported yet"
     ;;
 esac
diff --git a/dracut/parse-anaconda-kickstart.sh b/dracut/parse-anaconda-kickstart.sh
index d445e27..930b6b6 100755
--- a/dracut/parse-anaconda-kickstart.sh
+++ b/dracut/parse-anaconda-kickstart.sh
@@ -29,5 +29,6 @@ case "${kickstart%%:*}" in
             warn "can't find $kspath!"
         fi
     ;;
+    # cdrom/hd are handled later - see (pre-trigger/50-)kickstart-genrules.sh
 esac
 export kickstart
-- 
1.8.3.1



More information about the anaconda-patches mailing list