diff options
-rw-r--r-- | usr/src/libpiny/lib/Piny/Repo.pm | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/usr/src/libpiny/lib/Piny/Repo.pm b/usr/src/libpiny/lib/Piny/Repo.pm index 6df1e03..8f21ee2 100644 --- a/usr/src/libpiny/lib/Piny/Repo.pm +++ b/usr/src/libpiny/lib/Piny/Repo.pm @@ -242,7 +242,9 @@ sub rebuild { rename( $temp->filename, "/etc/ikiwiki/wikilist" ) or die "Could not rename over old wikilist: $!"; + $ENV{"GIT_DIR"} = $repo->path; system( "/usr/bin/git", "config", "gitweb.owner", $s->owner->email->address ) and die "Could not git config gitweb.owner!"; + delete $ENV{"GIT_DIR"}; system( "/usr/bin/sudo", "-u", $ikiuser->name, "/usr/bin/ikiwiki", "--setup", "/etc/ikiwiki/piny/" . $s->name . ".setup" ) and die "Could not do initial compile of ikiwiki!"; @@ -266,25 +268,6 @@ sub destroy { system( "/etc/init.d/apache2", "reload" ) and die "Could not reload apache config!"; - unlink( "/etc/cgitrc.d/" . $s->name ); - - my $temp = File::Temp->new( ) or die "Could not create temporary file: $!"; - $temp->unlink_on_destroy( 0 ); - - my $dh = IO::Dir->new( "/etc/cgitrc.d" ) or die "Could not open cgitrc.d directory: $!"; - while ( defined ( my $entry = $dh->read ) ) { - next if ( $entry =~ /^\./ ); - open( FILE, "<", "/etc/cgitrc.d/" . $entry ) or die "Could not open cgitrc.d entry $entry: $!"; - print $temp <FILE>; - close( FILE ) or die "Could not close cgitrc.d entry $entry: $!"; - }; - - $temp->close or die "Could not close new cgitrc: $!"; - - chmod( 00644, $temp->filename ) or die "Could not fix mode of new cgitrc: $!"; - - rename( $temp->filename, "/etc/cgitrepos" ) or die "Could not rename over old cgitrc: $!"; - unlink( "/etc/ikiwiki/wikilist.d/" . $s->name ); $temp = File::Temp->new( ) or die "Could not create temporary file: $!"; @@ -401,6 +384,7 @@ sub create { $ENV{"GIT_DIR"} = $repo->path; system( "/usr/bin/git", "init", "--template=/srv/git-template.git", "--quiet", "--shared" ) and die "Could not initialize git repo!"; + system( "/usr/bin/git", "config", "gitweb.owner", $repo->owner->email->address ) and die "Could not git config gitweb.owner!"; delete $ENV{"GIT_DIR"}; $repo->description( $description ); @@ -454,8 +438,6 @@ sub create { rename( $temp->filename, "/etc/ikiwiki/wikilist" ) or die "Could not rename over old wikilist: $!"; - system( "/usr/bin/git", "config", "gitweb.owner", $repo->owner->email->address ) and die "Could not git config gitweb.owner!"; - system( "/usr/bin/sudo", "-u", $ikiuser->name, "/usr/bin/ikiwiki", "--setup", "/etc/ikiwiki/piny/" . $repo->name . ".setup" ) and die "Could not do initial compile of ikiwiki!"; open( APACHE, ">", "/etc/apache2/piny-available/" . $repo->name ) or die "Could not open new apache config: $!"; |