aboutsummaryrefslogtreecommitdiffstats
path: root/mgaadv
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2013-06-13 12:44:43 +0000
committerNicolas Vigier <boklm@mageia.org>2013-06-13 12:44:43 +0000
commit0be9f48b2fd34fec24c64719ac991d9e7742e515 (patch)
tree865f8a9a75e79f5709dcd8ecfa290cbe6a8db271 /mgaadv
parent434f175a6afea9241473bbee01a84d990fab5ab8 (diff)
downloadmgaadvisories-0be9f48b2fd34fec24c64719ac991d9e7742e515.tar
mgaadvisories-0be9f48b2fd34fec24c64719ac991d9e7742e515.tar.gz
mgaadvisories-0be9f48b2fd34fec24c64719ac991d9e7742e515.tar.bz2
mgaadvisories-0be9f48b2fd34fec24c64719ac991d9e7742e515.tar.xz
mgaadvisories-0be9f48b2fd34fec24c64719ac991d9e7742e515.zip
Add command to add a new advisory
Diffstat (limited to 'mgaadv')
-rwxr-xr-xmgaadv25
1 files changed, 23 insertions, 2 deletions
diff --git a/mgaadv b/mgaadv
index d40762c..99371e9 100755
--- a/mgaadv
+++ b/mgaadv
@@ -2,9 +2,11 @@
use strict;
use MGA::Advisories;
+use Template;
my %actions = (
mksite => \&mksite,
+ new => \&newadv,
usage => \&usage,
);
@@ -19,6 +21,12 @@ $0 usage [action]
Show action usage
END
+ new => <<END,
+$0 new [type] [bugnum]
+
+Create a new advisory file. [type] should be security or bugfix and
+[bugnum] is the bugzilla bug number.
+END
);
sub usage {
@@ -31,6 +39,10 @@ sub usage {
print STDERR map { " - $_\n" } keys %actions;
}
}
+sub usageexit {
+ usage(@_);
+ exit 1;
+}
sub mksite {
my %advdb;
@@ -43,9 +55,18 @@ sub mksite {
MGA::Advisories::send_report_mail(\%advdb);
}
+sub newadv {
+ usageexit('usage', $_[0]) unless @_ == 3;
+ my ($new, $type, $bugnum) = @_;
+ my $file = MGA::Advisories::newadv($type, $bugnum);
+ if ($file) {
+ my $editor = $ENV{EDITOR} || $ENV{VISUAL} || '/usr/bin/editor';
+ system($editor, $file);
+ }
+}
+
if (@ARGV == 0 || !$actions{$ARGV[0]}) {
- usage();
- exit 1;
+ usageexit();
}
$actions{$ARGV[0]}->(@ARGV);