blob: 66fc59bcfe23a7e52907f27e51a6ca03b8db9301 (
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
28
29
30
31
32
33
34
35
36
|
#!/usr/bin/perl
# youri-submit wrapper
use strict;
use warnings;
use Fcntl ':mode';
use File::Basename;
use MDK::Common;
my $log_dir = "$ENV{HOME}/submit-logs";
my $sudo_user = $ENV{SUDO_USER} or die "should be run through sudo";
my @prog = ('perl', '-I/usr/share/mga-youri-submit/lib', '/usr/share/mga-youri-submit/bin/youri-submit');
my @options;
foreach my $arg (@ARGV) {
if ($arg =~ /^-?-(\S+)/) {
# drop prohibited options
if ($arg =~ /-c/ || $arg =~ /-s/) {
print STDERR "prohibited option $arg, skipping\n";
next;
}
}
push(@options, $arg);
}
# logging for bug #30315 -spuk, 2007-05-29
mkdir_p($log_dir);
open(STDERR, "| tee -a $log_dir/$sudo_user.err >&2");
open(STDOUT, "| tee -a $log_dir/$sudo_user.out");
# call wrapped program
print "Executing @prog --config /etc/youri/submit-todo.conf --define user=$sudo_user @options (sudo_user $sudo_user)\n";
my $err = system(@prog, "--config", "/etc/youri/submit-todo.conf", "--define", "user=$sudo_user", @options) && ($? >> 8 || 1);
exit $err
|