Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rhel7 backports #190

Merged
merged 9 commits into from Jul 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
}