* Do some locking.
git-svn-id: https://nixos.org/repos/nix/release/trunk/channels@19658 70bd8c7a-acb8-0310-9f0d-9cc1c95dcdbb
This commit is contained in:
parent
421313d9b0
commit
1a16afabba
1 changed files with 4 additions and 0 deletions
|
@ -3,6 +3,7 @@ use readmanifest;
|
|||
use File::Basename;
|
||||
use File::stat;
|
||||
use File::Temp qw/tempfile/;
|
||||
use Fcntl ':flock';
|
||||
|
||||
if (scalar @ARGV != 3 && scalar @ARGV != 4) {
|
||||
print STDERR "Syntax: perl mirror-channel.pl <src-channel-url> <dst-channel-url> <dst-channel-dir> [<nix-exprs-url>]\n";
|
||||
|
@ -18,6 +19,9 @@ my $nixexprsURL = $ARGV[3] || "$srcChannelURL/nixexprs.tar.bz2";
|
|||
|
||||
die "$dstChannelPath doesn't exist\n" unless -d $dstChannelPath;
|
||||
|
||||
open LOCK, ">$dstChannelPath/.lock" or die;
|
||||
flock LOCK, LOCK_EX;
|
||||
|
||||
my ($fh, $tmpManifest) = tempfile(UNLINK => 1);
|
||||
system("$curl '$srcChannelURL/MANIFEST' > $tmpManifest") == 0 or die;
|
||||
|
||||
|
|
Loading…
Reference in a new issue