[master/rhel7 5/5] driverdisk: Use a single systemd service to start DD UI (#1035663)

Brian C. Lane bcl at redhat.com
Fri Feb 7 02:26:57 UTC 2014


This removes the second driver-updates service for network UI startup
and creates a start_driver_update function that is used by the 3 places
that driver updates need to be processed.

It also moves the driver-fetch-net to run after kickstart-fetch-net so
that kickstart driverdisk network sources can be processed in the same
way as the cmdline network sources.

Related: rhbz#1035663
---
 dracut/Makefile.am                 |  1 -
 dracut/README-dd                   | 26 ++++++++++++++++----------
 dracut/anaconda-lib.sh             | 27 +++++++++++++++++----------
 dracut/driver-updates-net.sh       | 11 +----------
 dracut/driver-updates-net at .service | 17 -----------------
 dracut/driver-updates.sh           | 14 ++------------
 dracut/module-setup.sh             |  3 +--
 7 files changed, 37 insertions(+), 62 deletions(-)
 delete mode 100644 dracut/driver-updates-net at .service

diff --git a/dracut/Makefile.am b/dracut/Makefile.am
index 3bab16a..27cb82b 100644
--- a/dracut/Makefile.am
+++ b/dracut/Makefile.am
@@ -43,7 +43,6 @@ dist_dracut_SCRIPTS = module-setup.sh \
 		      parse-anaconda-dd.sh \
 		      fetch-driver-net.sh \
 		      driver-updates at .service \
-		      driver-updates-net at .service \
 		      driver-updates.sh \
 		      driver-updates-net.sh \
 		      anaconda-depmod.sh \
diff --git a/dracut/README-dd b/dracut/README-dd
index 2c3a1be..ba3f522 100644
--- a/dracut/README-dd
+++ b/dracut/README-dd
@@ -6,8 +6,7 @@ modules before the rest of the installer is executed.
 
 cmdline hook
     parse-anaconda-dd.sh
-    parses the inst.dd/dd arguments for URIs and saves all of them into /tmp/dd_args
-    and calls set_neednet if network is needed to retrieve a driver rpm
+    Calls set_neednet if network is needed to retrieve a driver rpm
     The files will be downloaded when the network device online hook is executed.
 
 initqueue/online
@@ -28,14 +27,11 @@ pre-pivot hook
     anaconda-depmod.sh
     If any drivers were installed or downloaded run depmod on the $NEWROOT
 
-
 Systemd Services
-    driver-updates at .service and driver-updates-net at .service
-    These services launch the driver update UI (/bin/driver-updates). The -net
-    version passes the path to the rpm's that have been downloaded from the
-    network. They handle connecting the tty so that the user can select drivers
-    if inst.dd has been passed on the cmdline.
-
+    driver-updates at .service
+    This service launch the driver update UI (/bin/driver-updates). It handles
+    connecting the tty so that the user can select drivers if inst.dd has
+    been passed on the cmdline.
 
 driver-updates
     This searches disks labeled OEMDRV for driver update repositories and
@@ -45,7 +41,17 @@ driver-updates
 
     Pass it the path to a directory of rpms (eg. downloaded from the
     network) and it will install them before checking for additional OEMDRV
-    labeled devices.
+    labeled devices. It will also do this if /tmp/DD-net/ is present.
+
+    If /tmp/dd_args_ks is present when it runs it will ignore existing
+    OEMDRV devices and process the devices in the file first, then process
+    any new OEMDRV devices that appear.
 
     Pass inst.dd with no parameters and it will prompt the user for specific
     drivers to load using a simple text user interface.
+
+parse-kickstart
+    If the driverdisk command is present in the kickstart it will write
+    out partitions to /tmp/dd_args_ks and network sources to the cmdline
+    for normal network handling. The dd_args_ks devices are handled in
+    run_kickstart using the driver-updates at .service
diff --git a/dracut/anaconda-lib.sh b/dracut/anaconda-lib.sh
index 348b5b4..11be056 100755
--- a/dracut/anaconda-lib.sh
+++ b/dracut/anaconda-lib.sh
@@ -223,17 +223,10 @@ run_kickstart() {
     done
 
     # Run the driver update UI for disks
-    if [ -e "/tmp/dd_ks" ]; then
+    if [ -e "/tmp/dd_args_ks" ]; then
         # TODO: Seems like this should be a function, a mostly same version is used in 3 places
-        tty=$(find_tty)
-
-        # save module state
-        cat /proc/modules > /tmp/dd_modules
-
-        info "Starting Kickstart Driver Update Disk Service on $tty"
-        systemctl start driver-updates@$tty.service
-        status=$(systemctl -p ExecMainStatus show driver-updates@$tty.service)
-        info "DD status=$status"
+        start_driver_update "Kickstart Driver Update Disk"
+        rm /tmp/dd_args_ks
     fi
 
     # replay udev events to trigger actions
@@ -257,3 +250,17 @@ wait_for_kickstart() {
 wait_for_updates() {
     echo "[ -e /tmp/liveupdates.done ]" > $hookdir/initqueue/finished/updates.sh
 }
+
+start_driver_update() {
+    local title="$1"
+
+    tty=$(find_tty)
+
+    # save module state
+    cat /proc/modules > /tmp/dd_modules
+
+    info "Starting $title Service on $tty"
+    systemctl start driver-updates@$tty.service
+    status=$(systemctl -p ExecMainStatus show driver-updates@$tty.service)
+    info "DD status=$status"
+}
diff --git a/dracut/driver-updates-net.sh b/dracut/driver-updates-net.sh
index d4a503f..f8bed52 100755
--- a/dracut/driver-updates-net.sh
+++ b/dracut/driver-updates-net.sh
@@ -5,15 +5,6 @@ command -v getarg >/dev/null || . /lib/dracut-lib.sh
 . /lib/anaconda-lib.sh
 
 if [ -n "$(ls /tmp/DD-net)" ]; then
-    # Run the systemd service for network drivers
-    tty=$(find_tty)
-
-    # Update module list so we don't unload the network driver
-    cat /proc/modules > /tmp/dd_modules
-
-    info "Starting Network Driver Update Disk Service on $tty"
-    systemctl start driver-updates-net@$tty.service
-    status=$(systemctl -p ExecMainStatus show driver-updates-net@$tty.service)
-    info "Network DD status=$status"
+    start_driver_update "Network Driver Update Disk"
     rm -rf /tmp/DD-net
 fi
diff --git a/dracut/driver-updates-net at .service b/dracut/driver-updates-net at .service
deleted file mode 100644
index b457502..0000000
--- a/dracut/driver-updates-net at .service
+++ /dev/null
@@ -1,17 +0,0 @@
-[Unit]
-Description=Network Driver Update Disk UI on %I
-DefaultDependencies=no
-Before=shutdown.target
-
-[Service]
-Type=oneshot
-RemainAfterExit=no
-WorkingDirectory=/tmp
-Environment=LANG=en_US.UTF-8
-ExecStart=/bin/driver-updates /tmp/DD-net/
-StandardInput=tty-force
-StandardOutput=inherit
-StandardError=inherit
-TTYPath=/dev/%I
-TTYReset=yes
-TimeoutSec=0
diff --git a/dracut/driver-updates.sh b/dracut/driver-updates.sh
index 99ca245..e2cc887 100755
--- a/dracut/driver-updates.sh
+++ b/dracut/driver-updates.sh
@@ -12,23 +12,13 @@ blkid_rc=$?
 
 command -v getarg >/dev/null || . /lib/dracut-lib.sh
 dd_args="$(getargs dd= inst.dd=)"
-
-# /tmp/dd_args will have been set by parse-anaconda-dd.sh cmdline hook
 if [ -n "$dd_args" -o $blkid_rc -eq 0 ]; then
     command -v getarg >/dev/null || . /lib/dracut-lib.sh
     . /lib/anaconda-lib.sh
 
-    tty=$(find_tty)
     # kludge to let kernel spit out some extra info w/o stomping on our UI
     sleep 5
-
-    # save module state
-    cat /proc/modules > /tmp/dd_modules
-
     echo "$dd_args" > /tmp/dd_args
-    info "Starting Driver Update Disk Service on $tty"
-    systemctl start driver-updates@$tty.service
-    status=$(systemctl -p ExecMainStatus show driver-updates@$tty.service)
-    info "DD status=$status"
+    start_driver_update "Driver Update Disk"
+    rm /tmp/dd_args
 fi
-
diff --git a/dracut/module-setup.sh b/dracut/module-setup.sh
index 4dd8a4c..f40645d 100755
--- a/dracut/module-setup.sh
+++ b/dracut/module-setup.sh
@@ -45,13 +45,12 @@ install() {
     inst "$moddir/parse-kickstart" "/sbin/parse-kickstart"
     # Driver Update Disks
     inst_hook cmdline 29 "$moddir/parse-anaconda-dd.sh"
-    inst_hook initqueue/online 10 "$moddir/fetch-driver-net.sh"
+    inst_hook initqueue/online 20 "$moddir/fetch-driver-net.sh"
     inst_hook pre-trigger 40 "$moddir/driver-updates.sh"
     inst_hook pre-pivot 10 "$moddir/driver-updates-net.sh"
     inst_hook pre-pivot 50 "$moddir/anaconda-depmod.sh"
     inst "$moddir/driver-updates" "/bin/driver-updates"
     inst_simple "$moddir/driver-updates at .service" "/etc/systemd/system/driver-updates at .service"
-    inst_simple "$moddir/driver-updates-net at .service" "/etc/systemd/system/driver-updates-net at .service"
     # rpm configuration file (needed by dd_extract)
     inst "/usr/lib/rpm/rpmrc"
     # python deps for parse-kickstart. DOUBLE WOOOO
-- 
1.8.4.2



More information about the anaconda-patches mailing list