#!/usr/bin/perl $| = 1; open(STDERR, ">&STDOUT"); use warnings; use CGI; use IPC::Open2; $q = CGI->new; my @cmd; print( "Content-type: text/plain\n\n"); if( defined( $q->param('r') ) && defined( $q->param('d') ) ) { # repository, description @cmd = ( '/usr/sbin/piny-suid', $ENV{'REMOTE_USER'}, 'newrepo', '--batch', '--enable-ikiwiki', $q->param('r') ); if( defined( scalar( $q->param('i') ) ) && scalar( $q->param('i') ) eq "0" ) { push( @cmd, '--disable-ikiwiki' ); } elsif( defined( scalar( $q->param('i') ) ) && scalar( $q->param('i') ) eq "1" ) { push( @cmd, '--enable-ikiwiki' ); }; if( defined( $q->param('s') ) ) { # source push( @cmd, scalar( $q->param('s') ) ); }; unless( open2( OUT, IN, @cmd ) ) { 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.'; };