diff options
| author | Angus Gibson <angus@agibson.me> | 2026-05-26 23:12:22 +0100 |
|---|---|---|
| committer | Liliana Marie Prikler <liliana.prikler@gmail.com> | 2026-05-31 08:30:21 +0200 |
| commit | 14c9a6720e9fed900cfc3ab04e6ea6d9fa56aa0e (patch) | |
| tree | 9be676822ee45799325421fc6be2adf8163c1e27 | |
| parent | 1cd22486b8c9a5e933989645c56c811debf8da44 (diff) | |
services: network-manager: Only delete symlinks into store
Instead of potentially deleting in the store itself, ensure
only the symlink to the store is deleted by using delete-file.
* gnu/services/networking.scm (network-manager-activation):
<dnsmasq-configuration-files>: Use readlink instead of canonicalize path.
Use delete-file instead of delete-files-recursively.
<extra-configuration-files>: Likewise.
Change-Id: I2e84ecfebb8a6c8797d851b35e90bb747432c0b2
Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
| -rw-r--r-- | gnu/services/networking.scm | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index c8a7ce21c95..cc3876492d8 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm | |||
| @@ -1487,11 +1487,9 @@ project's documentation} for more information." | |||
| 1487 | #$@(if (pair? dnsmasq-configuration-files) ;if non-empty | 1487 | #$@(if (pair? dnsmasq-configuration-files) ;if non-empty |
| 1488 | ;; If /etc/NetworkManager/dnsmasq.d is a symlink to a store file, | 1488 | ;; If /etc/NetworkManager/dnsmasq.d is a symlink to a store file, |
| 1489 | ;; delete it. | 1489 | ;; delete it. |
| 1490 | `((if (and (file-exists? "/etc/NetworkManager/dnsmasq.d") | 1490 | `((when (false-if-exception |
| 1491 | (store-file-name? | 1491 | (store-file-name? (readlink "/etc/NetworkManager/dnsmasq.d"))) |
| 1492 | (canonicalize-path "/etc/NetworkManager/dnsmasq.d"))) | 1492 | (delete-file "/etc/NetworkManager/dnsmasq.d")) |
| 1493 | (delete-file-recursively | ||
| 1494 | "/etc/NetworkManager/dnsmasq.d")) | ||
| 1495 | (symlink | 1493 | (symlink |
| 1496 | ,(file-union "network-manager-dnsmasq-configuration-directory" | 1494 | ,(file-union "network-manager-dnsmasq-configuration-directory" |
| 1497 | dnsmasq-configuration-files) | 1495 | dnsmasq-configuration-files) |
| @@ -1500,11 +1498,9 @@ project's documentation} for more information." | |||
| 1500 | #$@(if (pair? extra-configuration-files) ;if non-empty | 1498 | #$@(if (pair? extra-configuration-files) ;if non-empty |
| 1501 | ;; If /etc/NetworkManager/conf.d is a symlink to a store file, | 1499 | ;; If /etc/NetworkManager/conf.d is a symlink to a store file, |
| 1502 | ;; delete it. | 1500 | ;; delete it. |
| 1503 | `((if (and (file-exists? "/etc/NetworkManager/conf.d") | 1501 | `((when (false-if-exception |
| 1504 | (store-file-name? | 1502 | (store-file-name? (readlink "/etc/NetworkManager/conf.d"))) |
| 1505 | (canonicalize-path "/etc/NetworkManager/conf.d"))) | 1503 | (delete-file "/etc/NetworkManager/conf.d")) |
| 1506 | (delete-file-recursively | ||
| 1507 | "/etc/NetworkManager/conf.d")) | ||
| 1508 | ;; If it exists but is not a symlink to a store file, then | 1504 | ;; If it exists but is not a symlink to a store file, then |
| 1509 | ;; this will fail with EEXIST; we leave this for the user to | 1505 | ;; this will fail with EEXIST; we leave this for the user to |
| 1510 | ;; handle, since they probably created the directory | 1506 | ;; handle, since they probably created the directory |
