]> git.proxmox.com Git - pve-container.git/commitdiff
setup: enable systemd-networkd via preset for archlinux
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 16 Jun 2023 07:39:45 +0000 (09:39 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 16 Jun 2023 08:17:41 +0000 (10:17 +0200)
Note that this is now done in `setup_init` which is a
pre-start hook rather than a one time template fixup,
however, the presets are only applied on first boot or if
the user requests them explicitly, and the usual mechanisms
to prevent the file from being written can be used.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/PVE/LXC/Setup/ArchLinux.pm

index e379ea12a5f540b8bc24cf51633e653240d9f301..f7921614c617070807bf097ee80733172786ea4c 100644 (file)
@@ -25,18 +25,6 @@ sub new {
 
 sub template_fixup {
     my ($self, $conf) = @_;
-    # ArchLinux doesn't come with any particular predefined and enabled
-    # networking, so it probably makes sense to do the equivalent of
-    # 'systemctl enable systemd-networkd', since that's what we're configuring
-    # in setup_network
-
-    # systemctl enable systemd-networkd
-    $self->ct_mkdir('/etc/systemd/system/multi-user.target.wants');
-    $self->ct_mkdir('/etc/systemd/system/socket.target.wants');
-    $self->ct_symlink('/usr/lib/systemd/system/systemd-networkd.service',
-                      '/etc/systemd/system/multi-user.target.wants/systemd-networkd.service');
-    $self->ct_symlink('/usr/lib/systemd/system/systemd-networkd.socket',
-                      '/etc/systemd/system/socket.target.wants/systemd-networkd.socket');
 
     # edit /etc/securetty (enable login on console)
     $self->setup_securetty($conf);
@@ -46,6 +34,15 @@ sub template_fixup {
 
 sub setup_init {
     my ($self, $conf) = @_;
+
+    $self->setup_systemd_preset({
+       # ArchLinux doesn't come with any particular predefined and enabled
+       # networking, so it probably makes sense to do the equivalent of
+       # 'systemctl enable systemd-networkd', since that's what we're configuring
+       # in setup_network
+       'systemd-networkd.service' => 1
+    });
+
     $self->setup_container_getty_service($conf);
 }