forked from webmin/webmin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-devel
executable file
·78 lines (55 loc) · 1.56 KB
/
update-devel
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env perl
# update-devel - Update Webmin/Usermin and/or Authentic Theme from Git, with latest unstable, development version.
use strict;
use warnings;
use 5.010;
use Getopt::Long qw(:config permute pass_through);
use Pod::Usage;
use Term::ANSIColor qw(:constants);
use File::Basename;
use Cwd qw(cwd);
my %opt;
GetOptions('help|h' => \$opt{'help'},
'product|p=s' => \$opt{'product'},
'theme|t!' => \$opt{'theme'});
pod2usage(0) if ($opt{'help'} || !$opt{'product'});
# Get current path
my $path = cwd;
# Check Webmin lib
my $lib = "web-lib-funcs.pl";
if (!-r "$path/$lib") {
$path = dirname(dirname($0));
if (!-r "$path/$lib") {
$path = $path = Cwd::realpath('..');
}
}
# Run actual update or throw an error
my $p = $opt{'product'};
if ($p =~ /^webmin$|^usermin$/i) {
if ($p =~ /^usermin$/i) {
$path =~ s/webmin/$p/;
}
my $cmd = "cd $path && ./update-from-repo.sh -force";
if ($opt{'theme'}) {
$cmd = "cd $path/authentic-theme && ./theme-update.sh -force";
}
system($cmd);
} else {
say RED, "Unknow product name: $p", RESET;
exit 0;
}
=pod
=head1 NAME
update-devel
=head1 DESCRIPTION
Update Webmin/Usermin and/or Authentic Theme from Git, with latest unstable, development version.
=head1 SYNOPSIS
update-devel [options] --product <webmin|usermin> [--theme]
=head1 OPTIONS
=over
=item --product, -p
Specify product name to update, like "webmin" or "usermin".
=item --theme, -t
If set, only Authentic Theme will be updated for specified product
=item --help, -h
=back