Created
July 16, 2014 06:01
-
-
Save lwhsu/c91bf50379d297298be9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
# | |
# Updating ports tree, portsnap.tw.FreeBSD.org cache and | |
# local distfiles. | |
# | |
use strict; | |
my @arch = qw/amd64 i386 ia64 pc98 powerpc sparc64/; | |
my $bsdadm = "bsdadm"; | |
my $portsnap = "/usr/sbin/portsnap"; | |
my $make = "/usr/bin/make"; | |
#print "Job start at ".`date`; | |
open PORTSNAP, "$portsnap cron update|"; | |
#print "Start fetch at ".`date`; | |
while (<PORTSNAP>) { | |
next unless (/^\/.*\/$/); | |
chomp; | |
foreach my $a (@arch) { | |
my $cmd = "cd $_ && $make -DBATCH -DDISABLE_CONFLICTS -DDISABLE_VULNERABILITIES ARCH=$a checksum"; | |
print $cmd ."\n"; | |
system "su -f -m $bsdadm -c \'$cmd\'"; | |
## print the return value | |
# seems work. | |
# print $?. "\n"; | |
last if ($? == 0); | |
} | |
} | |
close PORTSNAP; | |
#print "Job done at ".`date`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment