#!/usr/bin/perl $| = 1; open(STDERR, ">&STDOUT"); use warnings; use CGI; use IPC::Open2; $q = CGI->new; print( "Content-type: text/plain\n\n"); if( defined( $q->param('r') ) && defined( $q->param('d') ) ) { if( defined( $q->param('i') && $q->param('i') ~= /0|1/ ) { if( $q->param('i') eq "0" ) { unless( open2( OUT, IN, '/usr/sbin/piny-suid', $ENV{'REMOTE_USER'}, 'newrepo', '--batch', '--disable-ikiwiki', $q->param('r') ) ) { die 'could not execute newrepo'; }; } elsif( $q->param('i') eq "1" ) { unless( open2( OUT, IN, '/usr/sbin/piny-suid', $ENV{'REMOTE_USER'}, 'newrepo', '--batch', '--enable-ikiwiki', $q->param('r') ) ) { die 'could not execute newrepo'; }; }; } else { unless( open2( OUT, IN, '/usr/sbin/piny-suid', $ENV{'REMOTE_USER'}, 'newrepo', '--batch', $q->param('r') ) ) { die 'could not execute newrepo'; }; }; # make things flushier select( (select(IN), $| = 1)[0] ); select( (select(OUT), $| = 1)[0] ); print( IN $q->param('d') . "\n" ); close( IN ); while( ) { print; }; } else { print 'Missing parameters.'; };