Skip to content

Commit

Permalink
Merge pull request #190 from wgwoods/rhel7-backports
Browse files Browse the repository at this point in the history
rhel7 backports
  • Loading branch information
bcl committed Jul 10, 2015
2 parents d94ea8d + 2c0c04a commit d553adb
Show file tree
Hide file tree
Showing 20 changed files with 1,559 additions and 980 deletions.
5 changes: 2 additions & 3 deletions dracut/Makefile.am
Expand Up @@ -44,9 +44,8 @@ dist_dracut_SCRIPTS = module-setup.sh \
parse-anaconda-dd.sh \
fetch-driver-net.sh \
driver-updates@.service \
driver-updates.sh \
driver-updates-net.sh \
driver-updates-genrules.sh \
anaconda-depmod.sh \
driver-updates
driver_updates.py

MAINTAINERCLEANFILES = Makefile.in
70 changes: 29 additions & 41 deletions dracut/anaconda-lib.sh
Expand Up @@ -183,6 +183,15 @@ parse_kickstart() {
[ -e "$parsed_kickstart" ] && cp $parsed_kickstart /run/install/ks.cfg
}

# print a list of net devices that dracut says are set up.
online_netdevs() {
local netif=""
for netif in /tmp/net.*.did-setup; do
netif=${netif#*.}; netif=${netif%.*}
[ -d "/sys/class/net/$netif" ] && echo $netif
done
}

# This is where we actually run the kickstart. Whee!
# We can't just add udev rules (we'll miss devices that are already active),
# and we can't just run the scripts manually (we'll miss devices that aren't
Expand All @@ -206,47 +215,36 @@ run_kickstart() {
# re-parse new cmdline stuff from the kickstart
. $hookdir/cmdline/*parse-anaconda-repo.sh
. $hookdir/cmdline/*parse-livenet.sh
# TODO: parse for other stuff ks might set (dd? other stuff?)
case "$repotype" in
http*|ftp|nfs*) do_net=1 ;;
cdrom|hd|bd) do_disk=1 ;;
esac
[ "$root" = "anaconda-auto-cd" ] && do_disk=1

# kickstart Driver Disk Handling
# parse-kickstart may have added network inst.dd entries to the cmdline
# Or it may have written devices to /tmp/dd_ks

# Does network need to be rerun?
dd_args="$(getargs dd= inst.dd=)"
for dd in $dd_args; do
case "${dd%%:*}" in
http|https|ftp|nfs|nfs4)
do_net=1
rm /tmp/dd_net.done
break
;;
esac
done
. $hookdir/cmdline/*parse-anaconda-dd.sh

# Run the driver update UI for disks
if [ -e "/tmp/dd_args_ks" ]; then
# TODO: Seems like this should be a function, a mostly same version is used in 3 places
start_driver_update "Kickstart Driver Update Disk"
rm /tmp/dd_args_ks
fi
# Figure out whether we need to retry disk/net stuff
case "$root" in
anaconda-net:*) do_net=1 ;;
anaconda-disk:*) do_disk=1 ;;
anaconda-auto-cd) do_disk=1 ;;
esac
[ -f /tmp/dd_net ] && do_net=1
[ -f /tmp/dd_disk ] && do_disk=1

# replay udev events to trigger actions
# disk: replay udev events to trigger actions
if [ "$do_disk" ]; then
# set up new rules
. $hookdir/pre-trigger/*repo-genrules.sh
. $hookdir/pre-trigger/*driver-updates-genrules.sh
udevadm control --reload
# trigger the rules for all the block devices we see
udevadm trigger --action=change --subsystem-match=block
fi

# net: re-run online hook
if [ "$do_net" ]; then
# make dracut create the net udev rules (based on the new cmdline)
. $hookdir/pre-udev/*-net-genrules.sh
udevadm control --reload
udevadm trigger --action=add --subsystem-match=net
for netif in $(online_netdevs); do
source_hook initqueue/online $netif
done
fi

# and that's it - we're back to the mainloop.
Expand All @@ -261,16 +259,6 @@ 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"
wait_for_dd() {
echo "[ -e /tmp/dd.done ]" > $hookdir/initqueue/finished/dd.sh
}

0 comments on commit d553adb

Please sign in to comment.