From 6d2f9a96f41cf1a3a80add728320c39f4932a319 Mon Sep 17 00:00:00 2001 From: "jrayhawk+piny.be@omgwallhack.org" Date: Fri, 12 Apr 2013 19:38:00 -0700 Subject: libpiny: further corrections to piny.gitpath --- libpiny/lib/Piny/Repo.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'libpiny/lib/Piny/Repo.pm') diff --git a/libpiny/lib/Piny/Repo.pm b/libpiny/lib/Piny/Repo.pm index 031558e..41987c5 100644 --- a/libpiny/lib/Piny/Repo.pm +++ b/libpiny/lib/Piny/Repo.pm @@ -464,7 +464,9 @@ sub _change_owner { sub all_repos { my ( $class, $dir ) = @_; - $dir = $s->config->piny_gitpath unless defined $dir; + my $config = Piny::Config->new( ); + + $dir = $config->piny_gitpath unless defined $dir; my @ret; @@ -492,7 +494,7 @@ sub create { mkdir( $repo->path ) or die "The repo $name appears to already exist! ($!)"; - chdir( $s->config->piny_gitpath ); # so git-clone can do the work of resolving local repo names for us + chdir( $repo->config->piny_gitpath ); # so git-clone can do the work of resolving local repo names for us if ( defined $remote ) { system( "/bin/chown", $user->name, $repo->path ) and die "Could not change ownership of repo path!"; # permissions are overridden later if ( system( "/usr/bin/sudo", "-H", "-u", $user->name, "/usr/bin/git", "clone", "--bare", "--no-hardlinks", "--quiet", $remote, $repo->path ) ) { # sudo -u $user needed in order to test user readability of whatever they want to clone. the mode o+rx should probably be masked off if we want private repos to stay private. @@ -577,7 +579,9 @@ sub _build_group { sub _build_path { my ( $s ) = @_; - return $s->config->piny_gitpath . $s->name . ".git"; + my $config = Piny::Config->new( ); # New, otherwise we'd wind up recursing. It's considered global anyway. + + return $config->piny_gitpath . "/" . $s->name . ".git"; }; sub _build_description { -- cgit v1.2.3 From cd440bfd3d6e20146e77e1d6c0e9f579687ca2ab Mon Sep 17 00:00:00 2001 From: "jrayhawk+piny.be@omgwallhack.org" Date: Fri, 12 Apr 2013 19:46:04 -0700 Subject: libpiny: add piny.reloadapache configuration variable --- libpiny/lib/Piny/Config.pm | 1 + libpiny/lib/Piny/Repo.pm | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'libpiny/lib/Piny/Repo.pm') diff --git a/libpiny/lib/Piny/Config.pm b/libpiny/lib/Piny/Config.pm index ec86955..eb78a0f 100644 --- a/libpiny/lib/Piny/Config.pm +++ b/libpiny/lib/Piny/Config.pm @@ -265,6 +265,7 @@ tweakable "piny_ikiwikisrcdir" => "/srv/ikiwiki/", 'PathDir'; tweakable "piny_ikiwikiurl" => "http://piny.be/", 'HttpUrl'; tweakable "piny_ikiwikisecureurl" => "https://secure.piny.be/", 'HttpsUrl'; tweakable "piny_ikiwikisecurepath" => "/srv/www/secure.piny.be/", 'PathDir'; +tweakable "piny_reloadapache" => "true", 'GitBool'; tweakable "core_sharedrepository" => '0664', 'RepoPermission'; tweakable "receive_denynonfastforwards" => "true", 'GitBool'; tweakable "receive_denydeletes" => "true", 'GitBool'; diff --git a/libpiny/lib/Piny/Repo.pm b/libpiny/lib/Piny/Repo.pm index 41987c5..a735a16 100644 --- a/libpiny/lib/Piny/Repo.pm +++ b/libpiny/lib/Piny/Repo.pm @@ -330,7 +330,9 @@ sub rebuild_apache { $wwwtemp->close or die "Could not close new wikilist: $!"; rename( $wwwtemp->filename, "/etc/apache2/piny/www/" . $s->name ) or die "Could not rename apache config: $!"; - system( "/etc/init.d/apache2", "reload" ) and die "Could not reload apache config!"; + if ( $s->config->piny_reloadapache =~ /^(1|true)$/ ) { + system( "/etc/init.d/apache2", "reload" ) and die "Could not reload apache config!"; + }; }; sub rebuild_ikiwiki { -- cgit v1.2.3 From ab1be769ff42199b2deefd9f8318c759a7aa40ec Mon Sep 17 00:00:00 2001 From: "jrayhawk+piny.be@omgwallhack.org" Date: Fri, 12 Apr 2013 19:48:28 -0700 Subject: libpiny: renaming reloadapache to apachereload --- libpiny/lib/Piny/Config.pm | 2 +- libpiny/lib/Piny/Repo.pm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'libpiny/lib/Piny/Repo.pm') diff --git a/libpiny/lib/Piny/Config.pm b/libpiny/lib/Piny/Config.pm index eb78a0f..0f02921 100644 --- a/libpiny/lib/Piny/Config.pm +++ b/libpiny/lib/Piny/Config.pm @@ -259,13 +259,13 @@ tweakable "piny_template" => undef, 'Maybe[PathDir]', 'inhibit'; tweakable "piny_gitpath" => '/srv/git', 'PathDir'; # Repo-specific tweakables, in the repos' .git/config files. +tweakable "piny_apachereload" => "true", 'GitBool'; tweakable "piny_ikiwiki" => "true", 'GitBool'; tweakable "piny_ikiwikidestdir" => "/srv/www/piny.be/", 'PathDir'; tweakable "piny_ikiwikisrcdir" => "/srv/ikiwiki/", 'PathDir'; tweakable "piny_ikiwikiurl" => "http://piny.be/", 'HttpUrl'; tweakable "piny_ikiwikisecureurl" => "https://secure.piny.be/", 'HttpsUrl'; tweakable "piny_ikiwikisecurepath" => "/srv/www/secure.piny.be/", 'PathDir'; -tweakable "piny_reloadapache" => "true", 'GitBool'; tweakable "core_sharedrepository" => '0664', 'RepoPermission'; tweakable "receive_denynonfastforwards" => "true", 'GitBool'; tweakable "receive_denydeletes" => "true", 'GitBool'; diff --git a/libpiny/lib/Piny/Repo.pm b/libpiny/lib/Piny/Repo.pm index a735a16..3376ea7 100644 --- a/libpiny/lib/Piny/Repo.pm +++ b/libpiny/lib/Piny/Repo.pm @@ -330,7 +330,7 @@ sub rebuild_apache { $wwwtemp->close or die "Could not close new wikilist: $!"; rename( $wwwtemp->filename, "/etc/apache2/piny/www/" . $s->name ) or die "Could not rename apache config: $!"; - if ( $s->config->piny_reloadapache =~ /^(1|true)$/ ) { + if ( $s->config->piny_apachereload =~ /^(1|true)$/ ) { system( "/etc/init.d/apache2", "reload" ) and die "Could not reload apache config!"; }; }; -- cgit v1.2.3 From 74f36e7294764b136514b2ed67b9345fdc6e1e44 Mon Sep 17 00:00:00 2001 From: "jrayhawk+piny.be@omgwallhack.org" Date: Fri, 12 Apr 2013 20:18:42 -0700 Subject: libpiny: whoops, missed apachereload check on destroy_apache --- libpiny/lib/Piny/Repo.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libpiny/lib/Piny/Repo.pm') diff --git a/libpiny/lib/Piny/Repo.pm b/libpiny/lib/Piny/Repo.pm index 3376ea7..ffdd9fb 100644 --- a/libpiny/lib/Piny/Repo.pm +++ b/libpiny/lib/Piny/Repo.pm @@ -417,7 +417,9 @@ sub destroy_apache { }; }; - system( "/etc/init.d/apache2", "reload" ) and die "Could not reload apache config!"; + if ( $s->config->piny_apachereload =~ /^(1|true)$/ ) { + system( "/etc/init.d/apache2", "reload" ) and die "Could not reload apache config!"; + }; }; sub destroy_ikiwiki { -- cgit v1.2.3