summaryrefslogtreecommitdiffstats
path: root/dracut
diff options
context:
space:
mode:
authorWill Woods <wwoods@redhat.com>2012-08-02 16:34:11 -0400
committerWill Woods <wwoods@redhat.com>2012-08-13 14:52:03 -0400
commit35a93ddd452d11aaacee16e1e8ece301ff310c0a (patch)
treeb93b54a9b0cc792c5b9806f2640310e78d435abd /dracut
parent3d09d6487140b5d1c5af07f2f6d2604085a25f62 (diff)
downloadanaconda-35a93ddd452d11aaacee16e1e8ece301ff310c0a.tar.gz
anaconda-35a93ddd452d11aaacee16e1e8ece301ff310c0a.tar.xz
anaconda-35a93ddd452d11aaacee16e1e8ece301ff310c0a.zip
dracut: fix inst.ks.sendmac (#826657)
Originally, parsing inst.ks.{sendmac,sendsn} happened in parse-anaconda-kickstart.sh. But it turned out that sendmac needed to happen after the modules were loaded, so commit 4fcc157 tried to fix this by making it a function, and using initqueue to run that function in the 'initqueue/settled' hook. Well, it turns out initqueue doesn't like adding jobs that are function names - the job ends up empty and nothing happens. So instead, let's handle these two arguments directly in a script that runs in initqueue/settled.
Diffstat (limited to 'dracut')
-rw-r--r--dracut/Makefile.am1
-rwxr-xr-xdracut/anaconda-ks-sendheaders.sh32
-rwxr-xr-xdracut/module-setup.sh1
-rwxr-xr-xdracut/parse-anaconda-kickstart.sh30
4 files changed, 34 insertions, 30 deletions
diff --git a/dracut/Makefile.am b/dracut/Makefile.am
index 032476676..8c56bf3eb 100644
--- a/dracut/Makefile.am
+++ b/dracut/Makefile.am
@@ -29,6 +29,7 @@ dist_dracut_SCRIPTS = module-setup.sh \
kickstart-genrules.sh \
updates-genrules.sh \
anaconda-udevprop.sh \
+ anaconda-ks-sendheaders.sh \
anaconda-netroot.sh \
anaconda-diskroot \
anaconda-copy-ks.sh \
diff --git a/dracut/anaconda-ks-sendheaders.sh b/dracut/anaconda-ks-sendheaders.sh
new file mode 100755
index 000000000..aa178cea3
--- /dev/null
+++ b/dracut/anaconda-ks-sendheaders.sh
@@ -0,0 +1,32 @@
+#/bin/sh
+# anaconda-ks-sendheaders.sh - set various HTTP headers for kickstarting
+
+[ -f /tmp/.ks_sendheaders ] && return
+
+# inst.ks.sendmac: send MAC addresses in HTTP headers
+if getargbool 0 kssendmac inst.ks.sendmac; then
+ ifnum=0
+ for ifname in /sys/class/net/*; do
+ [ -e "$ifname/address" ] || continue
+ mac=$(cat $ifname/address)
+ ifname=${ifname#/sys/class/net/}
+ # TODO: might need to choose devices better
+ if [ "$ifname" != "lo" ] && [ -n "$mac" ]; then
+ # set_http_header is from url-lib.sh, sourced earlier
+ set_http_header "X-RHN-Provisioning-MAC-$ifnum" "$ifname $mac"
+ ifnum=$(($ifnum+1))
+ fi
+ done
+fi
+
+# inst.ks.sendsn: send system serial number in HTTP headers
+if getargbool 0 kssendsn inst.ks.sendsn; then
+ system_serial=$(cat /sys/class/dmi/id/product_serial 2>/dev/null)
+ if [ -z "$system_serial" ]; then
+ warn "inst.ks.sendsn: can't find system serial number"
+ else
+ set_http_header "X-System-Serial-Number" "$system_serial"
+ fi
+fi
+
+> /tmp/.ks_sendheaders
diff --git a/dracut/module-setup.sh b/dracut/module-setup.sh
index 39ecc58d3..78da00244 100755
--- a/dracut/module-setup.sh
+++ b/dracut/module-setup.sh
@@ -26,6 +26,7 @@ install() {
inst_hook pre-udev 40 "$moddir/kickstart-genrules.sh"
inst_hook pre-udev 40 "$moddir/updates-genrules.sh"
inst_hook pre-trigger 40 "$moddir/anaconda-udevprop.sh"
+ inst_hook initqueue/settled 00 "$moddir/anaconda-ks-sendheaders.sh"
inst_hook initqueue/online 80 "$moddir/anaconda-netroot.sh"
inst "$moddir/anaconda-diskroot" "/sbin/anaconda-diskroot"
inst_hook pre-pivot 99 "$moddir/anaconda-copy-ks.sh"
diff --git a/dracut/parse-anaconda-kickstart.sh b/dracut/parse-anaconda-kickstart.sh
index afc3d6356..d445e2751 100755
--- a/dracut/parse-anaconda-kickstart.sh
+++ b/dracut/parse-anaconda-kickstart.sh
@@ -31,33 +31,3 @@ case "${kickstart%%:*}" in
;;
esac
export kickstart
-
-# inst.ks.sendmac: send MAC addresses in HTTP headers
-set_ks_sendmac() {
- local ifnum=0 mac="" ifname=""
- for ifname in /sys/class/net/*; do
- [ -e "$ifname/address" ] || continue
- mac=$(cat $ifname/address)
- ifname=${ifname#/sys/class/net/}
- # TODO: might need to choose devices better
- if [ "$ifname" != "lo" ] && [ -n "$mac" ]; then
- set_http_header "X-RHN-Provisioning-MAC-$ifnum" "$ifname $mac"
- ifnum=$(($ifnum+1))
- fi
- done
-}
-if getargbool 0 kssendmac inst.ks.sendmac; then
- # needs to run in mainloop (after modules load etc.)
- initqueue --unique --settled --onetime --name "01-sendmac" set_ks_sendmac
-fi
-
-# inst.ks.sendsn: send system serial number as HTTP header
-if getargbool 0 kssendsn inst.ks.sendsn; then
- # doesn't need to wait - dmi is builtin
- system_serial=$(cat /sys/class/dmi/id/product_serial 2>/dev/null)
- if [ -z "$system_serial" ]; then
- warn "inst.ks.sendsn: can't find system serial number"
- else
- set_http_header "X-System-Serial-Number" "$system_serial"
- fi
-fi