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.
This commit is contained in:
parent
393b2e3b19
commit
1b5e860f65
2 changed files with 11 additions and 4 deletions
|
@ -27,7 +27,10 @@ with pkgs.lib;
|
|||
environment.variables.TZDIR = "/etc/zoneinfo";
|
||||
environment.variables.TZ = config.time.timeZone;
|
||||
|
||||
environment.etc.localtime.source = "${pkgs.tzdata}/share/zoneinfo/${config.time.timeZone}";
|
||||
environment.etc.localtime =
|
||||
{ source = "${pkgs.tzdata}/share/zoneinfo/${config.time.timeZone}";
|
||||
mode = "direct-symlink";
|
||||
};
|
||||
|
||||
environment.etc.zoneinfo.source = "${pkgs.tzdata}/share/zoneinfo";
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue