-
Notifications
You must be signed in to change notification settings - Fork 8
/
netconf_install
53 lines (46 loc) · 1.54 KB
/
netconf_install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
build ()
{
# if TMPDIR is set leave it alone otherwise set
[ -z $TMPDIR ] && TMPDIR='/tmp/mkinitcpio-netconf'
# check if TMPDIR exsists if not make it
[ -d $TMPDIR ] || mkdir -p $TMPDIR
umask 0022
#systemd enabled
declare -F add_systemd_unit > /dev/null 2>&1
if [ $? -eq 0 ]; then
add_systemd_unit "systemd-networkd.service"
add_systemd_unit "systemd-networkd.socket"
systemctl --root "$BUILDROOT" enable systemd-networkd.service
systemctl --root "$BUILDROOT" enable systemd-networkd.socket
add_dir "/etc/systemd/network"
ls /etc/systemd/network/*.initramfs > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Systemd is enabled, but there are no .initramfs files under /etc/systemd/network; exit"
return 0
else
for network in $(ls /etc/systemd/network/*.initramfs); do
if [ -s $network ]; then
initramfs_strip=$(echo $network | sed -e 's/\.initramfs//g')
echo "Added $network to $initramfs_strip"
add_file $network $initramfs_strip
fi
done
fi
#base enabled
else
add_checked_modules "/drivers/net/"
add_binary "/usr/bin/ip" "/sbin/ip"
add_binary "/usr/lib/initcpio/ipconfig" "/sbin/ipconfig"
add_runscript
fi
}
help ()
{
cat<<HELPEOF
This hook will parse the ip= command line variable on the kernel and configure
the interface specified. It's meant to be used in combination with other hooks
that require early userspace networking, such as mkinitcpio-dropbear,
mkinitcpio-tinyssh and mkinitcpio-ddns, among others.
HELPEOF
}