#!/usr/bin/perl use strict; use warnings; use Piny; my $env = Piny::Environment->instance( ); my $config = Piny::Config->new( ); my $dest = $config->piny_newuseremail; foreach my $reponame ( @ARGV ) { my $repo = Piny::Repo->new( $reponame ); if ( $env->user->uid != 0 and $repo->owner->uid != $env->user->uid ) { print STDERR "You are not the owner of $reponame!\n"; exit 1; }; unless( open( MAIL, "|/usr/lib/sendmail -t" ) ) { die "Couldn't execute sendmail: $!\n"; }; print MAIL <<END; To: $dest Subject: Removing piny repo $reponame Content-type: text/plain; charset=us-ascii The piny repo ``$reponame'' has been removed. END close( MAIL ); $repo->destroy; };