summaryrefslogtreecommitdiff
path: root/libpiny/lib/Piny/Repo.pm
diff options
context:
space:
mode:
authorJoe Rayhawk <jrayhawk@omgwallhack.org>2011-05-11 19:58:01 -0700
committerJoe Rayhawk <jrayhawk@omgwallhack.org>2011-05-11 19:58:01 -0700
commit61c4748cbe812c1bd4a1772354326792b3d9aa33 (patch)
treeb671c3813f03e19feaa47a9e79b2d1c01413070a /libpiny/lib/Piny/Repo.pm
parent8629b2227631419ef53b32303c77779a38ebb4f1 (diff)
downloadpiny-code-61c4748cbe812c1bd4a1772354326792b3d9aa33.tar.gz
piny-code-61c4748cbe812c1bd4a1772354326792b3d9aa33.zip
Make destroy and rebuild operations quieter.
Diffstat (limited to 'libpiny/lib/Piny/Repo.pm')
-rw-r--r--libpiny/lib/Piny/Repo.pm21
1 files changed, 13 insertions, 8 deletions
diff --git a/libpiny/lib/Piny/Repo.pm b/libpiny/lib/Piny/Repo.pm
index 0d2496f..b6fea4d 100644
--- a/libpiny/lib/Piny/Repo.pm
+++ b/libpiny/lib/Piny/Repo.pm
@@ -226,7 +226,7 @@ sub rebuild_git {
unless( getgrnam("git-" . $s->shortname ) ) {
system( "/usr/sbin/addgroup", "--quiet", "git-" . $s->shortname ) and die "Could not create repo group!";
system( "/usr/sbin/adduser", "--quiet", $s->owner->name, "git-" . $s->shortname ) and die "Could not add you to the repo group!";
- system( "/usr/sbin/adduser", "--quiet", "iki-" . $s->shortname, "git-" . $s->shortname ) and print "...But that's okay.\n";
+ getpwnam("iki-" . $s->shortname) and system( "/usr/sbin/adduser", "--quiet", "iki-" . $s->shortname, "git-" . $s->shortname ) and die "Could not add ikiwiki user to git group!";
};
foreach( "git-daemon-export-ok", "packed-refs" ) {
@@ -330,13 +330,14 @@ sub destroy_ikiwiki {
my $user = Piny::Environment->instance->user;
- unlink( "/etc/apache2/piny-enabled/" . $s->name );
- unlink( "/etc/apache2/piny-available/" . $s->name );
+ foreach( "/etc/apache2/piny-enabled/" . $s->name, "/etc/apache2/piny-available/" . $s->name, "/etc/ikiwiki/wikilist.d/" . $s->name ) {
+ if ( -e $_ ) {
+ unlink( $_ );
+ };
+ };
system( "/etc/init.d/apache2", "reload" ) and die "Could not reload apache config!";
- unlink( "/etc/ikiwiki/wikilist.d/" . $s->name );
-
my $temp = File::Temp->new( ) or die "Could not create temporary file: $!";
$temp->unlink_on_destroy( 0 );
@@ -354,12 +355,16 @@ sub destroy_ikiwiki {
rename( $temp->filename, "/etc/ikiwiki/wikilist" ) or die "Could not rename over old wikilist: $!";
- system( "rm", "-rf", $s->secure_path, $s->ikiwiki_destdir, $s->ikiwiki_srcdir, "/etc/ikiwiki/piny/" . $s->name . ".setup" );
+ foreach( $s->secure_path, $s->ikiwiki_destdir, $s->ikiwiki_srcdir, "/etc/ikiwiki/piny/" . $s->name . ".setup" ) {
+ if ( -e $_ ) {
+ system( "rm", "-rf", $_ );
+ };
+ };
my $ikiuser = Piny::User::IkiWiki->new( "name" => "iki-" . $s->name );
- system( "deluser", "--remove-home", "iki-" . $s->shortname );
- system( "delgroup", "iki-" . $s->shortname );
+ getpwnam( "iki-" . $s->shortname ) and system( "deluser", "--remove-home", "iki-" . $s->shortname );
+ getgrnam( "iki-" . $s->shortname ) and system( "delgroup", "iki-" . $s->shortname );
};