Skip to content

Commit 8cdcfe9

Browse files
committed
Add netplan.io support
1 parent 0a36a09 commit 8cdcfe9

2 files changed

Lines changed: 48 additions & 0 deletions

File tree

debian-setup/packages/netplan.io

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
3+
set -e -x
4+
5+
NETPLAN_CONFIG="/etc/netplan/50-cloud-init.yaml"
6+
7+
Netplan()
8+
{
9+
python3 /usr/local/bin/shyaml "$@" < "$NETPLAN_CONFIG"
10+
}
11+
12+
if ! grep -q "configured to use Netplan" /etc/network/interfaces; then
13+
exit 0
14+
fi
15+
16+
test -f "$NETPLAN_CONFIG"
17+
cp -a "$NETPLAN_CONFIG" /root/dist-mod/
18+
cp -a /etc/network/interfaces /root/dist-mod/interfaces.netplan-stub
19+
20+
{
21+
echo "# Generated from ${NETPLAN_CONFIG}"
22+
echo
23+
echo "auto lo"
24+
echo "iface lo inet loopback"
25+
echo
26+
27+
for IFACE in $(Netplan keys "network.ethernets"); do
28+
if [ "$(Netplan get-value "network.ethernets.${IFACE}.dhcp4" "false")" == "True" ]; then
29+
echo "auto ${IFACE}"
30+
echo "iface ${IFACE} inet dhcp"
31+
echo
32+
fi
33+
34+
if [ "$(Netplan get-value "network.ethernets.${IFACE}.dhcp6" "false")" == "True" ]; then
35+
echo "auto ${IFACE}"
36+
echo "iface ${IFACE} inet6 dhcp"
37+
echo
38+
fi
39+
done
40+
} >/etc/network/interfaces
41+
42+
ifquery --list
43+
for IFACE in $(Netplan keys "network.ethernets"); do
44+
ifquery "$IFACE"
45+
done
46+
47+
apt-get purge -qq netplan.io netplan-generator python3-netplan libnetplan1

debian-setup/packages/systemd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ if [ "$WITHOUT_SYSTEMD" == "yes" ]; then
66
# Remove systemd
77
# http://without-systemd.org/wiki/index.php/How_to_remove_systemd_from_a_Debian_jessie/sid_installation
88
if Is_installed systemd; then
9+
packages/netplan.io
910
Pkg_install_quiet sysvinit-core sysvinit-utils orphan-sysvinit-scripts bootlogd rsyslog
1011
cp /usr/share/sysvinit/inittab /etc/inittab
1112
# Change to agetty

0 commit comments

Comments
 (0)