* Generator modules should have a two digit numeric prefix -- they run in
ascending sort order. Anything in the 90-99 range is stuff that dracut
relies on, so try not to break those hooks.
- * Generator modules and hooks must have a .sh extension.
+ * Generator modules and hooks must have a .sh extension.
+ * We have some breakpoints for debugging your hooks. If you pass 'break'
+ as a kernel parameter, the initramfs will drop to a shell just before
+ switching to a new root. You can pass 'break=hookpoint', and the initramfs
+ will break just before hooks in that hookpoint run.
Also, there is an attempt to keep things as distribution-agnostic as
possible. Every distribution has their own tool here and it's not
--- /dev/null
+#!/bin/sh
+# very simple dhclient-script. All it cares about is bringing the interface
+# up, and it does not even try to do anything else.
+
+case $reason in
+ PREINIT) ip link set "$interface" up ;;
+ BOUND) ipopts="$new_ip_address"
+ [ "$new_interface_mtu" ] && ip link set $interface mtu $new_interface_mtu
+ [ "$new_subnet_mask" ] && ipopts="$ipopts/$new_subnet_mask"
+ [ "$new_broadcast_address" ] && ipopts="$ipopts broadcast $new_broadcast_address"
+ ip addr add $ipopts dev $interface
+ [ "$new_routers" ] && ip route add default via ${new_routers%%,*} dev $interface
+ [ "$new_domain_name" ] && echo "domain $new_domain_name" > /etc/resolv.conf
+ if [ "$new_domain_search" ]; then
+ echo "search $new_domain_search" |sed 's/,//g' >> /etc/resolv.conf
+ elif [ "$new_domain_name" ]; then
+ echo "search $new_domain_name" >> /etc/resolv.conf
+ fi
+ ( IFS=",";
+ for s in $new_domain_name_servers; do
+ echo "nameserver $s" >> /etc/resolv.conf
+ done ) ;;
+ *) ;;
+esac
--- /dev/null
+#!/bin/sh
+kill $(pidof dhclient)
\ No newline at end of file
--- /dev/null
+#!/bin/sh
+echo "$*" >>/dev/net-interfaces-found
+
+# loopback is always handled the same way
+[ "$1" = "lo" ] && {
+ ip link set lo up
+ ip addr add 127.0.0.1/8 dev lo
+ exit 0
+}
+
+# spin through the kernel command line, looking for ip= lines
+while read p; do
+ case $p in
+ 'ip=none'|'ip=off') exit 0;; # we were told to not configure anything
+ 'ip=dhcp'|'ip=on'|'ip=any') dhclient -nw "$1"; exit 0;;
+ 'ip=bootp'|'ip=rarp'|'ip=both') exit 0;; #dunno how to do this
+ ip=*) exit 0;; #to be written
+ *) continue;;
+ esac
+done
\ No newline at end of file
--- /dev/null
+#!/bin/bash
+dracut_install ip dhclient
+inst "$dsrc/ifup" "/sbin/ifup"
+inst "$dsrc/dhclient-script" "/sbin/dhclient-script"
+instmods =networking ecb arc4
+inst_rules "$dsrc/rules.d/60-net.rules"
+inst_hook pre-pivot 10 "$dsrc/hooks/kill-dhclient.sh"
--- /dev/null
+ACTION=="add", SUBSYSTEM=="net", RUN+="/sbin/ifup $env{INTERFACE}"