Only update the release link if the release has changed

This commit is contained in:
Eelco Dolstra 2016-09-29 10:55:11 +02:00
parent fcf5a77736
commit 6cb926311e

View file

@ -197,9 +197,10 @@ write_file($htaccess,
"Redirect /releases/nixos/channels/$channelName $target\n"); "Redirect /releases/nixos/channels/$channelName $target\n");
my $channelLink = "$channelsDir/$channelName"; my $channelLink = "$channelsDir/$channelName";
unlink("$channelLink.tmp"); if ((read_file($channelLink, err_mode => 'quiet') // "") ne $target) {
write_file("$channelLink.tmp", "$target"); write_file("$channelLink.tmp", "$target");
rename("$channelLink.tmp", $channelLink) or die; rename("$channelLink.tmp", $channelLink) or die;
}
system("cat $channelsDir/.htaccess-nix* > $channelsDir/.htaccess.tmp") == 0 or die; system("cat $channelsDir/.htaccess-nix* > $channelsDir/.htaccess.tmp") == 0 or die;
rename("$channelsDir/.htaccess.tmp", "$channelsDir/.htaccess") or die; rename("$channelsDir/.htaccess.tmp", "$channelsDir/.htaccess") or die;