netcfg: restore upstream behavior and configuration features from last release.
This commit is contained in:
parent
0077ab560d
commit
d7e291dfb7
11 changed files with 8235 additions and 68 deletions
7307
helpers/DATA/netcfg/01_ruc_1.142ubuntu1.patch
Normal file
7307
helpers/DATA/netcfg/01_ruc_1.142ubuntu1.patch
Normal file
File diff suppressed because it is too large
Load diff
521
helpers/DATA/netcfg/02_ruc_1.142ubuntu2.patch
Normal file
521
helpers/DATA/netcfg/02_ruc_1.142ubuntu2.patch
Normal file
|
|
@ -0,0 +1,521 @@
|
|||
From 54942477d5d0066b7d37650420e2d7f834dd1d9e Mon Sep 17 00:00:00 2001
|
||||
From: Mathieu Trudel-Lapierre <cyphermox@ubuntu.com>
|
||||
Date: Fri, 26 May 2017 15:29:16 -0400
|
||||
Subject: 1.142ubuntu2 (patches unapplied)
|
||||
|
||||
Imported using git-ubuntu import.
|
||||
---
|
||||
base-installer.d/40netcfg | 4 +-
|
||||
debian/changelog | 8 ++
|
||||
debian/netcfg-common.templates | 6 +
|
||||
debian/netcfg.dirs | 1 +
|
||||
dhcp.c | 2 +-
|
||||
netcfg-common.c | 4 +-
|
||||
netcfg.h | 3 +-
|
||||
static.c | 2 +-
|
||||
write_interface.c | 290 +++++++++++++++++++++++++++++++++--------
|
||||
9 files changed, 262 insertions(+), 58 deletions(-)
|
||||
|
||||
diff --git a/base-installer.d/40netcfg b/base-installer.d/40netcfg
|
||||
index 0bbffd5..6ce418a 100755
|
||||
--- a/base-installer.d/40netcfg
|
||||
+++ b/base-installer.d/40netcfg
|
||||
@@ -1,11 +1,11 @@
|
||||
#!/bin/sh -e
|
||||
# Copy all relevant networking-related files to /target.
|
||||
|
||||
-if [ ! -f /etc/network/interfaces ]; then
|
||||
+if [ ! -f /etc/network/interfaces ] && [ ! -f /etc/netplan/*.yaml ]; then
|
||||
netcfg write_loopback
|
||||
fi
|
||||
|
||||
-for file in /etc/network/interfaces /etc/networks /etc/hostname /etc/hosts; do
|
||||
+for file in /etc/network/interfaces /etc/networks /etc/hostname /etc/hosts /etc/netplan/*.yaml; do
|
||||
if [ -f "$file" ]; then
|
||||
mkdir /target/$(dirname $file) -p
|
||||
cp $file /target/$file
|
||||
diff --git a/debian/netcfg-common.templates b/debian/netcfg-common.templates
|
||||
index 0ca1ec7..6e42847 100644
|
||||
--- a/debian/netcfg-common.templates
|
||||
+++ b/debian/netcfg-common.templates
|
||||
@@ -415,3 +415,9 @@ _Choices: ${essid_list} Enter ESSID manually
|
||||
_Description: Wireless network:
|
||||
Select the wireless network to use during the installation process.
|
||||
|
||||
+Template: netcfg/do_not_use_netplan
|
||||
+Type: boolean
|
||||
+Default: false
|
||||
+Description: for internal use; can be preseeded
|
||||
+ Set to false to fallback to ifupdown.
|
||||
+
|
||||
diff --git a/debian/netcfg.dirs b/debian/netcfg.dirs
|
||||
index dad6088..d548c6e 100644
|
||||
--- a/debian/netcfg.dirs
|
||||
+++ b/debian/netcfg.dirs
|
||||
@@ -1,5 +1,6 @@
|
||||
bin
|
||||
etc/network
|
||||
+etc/netplan
|
||||
usr/lib/base-installer.d
|
||||
usr/lib/post-base-installer.d
|
||||
lib/netcfg
|
||||
diff --git a/dhcp.c b/dhcp.c
|
||||
index b72a805..8824580 100644
|
||||
--- a/dhcp.c
|
||||
+++ b/dhcp.c
|
||||
@@ -611,7 +611,7 @@ int netcfg_activate_dhcp (struct debconfclient *client, struct netcfg_interface
|
||||
di_debug("Network config complete");
|
||||
netcfg_write_common("", hostname, domain);
|
||||
netcfg_write_loopback();
|
||||
- netcfg_write_interface(interface);
|
||||
+ netcfg_write_interface(client, interface);
|
||||
netcfg_write_resolv(domain, interface);
|
||||
#if !defined(__FreeBSD_kernel__)
|
||||
kill_dhcp_client();
|
||||
diff --git a/netcfg-common.c b/netcfg-common.c
|
||||
index dafbf1a..d747450 100644
|
||||
--- a/netcfg-common.c
|
||||
+++ b/netcfg-common.c
|
||||
@@ -1133,8 +1133,8 @@ void netcfg_write_loopback (void)
|
||||
lo.name = LO_IF;
|
||||
lo.loopback = 1;
|
||||
|
||||
- netcfg_write_interface(NULL);
|
||||
- netcfg_write_interface(&lo);
|
||||
+ netcfg_write_interface(NULL, NULL);
|
||||
+ netcfg_write_interface(NULL, &lo);
|
||||
}
|
||||
|
||||
/*
|
||||
diff --git a/netcfg.h b/netcfg.h
|
||||
index 19fe710..ae3f34c 100644
|
||||
--- a/netcfg.h
|
||||
+++ b/netcfg.h
|
||||
@@ -2,6 +2,7 @@
|
||||
#define _NETCFG_H_
|
||||
|
||||
#define INTERFACES_FILE "/etc/network/interfaces"
|
||||
+#define NETPLAN_YAML "/etc/netplan/01-netcfg.yaml"
|
||||
#define HOSTS_FILE "/etc/hosts"
|
||||
#define HOSTNAME_FILE "/etc/hostname"
|
||||
#define NETWORKS_FILE "/etc/networks"
|
||||
@@ -267,7 +268,7 @@ extern int nc_v6_interface_configured(const struct netcfg_interface *interface,
|
||||
extern int nc_v6_get_config_flags(struct debconfclient *client, struct netcfg_interface *interface);
|
||||
|
||||
/* write_interfaces.c */
|
||||
-extern int netcfg_write_interface(const struct netcfg_interface *interface);
|
||||
+extern int netcfg_write_interface(struct debconfclient *client, const struct netcfg_interface *interface);
|
||||
|
||||
/* rdnssd.c */
|
||||
extern int start_rdnssd(struct debconfclient *client);
|
||||
diff --git a/static.c b/static.c
|
||||
index e375dd4..b73b785 100644
|
||||
--- a/static.c
|
||||
+++ b/static.c
|
||||
@@ -680,7 +680,7 @@ int netcfg_get_static(struct debconfclient *client, struct netcfg_interface *ifa
|
||||
}
|
||||
netcfg_write_common(iface->ipaddress, hostname, domain);
|
||||
netcfg_write_loopback();
|
||||
- netcfg_write_interface(iface);
|
||||
+ netcfg_write_interface(client, iface);
|
||||
netcfg_write_resolvconf_options(domain, iface);
|
||||
netcfg_write_resolv(domain, iface);
|
||||
}
|
||||
diff --git a/write_interface.c b/write_interface.c
|
||||
index 012ffb7..14d36e1 100644
|
||||
--- a/write_interface.c
|
||||
+++ b/write_interface.c
|
||||
@@ -24,8 +24,20 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
+#include <cdebconf/debconfclient.h>
|
||||
#include <debian-installer.h>
|
||||
|
||||
+static int nc_wi_netplan_header(FILE *fd)
|
||||
+{
|
||||
+ fprintf(fd, "# This file describes the network interfaces available on your system\n");
|
||||
+ fprintf(fd, "# For more information, see netplan(5).\n");
|
||||
+ fprintf(fd, "network:\n");
|
||||
+ fprintf(fd, " version: 2\n");
|
||||
+ fprintf(fd, " renderer: networkd\n");
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
static int nc_wi_header(FILE *fd)
|
||||
{
|
||||
fprintf(fd, "# This file describes the network interfaces available on your system\n");
|
||||
@@ -57,6 +69,19 @@ static int nc_wi_vlan(const struct netcfg_interface *interface, FILE *fd)
|
||||
return rv;
|
||||
}
|
||||
|
||||
+static int nc_wi_netplan_vlan(const struct netcfg_interface *interface, FILE *fd)
|
||||
+{
|
||||
+ int rv;
|
||||
+ rv = 1;
|
||||
+
|
||||
+ fprintf(fd, " vlans:\n");
|
||||
+ fprintf(fd, " %s:\n", interface->name);
|
||||
+ fprintf(fd, " link: %s\n", interface->parentif);
|
||||
+ fprintf(fd, " id: %d\n", interface->vlanid);
|
||||
+
|
||||
+ return rv;
|
||||
+}
|
||||
+
|
||||
|
||||
static int nc_wi_wireless_options(const struct netcfg_interface *interface, FILE *fd)
|
||||
{
|
||||
@@ -83,6 +108,29 @@ static int nc_wi_wireless_options(const struct netcfg_interface *interface, FILE
|
||||
return 1;
|
||||
}
|
||||
|
||||
+static int nc_wi_netplan_wireless_aps(const struct netcfg_interface *interface, FILE *fd)
|
||||
+{
|
||||
+ fprintf(fd, " access-points:\n");
|
||||
+
|
||||
+ if (interface->essid && *interface->essid) {
|
||||
+ fprintf(fd, " %s:\n", interface->essid);
|
||||
+ } else {
|
||||
+ fprintf(fd, " any:\n");
|
||||
+ }
|
||||
+
|
||||
+ if (interface->wpa_supplicant_status == WPA_QUEUED) {
|
||||
+ fprintf(fd, " password: %s\n", interface->passphrase);
|
||||
+ } else {
|
||||
+ fprintf(fd, " mode: %s\n",
|
||||
+ (interface->mode == MANAGED) ? "infrastructure" : "adhoc");
|
||||
+
|
||||
+ if (interface->wepkey != NULL)
|
||||
+ fprintf(fd, " password: %s\n", interface->wepkey);
|
||||
+ }
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
/* Write out a DHCP stanza for the given interface
|
||||
*/
|
||||
static int nc_wi_dhcp(const struct netcfg_interface *interface, FILE *fd)
|
||||
@@ -134,6 +182,17 @@ static int nc_wi_static_ipv4(const struct netcfg_interface *interface, FILE *fd)
|
||||
return 1;
|
||||
}
|
||||
|
||||
+static int nc_wi_netplan_static_ipv4(const struct netcfg_interface *interface, FILE *fd)
|
||||
+{
|
||||
+ fprintf(fd, " addresses: [ %s/%i ]\n", interface->ipaddress,
|
||||
+ empty_str(interface->pointopoint) ? interface->masklen : 32);
|
||||
+ if (!empty_str(interface->gateway))
|
||||
+ fprintf(fd, " gateway4: %s\n",
|
||||
+ empty_str(interface->pointopoint) ? interface->gateway : interface->pointopoint);
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
/* Write out a static IPv6 config stanza for the given interface
|
||||
*/
|
||||
static int nc_wi_static_ipv6(const struct netcfg_interface *interface, FILE *fd)
|
||||
@@ -148,6 +207,131 @@ static int nc_wi_static_ipv6(const struct netcfg_interface *interface, FILE *fd)
|
||||
return 1;
|
||||
}
|
||||
|
||||
+static int nc_wi_netplan_static_ipv6(const struct netcfg_interface *interface, FILE *fd)
|
||||
+{
|
||||
+ fprintf(fd, " addresses: [ %s/%i ]\n", interface->ipaddress, interface->masklen);
|
||||
+ if (!empty_str(interface->gateway))
|
||||
+ fprintf(fd, " gateway6: %s\n", interface->gateway);
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static int nc_wi_write_eni(const struct netcfg_interface *interface, FILE *fd)
|
||||
+{
|
||||
+ int rv;
|
||||
+
|
||||
+ rv = 1;
|
||||
+
|
||||
+ di_debug("Using /etc/network/interfaces for network config");
|
||||
+
|
||||
+ if (!interface) {
|
||||
+ di_debug("Writing informative header");
|
||||
+ rv = nc_wi_header(fd);
|
||||
+ } else if (interface->loopback == 1) {
|
||||
+ di_debug("Writing loopback interface");
|
||||
+ rv = nc_wi_loopback(interface, fd);
|
||||
+ } else if (interface->dhcp == 1 || interface->slaac == 1) {
|
||||
+ if (interface->dhcp == 1) {
|
||||
+ di_debug("Writing DHCP stanza for %s", interface->name);
|
||||
+ rv = nc_wi_dhcp(interface, fd);
|
||||
+ }
|
||||
+ if (interface->slaac == 1) {
|
||||
+ di_debug("Writing SLAAC stanza for %s", interface->name);
|
||||
+ rv = nc_wi_slaac(interface, fd);
|
||||
+ }
|
||||
+ } else if (interface->address_family == AF_INET) {
|
||||
+ di_debug("Writing static IPv4 stanza for %s", interface->name);
|
||||
+ rv = nc_wi_static_ipv4(interface, fd);
|
||||
+ } else if (interface->address_family == AF_INET6) {
|
||||
+ di_debug("Writing static IPv6 stanza for %s", interface->name);
|
||||
+ rv = nc_wi_static_ipv6(interface, fd);
|
||||
+ }
|
||||
+ if (rv && interface && interface->parentif) {
|
||||
+ di_debug("Writing VLAN: %s", interface->name);
|
||||
+ rv = nc_wi_vlan(interface, fd);
|
||||
+ }
|
||||
+ if (rv && interface && is_wireless_iface(interface->name)) {
|
||||
+ di_debug("Writing wireless options for %s", interface->name);
|
||||
+ rv = nc_wi_wireless_options(interface, fd);
|
||||
+ }
|
||||
+
|
||||
+ return rv;
|
||||
+}
|
||||
+
|
||||
+static int nc_wi_write_netplan_yaml(const struct netcfg_interface *interface, FILE *fd, off_t size)
|
||||
+{
|
||||
+ int rv;
|
||||
+
|
||||
+ rv = 1;
|
||||
+
|
||||
+ di_warning("Using netplan for network config");
|
||||
+
|
||||
+ if (size <= 0)
|
||||
+ rv = nc_wi_netplan_header(fd);
|
||||
+
|
||||
+ /* No interface given, just clear the file */
|
||||
+ if (!interface)
|
||||
+ return rv;
|
||||
+
|
||||
+ /* With netplan, let loopback alone */
|
||||
+ if (interface->loopback == 1)
|
||||
+ return rv;
|
||||
+
|
||||
+ if (is_wireless_iface(interface->name)) {
|
||||
+ fprintf(fd, " wifis:\n");
|
||||
+ } else {
|
||||
+ fprintf(fd, " ethernets:\n");
|
||||
+ }
|
||||
+
|
||||
+ /* Take care of handling VLANs correctly */
|
||||
+ fprintf(fd, " %s:\n", interface->parentif ? interface->parentif : interface->name);
|
||||
+
|
||||
+ if (rv && interface && interface->parentif) {
|
||||
+ /* Make sure our parent doesn't get an IP */
|
||||
+ fprintf(fd, " dhcp4: no\n");
|
||||
+ fprintf(fd, " dhcp6: no\n");
|
||||
+
|
||||
+ di_debug("Writing VLAN: %s", interface->name);
|
||||
+ rv = nc_wi_netplan_vlan(interface, fd);
|
||||
+ }
|
||||
+
|
||||
+ if (interface->dhcp == 1 || interface->slaac == 1) {
|
||||
+ if (interface->dhcp == 1) {
|
||||
+ di_debug("Writing DHCP stanza for %s", interface->name);
|
||||
+ fprintf(fd, " dhcp4: yes\n");
|
||||
+ }
|
||||
+ if (interface->slaac == 1) {
|
||||
+ di_debug("Writing SLAAC stanza for %s", interface->name);
|
||||
+ fprintf(fd, " dhcp6: yes\n");
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ /* Write all other static addresses */
|
||||
+ if (interface->address_family == AF_INET) {
|
||||
+ di_debug("Writing static IPv4 stanza for %s", interface->name);
|
||||
+ rv = nc_wi_netplan_static_ipv4(interface, fd);
|
||||
+ } else if (interface->address_family == AF_INET) {
|
||||
+ di_debug("Writing static IPv6 stanza for %s", interface->name);
|
||||
+ rv = nc_wi_netplan_static_ipv6(interface, fd);
|
||||
+ }
|
||||
+
|
||||
+ if (rv && interface && is_wireless_iface(interface->name)) {
|
||||
+ di_debug("Writing wireless options for %s", interface->name);
|
||||
+ rv = nc_wi_netplan_wireless_aps(interface, fd);
|
||||
+ }
|
||||
+
|
||||
+ return rv;
|
||||
+}
|
||||
+
|
||||
+void unlink_config_tmp_file(int use_netplan)
|
||||
+{
|
||||
+ if (use_netplan)
|
||||
+ unlink(NETPLAN_YAML ".tmp");
|
||||
+ else
|
||||
+ unlink(INTERFACES_FILE ".tmp");
|
||||
+}
|
||||
+
|
||||
/* The main function for writing things to INTERFACES_FILE (aka
|
||||
* /etc/network/interfaces).
|
||||
*
|
||||
@@ -162,24 +346,48 @@ static int nc_wi_static_ipv6(const struct netcfg_interface *interface, FILE *fd)
|
||||
* returned, the interfaces file will not have been modified, and errno will
|
||||
* contain the details.
|
||||
*/
|
||||
-int netcfg_write_interface(const struct netcfg_interface *interface)
|
||||
+int netcfg_write_interface(struct debconfclient *client, const struct netcfg_interface *interface)
|
||||
{
|
||||
FILE *fd;
|
||||
int rv;
|
||||
struct stat stat_buf;
|
||||
-
|
||||
+ int use_netplan;
|
||||
+ char *config_file_path;
|
||||
+
|
||||
+ use_netplan = 1;
|
||||
+
|
||||
+ if (client) {
|
||||
+ debconf_get(client,"netcfg/do_not_use_netplan");
|
||||
+ }
|
||||
+
|
||||
+ /* If this undocumented debconf key is set to true, skip netplan
|
||||
+ * and fallback to /e/n/i as before.
|
||||
+ */
|
||||
+ if (!client || !strcmp(client->value, "false")) {
|
||||
+ config_file_path = NETPLAN_YAML;
|
||||
+ } else {
|
||||
+ use_netplan = 0;
|
||||
+ config_file_path = INTERFACES_FILE;
|
||||
+ }
|
||||
+
|
||||
+ di_warning("Using %s", config_file_path);
|
||||
+
|
||||
if (!interface) {
|
||||
- di_debug("No interface given; clearing " INTERFACES_FILE);
|
||||
- rv = unlink(INTERFACES_FILE);
|
||||
+ di_debug("No interface given; clearing %s", config_file_path);
|
||||
+ rv = unlink(config_file_path);
|
||||
if (rv < 0 && errno != ENOENT) {
|
||||
- di_info("Error clearing %s: %s", INTERFACES_FILE, strerror(errno));
|
||||
+ di_info("Error clearing %s: %s", config_file_path, strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
- fd = file_open(INTERFACES_FILE ".tmp", "w");
|
||||
+ if (use_netplan)
|
||||
+ fd = file_open(NETPLAN_YAML ".tmp", "w");
|
||||
+ else
|
||||
+ fd = file_open(INTERFACES_FILE ".tmp", "w");
|
||||
+
|
||||
if (!fd) {
|
||||
- di_warning("Failed to open %s.tmp: %s", INTERFACES_FILE, strerror(errno));
|
||||
+ di_warning("Failed to open %s.tmp: %s", config_file_path, strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -188,45 +396,45 @@ int netcfg_write_interface(const struct netcfg_interface *interface)
|
||||
* so we can add our new stuff to it. Bloody longwinded way of doing
|
||||
* it, I'm sure you'll agree.
|
||||
*/
|
||||
- rv = stat(INTERFACES_FILE, &stat_buf);
|
||||
+ rv = stat(config_file_path, &stat_buf);
|
||||
if (rv < 0 && errno != ENOENT) {
|
||||
- di_warning("Failed to stat %s: %s", INTERFACES_FILE, strerror(errno));
|
||||
- unlink(INTERFACES_FILE ".tmp");
|
||||
+ di_warning("Failed to stat %s: %s", config_file_path, strerror(errno));
|
||||
+ unlink_config_tmp_file(use_netplan);
|
||||
return 0;
|
||||
}
|
||||
if (rv == 0) {
|
||||
char *tmpbuf = malloc(stat_buf.st_size + 1);
|
||||
int origfd;
|
||||
- origfd = open(INTERFACES_FILE, O_RDONLY);
|
||||
+ origfd = open(config_file_path, O_RDONLY);
|
||||
if (origfd < 0) {
|
||||
- di_warning("Failed to open %s: %s", INTERFACES_FILE, strerror(errno));
|
||||
+ di_warning("Failed to open %s: %s", config_file_path, strerror(errno));
|
||||
fclose(fd);
|
||||
- unlink(INTERFACES_FILE ".tmp");
|
||||
+ unlink_config_tmp_file(use_netplan);
|
||||
free(tmpbuf);
|
||||
return 0;
|
||||
}
|
||||
rv = read(origfd, tmpbuf, stat_buf.st_size);
|
||||
if (rv < 0) {
|
||||
- di_warning("Failed to read %s: %s", INTERFACES_FILE, strerror(errno));
|
||||
+ di_warning("Failed to read %s: %s", config_file_path, strerror(errno));
|
||||
fclose(fd);
|
||||
- unlink(INTERFACES_FILE ".tmp");
|
||||
+ unlink_config_tmp_file(use_netplan);
|
||||
free(tmpbuf);
|
||||
close(origfd);
|
||||
return 0;
|
||||
}
|
||||
if (rv != stat_buf.st_size) {
|
||||
- di_warning("Short read on %s", INTERFACES_FILE);
|
||||
+ di_warning("Short read on %s", config_file_path);
|
||||
fclose(fd);
|
||||
- unlink(INTERFACES_FILE ".tmp");
|
||||
+ unlink_config_tmp_file(use_netplan);
|
||||
free(tmpbuf);
|
||||
close(origfd);
|
||||
return 0;
|
||||
}
|
||||
rv = fwrite(tmpbuf, sizeof(char), stat_buf.st_size, fd);
|
||||
if (rv != (int)stat_buf.st_size) {
|
||||
- di_warning("Short write on %s.tmp", INTERFACES_FILE);
|
||||
+ di_warning("Short write on %s.tmp", config_file_path);
|
||||
fclose(fd);
|
||||
- unlink(INTERFACES_FILE ".tmp");
|
||||
+ unlink_config_tmp_file(use_netplan);
|
||||
free(tmpbuf);
|
||||
close(origfd);
|
||||
return 0;
|
||||
@@ -240,43 +448,23 @@ int netcfg_write_interface(const struct netcfg_interface *interface)
|
||||
* freaking interfaces file entry */
|
||||
rv = 1;
|
||||
|
||||
- if (!interface) {
|
||||
- di_debug("Writing informative header");
|
||||
- rv = nc_wi_header(fd);
|
||||
- } else if (interface->loopback == 1) {
|
||||
- di_debug("Writing loopback interface");
|
||||
- rv = nc_wi_loopback(interface, fd);
|
||||
- } else if (interface->dhcp == 1 || interface->slaac == 1) {
|
||||
- if (interface->dhcp == 1) {
|
||||
- di_debug("Writing DHCP stanza for %s", interface->name);
|
||||
- rv = nc_wi_dhcp(interface, fd);
|
||||
- }
|
||||
- if (interface->slaac == 1) {
|
||||
- di_debug("Writing SLAAC stanza for %s", interface->name);
|
||||
- rv = nc_wi_slaac(interface, fd);
|
||||
- }
|
||||
- } else if (interface->address_family == AF_INET) {
|
||||
- di_debug("Writing static IPv4 stanza for %s", interface->name);
|
||||
- rv = nc_wi_static_ipv4(interface, fd);
|
||||
- } else if (interface->address_family == AF_INET6) {
|
||||
- di_debug("Writing static IPv6 stanza for %s", interface->name);
|
||||
- rv = nc_wi_static_ipv6(interface, fd);
|
||||
- }
|
||||
- if (rv && interface && interface->parentif) {
|
||||
- di_debug("Writing VLAN: %s", interface->name);
|
||||
- rv = nc_wi_vlan(interface, fd);
|
||||
- }
|
||||
- if (rv && interface && is_wireless_iface(interface->name)) {
|
||||
- di_debug("Writing wireless options for %s", interface->name);
|
||||
- rv = nc_wi_wireless_options(interface, fd);
|
||||
+ if (use_netplan) {
|
||||
+ rv = nc_wi_write_netplan_yaml(interface, fd, stat_buf.st_size);
|
||||
+ } else {
|
||||
+ rv = nc_wi_write_eni(interface, fd);
|
||||
}
|
||||
|
||||
- if (rv) {
|
||||
+ if (rv)
|
||||
di_debug("Success!");
|
||||
+
|
||||
+ if (use_netplan)
|
||||
+ rename(NETPLAN_YAML ".tmp", NETPLAN_YAML);
|
||||
+ else
|
||||
rename(INTERFACES_FILE ".tmp", INTERFACES_FILE);
|
||||
- }
|
||||
|
||||
fclose(fd);
|
||||
- unlink(INTERFACES_FILE ".tmp");
|
||||
+
|
||||
+ unlink_config_tmp_file(use_netplan);
|
||||
+
|
||||
return rv;
|
||||
}
|
||||
--
|
||||
cgit v1.1
|
||||
|
||||
30
helpers/DATA/netcfg/03_ruc_1.142ubuntu3.patch
Normal file
30
helpers/DATA/netcfg/03_ruc_1.142ubuntu3.patch
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
From b5ec27c44aec207a84f49ab8a0bf700ef89ad175 Mon Sep 17 00:00:00 2001
|
||||
From: dann frazier <dannf@ubuntu.com>
|
||||
Date: Wed, 19 Jul 2017 13:09:36 -0400
|
||||
Subject: 1.142ubuntu3 (patches unapplied)
|
||||
|
||||
Imported using git-ubuntu import.
|
||||
---
|
||||
debian/changelog | 6 ++++++
|
||||
debian/netcfg-common.templates | 5 +++++
|
||||
2 files changed, 11 insertions(+)
|
||||
|
||||
diff --git a/debian/netcfg-common.templates b/debian/netcfg-common.templates
|
||||
index 6e42847..f508422 100644
|
||||
--- a/debian/netcfg-common.templates
|
||||
+++ b/debian/netcfg-common.templates
|
||||
@@ -290,6 +290,11 @@ Type: text
|
||||
# :sl2:
|
||||
_Description: Ethernet CCW bus
|
||||
|
||||
+Template: netcfg/internal-ena
|
||||
+Type: text
|
||||
+# :sl2:
|
||||
+_Description: Ethernet Onboard
|
||||
+
|
||||
Template: netcfg/internal-enP
|
||||
Type: text
|
||||
# :sl2:
|
||||
--
|
||||
cgit v1.1
|
||||
|
||||
83
helpers/DATA/netcfg/04_ruc_1.142ubuntu4.patch
Normal file
83
helpers/DATA/netcfg/04_ruc_1.142ubuntu4.patch
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
From a015330a3b16ec2c79c06b65f449c7f367b6599f Mon Sep 17 00:00:00 2001
|
||||
From: Dimitri John Ledkov <xnox@ubuntu.com>
|
||||
Date: Wed, 20 Sep 2017 09:52:03 +0100
|
||||
Subject: 1.142ubuntu4 (patches unapplied)
|
||||
|
||||
Imported using git-ubuntu import.
|
||||
---
|
||||
debian/changelog | 6 ++++++
|
||||
netcfg-common.c | 18 +++++++++++++++++-
|
||||
netcfg.h | 2 ++
|
||||
post-base-installer.d/40netcfg | 6 ++++++
|
||||
4 files changed, 31 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/netcfg-common.c b/netcfg-common.c
|
||||
index d747450..8afe70d 100644
|
||||
--- a/netcfg-common.c
|
||||
+++ b/netcfg-common.c
|
||||
@@ -1403,7 +1403,8 @@ void reap_old_files (void)
|
||||
unlink(*ptr++);
|
||||
|
||||
if (!is_resolvconf_used())
|
||||
- unlink(RESOLV_FILE);
|
||||
+ if (!is_resolved_used())
|
||||
+ unlink(RESOLV_FILE);
|
||||
}
|
||||
|
||||
/* Convert a space-separated list of nameservers in a single string (as might
|
||||
@@ -1816,3 +1817,18 @@ int is_resolvconf_used()
|
||||
|
||||
return resolvconf_used;
|
||||
}
|
||||
+
|
||||
+/* Check if /etc/resolv.conf symlinks to /run/systemd/resolve/stub-resolv.conf. */
|
||||
+int is_resolved_used()
|
||||
+{
|
||||
+ int resolved_used = 0;
|
||||
+
|
||||
+ char *path = realpath(RESOLV_FILE, NULL);
|
||||
+
|
||||
+ if (path) {
|
||||
+ resolved_used = !strcmp(path, RESOLVED_FILE);
|
||||
+ free(path);
|
||||
+ }
|
||||
+
|
||||
+ return resolved_used;
|
||||
+}
|
||||
diff --git a/netcfg.h b/netcfg.h
|
||||
index ae3f34c..437c87e 100644
|
||||
--- a/netcfg.h
|
||||
+++ b/netcfg.h
|
||||
@@ -8,6 +8,7 @@
|
||||
#define NETWORKS_FILE "/etc/networks"
|
||||
#define RESOLV_FILE "/etc/resolv.conf"
|
||||
#define RESOLVCONF_FILE "/run/resolvconf/resolv.conf"
|
||||
+#define RESOLVED_FILE "/run/systemd/resolve/stub-resolv.conf"
|
||||
#define DHCLIENT_CONF "/etc/dhclient.conf"
|
||||
#define DOMAIN_FILE "/tmp/domain_name"
|
||||
#define NTP_SERVER_FILE "/tmp/dhcp-ntp-servers"
|
||||
@@ -203,6 +204,7 @@ extern int nameserver_count (const struct netcfg_interface *interface);
|
||||
|
||||
extern int read_resolv_conf_nameservers (char *resolv_conf_file, struct netcfg_interface *interface);
|
||||
extern int is_resolvconf_used();
|
||||
+extern int is_resolved_used();
|
||||
|
||||
extern void sigchld_handler (int sig __attribute__ ((unused)));
|
||||
|
||||
diff --git a/post-base-installer.d/40netcfg b/post-base-installer.d/40netcfg
|
||||
index 9d19e33..ee717c2 100755
|
||||
--- a/post-base-installer.d/40netcfg
|
||||
+++ b/post-base-installer.d/40netcfg
|
||||
@@ -5,3 +5,9 @@ if [ -L /target/etc/resolv.conf ] && [ -f /target/run/resolvconf/resolv.conf ];
|
||||
mkdir -p /run/resolvconf
|
||||
cp /target/run/resolvconf/resolv.conf /run/resolvconf/resolv.conf
|
||||
fi
|
||||
+
|
||||
+# Make sure resolved will still work with bind-mounted /run
|
||||
+if [ -L /target/etc/resolv.conf ] && [ -f /target/run/systemd/resolve/stub-resolv.conf ]; then
|
||||
+ mkdir -p /run/systemd/resolve/
|
||||
+ cp /target/run/systemd/resolve/stub-resolv.conf /run/systemd/resolve/stub-resolv.conf
|
||||
+fi
|
||||
--
|
||||
cgit v1.1
|
||||
|
||||
188
helpers/DATA/netcfg/05_ruc_1.142ubuntu5.patch
Normal file
188
helpers/DATA/netcfg/05_ruc_1.142ubuntu5.patch
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
From 6bbc857030b27f59d660674dd3795595f5caa9a7 Mon Sep 17 00:00:00 2001
|
||||
From: Mathieu Trudel-Lapierre <cyphermox@ubuntu.com>
|
||||
Date: Thu, 12 Oct 2017 09:31:02 -0400
|
||||
Subject: 1.142ubuntu5 (patches unapplied)
|
||||
|
||||
Imported using git-ubuntu import.
|
||||
---
|
||||
debian/changelog | 8 ++++++++
|
||||
dhcp.c | 2 +-
|
||||
netcfg-common.c | 4 ++--
|
||||
netcfg.h | 2 +-
|
||||
static.c | 11 +++++++++--
|
||||
write_interface.c | 41 +++++++++++++++++++++++++++++++----------
|
||||
6 files changed, 52 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/dhcp.c b/dhcp.c
|
||||
index 8824580..baaa820 100644
|
||||
--- a/dhcp.c
|
||||
+++ b/dhcp.c
|
||||
@@ -611,7 +611,7 @@ int netcfg_activate_dhcp (struct debconfclient *client, struct netcfg_interface
|
||||
di_debug("Network config complete");
|
||||
netcfg_write_common("", hostname, domain);
|
||||
netcfg_write_loopback();
|
||||
- netcfg_write_interface(client, interface);
|
||||
+ netcfg_write_interface(client, interface, domain);
|
||||
netcfg_write_resolv(domain, interface);
|
||||
#if !defined(__FreeBSD_kernel__)
|
||||
kill_dhcp_client();
|
||||
diff --git a/netcfg-common.c b/netcfg-common.c
|
||||
index 8afe70d..378a873 100644
|
||||
--- a/netcfg-common.c
|
||||
+++ b/netcfg-common.c
|
||||
@@ -1133,8 +1133,8 @@ void netcfg_write_loopback (void)
|
||||
lo.name = LO_IF;
|
||||
lo.loopback = 1;
|
||||
|
||||
- netcfg_write_interface(NULL, NULL);
|
||||
- netcfg_write_interface(NULL, &lo);
|
||||
+ netcfg_write_interface(NULL, NULL, NULL);
|
||||
+ netcfg_write_interface(NULL, &lo, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
diff --git a/netcfg.h b/netcfg.h
|
||||
index 437c87e..3588886 100644
|
||||
--- a/netcfg.h
|
||||
+++ b/netcfg.h
|
||||
@@ -270,7 +270,7 @@ extern int nc_v6_interface_configured(const struct netcfg_interface *interface,
|
||||
extern int nc_v6_get_config_flags(struct debconfclient *client, struct netcfg_interface *interface);
|
||||
|
||||
/* write_interfaces.c */
|
||||
-extern int netcfg_write_interface(struct debconfclient *client, const struct netcfg_interface *interface);
|
||||
+extern int netcfg_write_interface(struct debconfclient *client, const struct netcfg_interface *interface, const char *domain);
|
||||
|
||||
/* rdnssd.c */
|
||||
extern int start_rdnssd(struct debconfclient *client);
|
||||
diff --git a/static.c b/static.c
|
||||
index b73b785..ab7bd52 100644
|
||||
--- a/static.c
|
||||
+++ b/static.c
|
||||
@@ -680,8 +680,15 @@ int netcfg_get_static(struct debconfclient *client, struct netcfg_interface *ifa
|
||||
}
|
||||
netcfg_write_common(iface->ipaddress, hostname, domain);
|
||||
netcfg_write_loopback();
|
||||
- netcfg_write_interface(client, iface);
|
||||
- netcfg_write_resolvconf_options(domain, iface);
|
||||
+ netcfg_write_interface(client, iface, domain);
|
||||
+
|
||||
+ debconf_get(client,"netcfg/do_not_use_netplan");
|
||||
+ /* If this undocumented debconf key is set to true, skip netplan
|
||||
+ * and fallback to /e/n/i as before. Otherwise we're done.
|
||||
+ */
|
||||
+ if (!empty_str(client->value) && strcmp(client->value, "true") == 0) {
|
||||
+ netcfg_write_resolvconf_options(domain, iface);
|
||||
+ }
|
||||
netcfg_write_resolv(domain, iface);
|
||||
}
|
||||
return 0;
|
||||
diff --git a/write_interface.c b/write_interface.c
|
||||
index 14d36e1..d261f76 100644
|
||||
--- a/write_interface.c
|
||||
+++ b/write_interface.c
|
||||
@@ -164,6 +164,27 @@ static int nc_wi_slaac(const struct netcfg_interface *interface, FILE *fd)
|
||||
return 1;
|
||||
}
|
||||
|
||||
+/* Write nameservers for netplan
|
||||
+ */
|
||||
+static int nc_wi_netplan_write_nameservers(const struct netcfg_interface *interface, FILE *fd, const char *domain)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ if (empty_str(domain))
|
||||
+ return 1;
|
||||
+
|
||||
+ fprintf(fd, " nameservers:\n");
|
||||
+ fprintf(fd, " search: [ %s ]\n", domain);
|
||||
+ fprintf(fd, " addresses:\n");
|
||||
+ for (i = 0; i < NETCFG_NAMESERVERS_MAX; i++) {
|
||||
+ if (!empty_str(interface->nameservers[i])) {
|
||||
+ fprintf(fd, " - %s\n", interface->nameservers[i]);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
/* Write out a static IPv4 config stanza for the given interface
|
||||
*/
|
||||
static int nc_wi_static_ipv4(const struct netcfg_interface *interface, FILE *fd)
|
||||
@@ -182,7 +203,7 @@ static int nc_wi_static_ipv4(const struct netcfg_interface *interface, FILE *fd)
|
||||
return 1;
|
||||
}
|
||||
|
||||
-static int nc_wi_netplan_static_ipv4(const struct netcfg_interface *interface, FILE *fd)
|
||||
+static int nc_wi_netplan_static_ipv4(const struct netcfg_interface *interface, FILE *fd, const char *domain)
|
||||
{
|
||||
fprintf(fd, " addresses: [ %s/%i ]\n", interface->ipaddress,
|
||||
empty_str(interface->pointopoint) ? interface->masklen : 32);
|
||||
@@ -190,7 +211,7 @@ static int nc_wi_netplan_static_ipv4(const struct netcfg_interface *interface, F
|
||||
fprintf(fd, " gateway4: %s\n",
|
||||
empty_str(interface->pointopoint) ? interface->gateway : interface->pointopoint);
|
||||
|
||||
- return 1;
|
||||
+ return nc_wi_netplan_write_nameservers(interface, fd, domain);
|
||||
}
|
||||
|
||||
/* Write out a static IPv6 config stanza for the given interface
|
||||
@@ -207,13 +228,13 @@ static int nc_wi_static_ipv6(const struct netcfg_interface *interface, FILE *fd)
|
||||
return 1;
|
||||
}
|
||||
|
||||
-static int nc_wi_netplan_static_ipv6(const struct netcfg_interface *interface, FILE *fd)
|
||||
+static int nc_wi_netplan_static_ipv6(const struct netcfg_interface *interface, FILE *fd, const char *domain)
|
||||
{
|
||||
fprintf(fd, " addresses: [ %s/%i ]\n", interface->ipaddress, interface->masklen);
|
||||
if (!empty_str(interface->gateway))
|
||||
fprintf(fd, " gateway6: %s\n", interface->gateway);
|
||||
|
||||
- return 1;
|
||||
+ return nc_wi_netplan_write_nameservers(interface, fd, domain);
|
||||
}
|
||||
|
||||
static int nc_wi_write_eni(const struct netcfg_interface *interface, FILE *fd)
|
||||
@@ -258,7 +279,7 @@ static int nc_wi_write_eni(const struct netcfg_interface *interface, FILE *fd)
|
||||
return rv;
|
||||
}
|
||||
|
||||
-static int nc_wi_write_netplan_yaml(const struct netcfg_interface *interface, FILE *fd, off_t size)
|
||||
+static int nc_wi_write_netplan_yaml(const struct netcfg_interface *interface, FILE *fd, off_t size, const char *domain)
|
||||
{
|
||||
int rv;
|
||||
|
||||
@@ -310,10 +331,10 @@ static int nc_wi_write_netplan_yaml(const struct netcfg_interface *interface, FI
|
||||
/* Write all other static addresses */
|
||||
if (interface->address_family == AF_INET) {
|
||||
di_debug("Writing static IPv4 stanza for %s", interface->name);
|
||||
- rv = nc_wi_netplan_static_ipv4(interface, fd);
|
||||
- } else if (interface->address_family == AF_INET) {
|
||||
+ rv = nc_wi_netplan_static_ipv4(interface, fd, domain);
|
||||
+ } else if (interface->address_family == AF_INET6) {
|
||||
di_debug("Writing static IPv6 stanza for %s", interface->name);
|
||||
- rv = nc_wi_netplan_static_ipv6(interface, fd);
|
||||
+ rv = nc_wi_netplan_static_ipv6(interface, fd, domain);
|
||||
}
|
||||
|
||||
if (rv && interface && is_wireless_iface(interface->name)) {
|
||||
@@ -346,7 +367,7 @@ void unlink_config_tmp_file(int use_netplan)
|
||||
* returned, the interfaces file will not have been modified, and errno will
|
||||
* contain the details.
|
||||
*/
|
||||
-int netcfg_write_interface(struct debconfclient *client, const struct netcfg_interface *interface)
|
||||
+int netcfg_write_interface(struct debconfclient *client, const struct netcfg_interface *interface, const char *domain)
|
||||
{
|
||||
FILE *fd;
|
||||
int rv;
|
||||
@@ -449,7 +470,7 @@ int netcfg_write_interface(struct debconfclient *client, const struct netcfg_int
|
||||
rv = 1;
|
||||
|
||||
if (use_netplan) {
|
||||
- rv = nc_wi_write_netplan_yaml(interface, fd, stat_buf.st_size);
|
||||
+ rv = nc_wi_write_netplan_yaml(interface, fd, stat_buf.st_size, domain);
|
||||
} else {
|
||||
rv = nc_wi_write_eni(interface, fd);
|
||||
}
|
||||
--
|
||||
cgit v1.1
|
||||
|
||||
39
helpers/DATA/netcfg/06_ruc_1.142ubuntu6.patch
Normal file
39
helpers/DATA/netcfg/06_ruc_1.142ubuntu6.patch
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
From d3e289ae492c744eabc1db189fbecce8f2de1d2d Mon Sep 17 00:00:00 2001
|
||||
From: Mathieu Trudel-Lapierre <cyphermox@ubuntu.com>
|
||||
Date: Sun, 18 Mar 2018 21:24:47 -0400
|
||||
Subject: 1.142ubuntu6 (patches unapplied)
|
||||
|
||||
Imported using git-ubuntu import.
|
||||
---
|
||||
debian/changelog | 7 +++++++
|
||||
write_interface.c | 6 +++---
|
||||
2 files changed, 10 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/write_interface.c b/write_interface.c
|
||||
index d261f76..5ca1cc0 100644
|
||||
--- a/write_interface.c
|
||||
+++ b/write_interface.c
|
||||
@@ -178,7 +178,7 @@ static int nc_wi_netplan_write_nameservers(const struct netcfg_interface *interf
|
||||
fprintf(fd, " addresses:\n");
|
||||
for (i = 0; i < NETCFG_NAMESERVERS_MAX; i++) {
|
||||
if (!empty_str(interface->nameservers[i])) {
|
||||
- fprintf(fd, " - %s\n", interface->nameservers[i]);
|
||||
+ fprintf(fd, " - \"%s\"\n", interface->nameservers[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,9 +230,9 @@ static int nc_wi_static_ipv6(const struct netcfg_interface *interface, FILE *fd)
|
||||
|
||||
static int nc_wi_netplan_static_ipv6(const struct netcfg_interface *interface, FILE *fd, const char *domain)
|
||||
{
|
||||
- fprintf(fd, " addresses: [ %s/%i ]\n", interface->ipaddress, interface->masklen);
|
||||
+ fprintf(fd, " addresses: [ \"%s/%i\" ]\n", interface->ipaddress, interface->masklen);
|
||||
if (!empty_str(interface->gateway))
|
||||
- fprintf(fd, " gateway6: %s\n", interface->gateway);
|
||||
+ fprintf(fd, " gateway6: \"%s\"\n", interface->gateway);
|
||||
|
||||
return nc_wi_netplan_write_nameservers(interface, fd, domain);
|
||||
}
|
||||
--
|
||||
cgit v1.1
|
||||
|
||||
33
helpers/DATA/netcfg/07_ruc_1.142ubuntu7.patch
Normal file
33
helpers/DATA/netcfg/07_ruc_1.142ubuntu7.patch
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
From ad4fc74f5ad7b5195f3cf23c7943c4736702ae72 Mon Sep 17 00:00:00 2001
|
||||
From: Dimitri John Ledkov <xnox@ubuntu.com>
|
||||
Date: Wed, 25 Apr 2018 13:25:45 +0100
|
||||
Subject: 1.142ubuntu7 (patches unapplied)
|
||||
|
||||
Imported using git-ubuntu import.
|
||||
---
|
||||
debian/changelog | 7 +++++++
|
||||
write_interface.c | 5 +++--
|
||||
2 files changed, 10 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/write_interface.c b/write_interface.c
|
||||
index 5ca1cc0..67d2977 100644
|
||||
--- a/write_interface.c
|
||||
+++ b/write_interface.c
|
||||
@@ -170,11 +170,12 @@ static int nc_wi_netplan_write_nameservers(const struct netcfg_interface *interf
|
||||
{
|
||||
int i;
|
||||
|
||||
- if (empty_str(domain))
|
||||
+ if (empty_str(domain) && empty_str(interface->nameservers[0]))
|
||||
return 1;
|
||||
|
||||
fprintf(fd, " nameservers:\n");
|
||||
- fprintf(fd, " search: [ %s ]\n", domain);
|
||||
+ if (!empty_str(domain))
|
||||
+ fprintf(fd, " search: [ %s ]\n", domain);
|
||||
fprintf(fd, " addresses:\n");
|
||||
for (i = 0; i < NETCFG_NAMESERVERS_MAX; i++) {
|
||||
if (!empty_str(interface->nameservers[i])) {
|
||||
--
|
||||
cgit v1.1
|
||||
|
||||
26
helpers/DATA/netcfg/08_ruc_1.142ubuntu8.patch
Normal file
26
helpers/DATA/netcfg/08_ruc_1.142ubuntu8.patch
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
From 79924426783a58228102737ce9e2f22c631e5a09 Mon Sep 17 00:00:00 2001
|
||||
From: Mathieu Trudel-Lapierre <cyphermox@ubuntu.com>
|
||||
Date: Fri, 15 Feb 2019 14:35:12 -0500
|
||||
Subject: 1.142ubuntu8 (patches unapplied)
|
||||
|
||||
Imported using git-ubuntu import.
|
||||
---
|
||||
debian/changelog | 8 ++++++++
|
||||
write_interface.c | 1 +
|
||||
2 files changed, 9 insertions(+)
|
||||
|
||||
diff --git a/write_interface.c b/write_interface.c
|
||||
index 67d2977..344b419 100644
|
||||
--- a/write_interface.c
|
||||
+++ b/write_interface.c
|
||||
@@ -390,6 +390,7 @@ int netcfg_write_interface(struct debconfclient *client, const struct netcfg_int
|
||||
} else {
|
||||
use_netplan = 0;
|
||||
config_file_path = INTERFACES_FILE;
|
||||
+ di_exec_shell_log("apt-install ifupdown");
|
||||
}
|
||||
|
||||
di_warning("Using %s", config_file_path);
|
||||
--
|
||||
cgit v1.1
|
||||
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
--- netcfg-1.176+11.0trisquel2/finish-install.d/55netcfg-copy-config 2022-11-21 19:21:58.138150737 -0600
|
||||
+++ netcfg-1.176+11.0trisquel2/finish-install.d/55netcfg-copy-config__ 2022-11-21 19:21:50.646130993 -0600
|
||||
@@ -17,19 +17,23 @@
|
||||
exit 0
|
||||
fi
|
||||
|
||||
+# The type of the connection used during installation
|
||||
+NETCFG_CONNECTION_TYPE=$(cat $FILE_NETCFG_CONNECTION_TYPE | \
|
||||
+ grep "connection type" | cut -d ':' -f2 | sed 's/ //g')
|
||||
+NETCFG_CONNECTION_SECURITY=$(cat $FILE_NETCFG_CONNECTION_TYPE | \
|
||||
+ grep "security" | cut -d ':' -f2 | sed 's/ //g')
|
||||
+
|
||||
# Flag to determine whether Network Manager is installed.
|
||||
if in-target sh -c "dpkg-query -s network-manager 2>/dev/null | grep -q '^Status: install ok installed'"; then
|
||||
NM_IS_INSTALLED=true
|
||||
else
|
||||
NM_IS_INSTALLED=false
|
||||
+ chroot /target apt-get -y install ifupdown
|
||||
+ if [ "$NETCFG_CONNECTION_TYPE" = "wireless" ]; then
|
||||
+ chroot /target apt-get -y install wireless-tools
|
||||
+ fi
|
||||
fi
|
||||
|
||||
-# The type of the connection used during installation
|
||||
-NETCFG_CONNECTION_TYPE=$(cat $FILE_NETCFG_CONNECTION_TYPE | \
|
||||
- grep "connection type" | cut -d ':' -f2 | sed 's/ //g')
|
||||
-NETCFG_CONNECTION_SECURITY=$(cat $FILE_NETCFG_CONNECTION_TYPE | \
|
||||
- grep "security" | cut -d ':' -f2 | sed 's/ //g')
|
||||
-
|
||||
# netcfg/target_network_config question values
|
||||
CONFIG_NM="nm_config"
|
||||
CONFIG_INTERFACES="ifupdown"
|
||||
@@ -43,11 +47,7 @@
|
||||
if $NM_IS_INSTALLED; then
|
||||
db_set netcfg/target_network_config $CONFIG_NM
|
||||
else
|
||||
- if [ "$NETCFG_CONNECTION_TYPE" = "wired" ]; then
|
||||
- db_set netcfg/target_network_config $CONFIG_INTERFACES
|
||||
- else # wireless
|
||||
- db_set netcfg/target_network_config $CONFIG_LOOPBACK
|
||||
- fi
|
||||
+ db_set netcfg/target_network_config $CONFIG_INTERFACES
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
diff -ru netcfg-1.176+11.0trisquel1/finish-install.d/55netcfg-copy-config netcfg-1.142ubuntu8+10.0trisquel1/finish-install.d/55netcfg-copy-config
|
||||
--- netcfg-1.176+11.0trisquel1/finish-install.d/55netcfg-copy-config 2018-08-10 14:23:07.000000000 -0500
|
||||
+++ netcfg-1.142ubuntu8+10.0trisquel1/finish-install.d/55netcfg-copy-config 2017-05-16 23:21:18.000000000 -0500
|
||||
@@ -59,6 +59,14 @@
|
||||
mkdir -p /target/$FILE_PATH_NM_CONFIG
|
||||
cp /$FILE_PATH_NM_CONFIG/* /target/$FILE_PATH_NM_CONFIG/
|
||||
|
||||
+ # Write netplan config file to hand over management to NM
|
||||
+ cat <<EOF > /target/etc/netplan/01-network-manager-all.yaml
|
||||
+# Let NetworkManager manage all devices on this system
|
||||
+network:
|
||||
+ version: 2
|
||||
+ renderer: NetworkManager
|
||||
+EOF
|
||||
+
|
||||
# Rewrite /etc/network/interfaces to contain only loopback
|
||||
netcfg write_loopback
|
||||
;;
|
||||
|
|
@ -17,16 +17,19 @@
|
|||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
VERSION=3
|
||||
VERSION=4
|
||||
EXTERNAL='deb-src http://ftp.debian.org/debian stable main'
|
||||
REPOKEY=648ACFD622F3D138
|
||||
NETINST=true
|
||||
. ./config
|
||||
|
||||
rpl "Default: debian" "Default: trisquel" . -R
|
||||
sed -i '/client, template,/s/debian/trisquel/g' netcfg-common.c
|
||||
patch -p1 < $DATA/restore_network-manager_management.patch
|
||||
patch -p1 < $DATA/ifupdown.patch
|
||||
# Re apply upstream behavior and configuration features from last release (focal).
|
||||
# https://git.launchpad.net/ubuntu/+source/netcfg/log/?h=ubuntu/focal
|
||||
for patch in $(ls -v ${DATA}/*.patch)
|
||||
do
|
||||
echo "Applying $patch"
|
||||
patch -Np1 < $patch
|
||||
done
|
||||
|
||||
changelog "Rebranded and adapted for Trisquel"
|
||||
compile
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue