aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author45mg <45mg.writes@gmail.com>2025-03-02 23:59:49 +0530
committerVagrant Cascadian <vagrant@debian.org>2025-03-23 10:28:33 -0700
commita1e87abaa364f8391cfd1f49bb01876f7a730bfb (patch)
treed1932f14079ea17f2de7914614b6952c85d0e745
parent490b4e190a6589ff18f7ba76b4d9302697c113d6 (diff)
downloadguix-a1e87abaa364f8391cfd1f49bb01876f7a730bfb.tar.gz
guix-a1e87abaa364f8391cfd1f49bb01876f7a730bfb.zip
services: network-manager: Handle existing configuration directory.
* gnu/services/networking.scm (network-manager-activation): Handle the case where /etc/NetworkManager/conf.d already exists. Change-Id: I7af4f4ad226eef28bd8667f0708525e77a6a50c8 Signed-off-by: Vagrant Cascadian <vagrant@debian.org>
-rw-r--r--gnu/services/networking.scm13
1 files changed, 12 insertions, 1 deletions
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index 85ad5287f2..67653e2cbf 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -1432,7 +1432,18 @@ project's documentation} for more information."
'((mkdir-p "/var/lib/misc"))
'())
#$@(if (pair? extra-configuration-files) ;if non-empty
- `((symlink
+ ;; If /etc/NetworkManager/conf.d is a symlink to a store file,
+ ;; delete it.
+ `((if (and (file-exists? "/etc/NetworkManager/conf.d")
+ (store-file-name?
+ (canonicalize-path "/etc/NetworkManager/conf.d")))
+ (delete-file-recursively
+ "/etc/NetworkManager/conf.d"))
+ ;; If it exists but is not a symlink to a store file, then
+ ;; this will fail with EEXIST; we leave this for the user to
+ ;; handle, since they probably created the directory
+ ;; themselves.
+ (symlink
,(file-union "network-manager-configuration-directory"
extra-configuration-files)
"/etc/NetworkManager/conf.d"))