summaryrefslogtreecommitdiff
path: root/libpiny/lib
diff options
context:
space:
mode:
Diffstat (limited to 'libpiny/lib')
-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 );
};