about summary refs log tree commit diff
path: root/nixos/modules/system/etc/setup-etc.pl
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-01-06 18:23:41 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-01-06 18:23:41 +0100
commit1b5e860f65607b4cc7de4b6b5db95460cf144526 (patch)
treecac5cfb1dda810921963d3749d87a54407b84177 /nixos/modules/system/etc/setup-etc.pl
parent393b2e3b19507d5df734be144cb29c59d989650e (diff)
downloadnixlib-1b5e860f65607b4cc7de4b6b5db95460cf144526.tar
nixlib-1b5e860f65607b4cc7de4b6b5db95460cf144526.tar.gz
nixlib-1b5e860f65607b4cc7de4b6b5db95460cf144526.tar.bz2
nixlib-1b5e860f65607b4cc7de4b6b5db95460cf144526.tar.lz
nixlib-1b5e860f65607b4cc7de4b6b5db95460cf144526.tar.xz
nixlib-1b5e860f65607b4cc7de4b6b5db95460cf144526.tar.zst
nixlib-1b5e860f65607b4cc7de4b6b5db95460cf144526.zip
Make /etc/localtime a direct symlink to the zoneinfo file
Some programs (notably the Java Runtime Environment) expect to be able
to extract the name of the time zone from the target of the
/etc/localtime symlink.  That doesn't work if /etc/localtime is a
symlink to /etc/static/localtime.  So make it a direct symlink.
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;
     }