@@ -10,11 +10,35 @@ build ()
1010
1111 umask 0022
1212
13- add_checked_modules " /drivers/net/"
14- add_binary " /usr/bin/ip" " /sbin/ip"
15- add_binary " /usr/lib/initcpio/ipconfig" " /sbin/ipconfig"
13+ # systemd enabled
14+ declare -F add_systemd_unit > /dev/null 2>&1
15+ if [ $? -eq 0 ]; then
16+ add_systemd_unit " systemd-networkd.service"
17+ add_systemd_unit " systemd-networkd.socket"
18+ systemctl --root " $BUILDROOT " enable systemd-networkd.service
19+ systemctl --root " $BUILDROOT " enable systemd-networkd.socket
20+ add_dir " /etc/systemd/network"
21+ ls /etc/systemd/network/* .initramfs > /dev/null 2>&1
22+ if [ $? -ne 0 ]; then
23+ echo " Systemd is enabled, but there are no .initramfs files under /etc/systemd/network; exit"
24+ return 0
25+ else
26+ for network in $( ls /etc/systemd/network/* .initramfs) ; do
27+ if [ -s $network ]; then
28+ initramfs_strip=$( echo $network | sed -e ' s/\.initramfs//g' )
29+ echo " Added $network to $initramfs_strip "
30+ add_file $network $initramfs_strip
31+ fi
32+ done
33+ fi
34+ # base enabled
35+ else
36+ add_checked_modules " /drivers/net/"
37+ add_binary " /usr/bin/ip" " /sbin/ip"
38+ add_binary " /usr/lib/initcpio/ipconfig" " /sbin/ipconfig"
1639
17- add_runscript
40+ add_runscript
41+ fi
1842
1943}
2044
@@ -23,7 +47,7 @@ help ()
2347 cat<< HELPEOF
2448This hook will parse the ip= command line variable on the kernel and configure
2549the interface specified. It's meant to be used in combination with other hooks
26- that require early userspace networking, such as mkinitcpio-dropbear and
27- mkinitcpio-ddns, among others.
50+ that require early userspace networking, such as mkinitcpio-dropbear,
51+ mkinitcpio-tinyssh and mkinitcpio- ddns, among others.
2852HELPEOF
2953}
0 commit comments