aboutsummaryrefslogtreecommitdiffstats
path: root/modules/buildsystem/templates/mga-youri-submit.wrapper
diff options
context:
space:
mode:
authorOlivier Blin <blino@mageia.org>2011-04-04 23:55:35 +0000
committerOlivier Blin <blino@mageia.org>2011-04-04 23:55:35 +0000
commit0d92b3daf96cdda22f865aa9f5820e3a4df6f162 (patch)
treecc599a93612551e27e0c6b9692598bfa7719e3e2 /modules/buildsystem/templates/mga-youri-submit.wrapper
parent826118241735174cf8bf12a95e04711d39afc363 (diff)
downloadpuppet-0d92b3daf96cdda22f865aa9f5820e3a4df6f162.tar
puppet-0d92b3daf96cdda22f865aa9f5820e3a4df6f162.tar.gz
puppet-0d92b3daf96cdda22f865aa9f5820e3a4df6f162.tar.bz2
puppet-0d92b3daf96cdda22f865aa9f5820e3a4df6f162.tar.xz
puppet-0d92b3daf96cdda22f865aa9f5820e3a4df6f162.zip
use mga-youri-submit (and rename files accordingly)
Diffstat (limited to 'modules/buildsystem/templates/mga-youri-submit.wrapper')
-rwxr-xr-xmodules/buildsystem/templates/mga-youri-submit.wrapper36
1 files changed, 36 insertions, 0 deletions
diff --git a/modules/buildsystem/templates/mga-youri-submit.wrapper b/modules/buildsystem/templates/mga-youri-submit.wrapper
new file mode 100755
index 00000000..66fc59bc
--- /dev/null
+++ b/modules/buildsystem/templates/mga-youri-submit.wrapper
@@ -0,0 +1,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