summaryrefslogtreecommitdiff
path: root/do_update.pl
blob: 7dc0099dd76e04929f64159e8ce1dd07827220bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/perl

use warnings;
use strict;

use FindBin;
use lib "$FindBin::Bin";
use do_common;

my $type = shift @ARGV;
die "Bad arguments" unless defined($type);

chdir($basedir) or die "Failed to change directory to $basedir: $!\n";

my $ref = &read_config($basedir, "$FindBin::Bin/do_update.conf", $type);

for (@$ref) {
    my ($dir, $args) = @$_;

    $args = 'pull' unless $args;

    chdir("$basedir/$dir") or die "Failed to change directory to $basedir/$dir: $!\n";

    my $cmd = "git $args";
    chomp(my $pwd = `pwd`); print "Doing a $cmd in $dir...\n";
    system($cmd) and print STDERR "ERROR: Update of '$dir' was UNSUCCESSFUL!!!\n";
}