45mg wrote 3 weeks ago
(address . guix-patches@gnu.org)(name . 45mg)(address . 45mg.writes@gmail.com)
* gnu/services/networking.scm (network-manager-activation):
Handle the case where /etc/NetworkManager/conf.d already exists.
Change-Id: I7af4f4ad226eef28bd8667f0708525e77a6a50c8
---
Follow-up to 0caba8f5db48c15a2c3edae37e816654246fa986.
This issue only became apparent after pulling the above commit, changing my
system config to use the new extra-files field, and reconfiguring /twice/. This
sort of thing is why I now pull from a local fork and apply patches to it before
submitting them ;)
gnu/services/networking.scm | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
Toggle diff (28 lines)
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index 53840c2764..45efea330b 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -1271,7 +1271,18 @@ (define (network-manager-activation config)
'((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"))
base-commit: f9dcb84550b85aa816899b2106b1a5ae546167a3
--
2.48.1