about summary refs log tree commit diff
path: root/nixos/modules/system/etc/setup-etc.pl
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/system/etc/setup-etc.pl')
-rw-r--r--nixos/modules/system/etc/setup-etc.pl10
1 files changed, 7 insertions, 3 deletions
diff --git a/nixos/modules/system/etc/setup-etc.pl b/nixos/modules/system/etc/setup-etc.pl
index 7cb6d2a6a45e..4b79dbaab89e 100644
--- a/nixos/modules/system/etc/setup-etc.pl
+++ b/nixos/modules/system/etc/setup-etc.pl
@@ -57,9 +57,13 @@ sub link {
         open MODE, "<$_.mode";
         my $mode = <MODE>; chomp $mode;
         close MODE;
-        copy "$static/$fn", "$target.tmp" or warn;
-        chmod oct($mode), "$target.tmp" or warn;
-        rename "$target.tmp", $target or warn;
+        if ($mode eq "direct-symlink") {
+            atomicSymlink readlink("$static/$fn"), $target or warn;
+        } else {
+            copy "$static/$fn", "$target.tmp" or warn;
+            chmod oct($mode), "$target.tmp" or warn;
+            rename "$target.tmp", $target or warn;
+        }
     } elsif (-l "$_") {
         atomicSymlink "$static/$fn", $target or warn;
     }