diff options
author | Joe Rayhawk <jrayhawk@omgwallhack.org> | 2013-04-12 19:05:35 -0700 |
---|---|---|
committer | Joe Rayhawk <jrayhawk@omgwallhack.org> | 2013-04-12 19:05:35 -0700 |
commit | a26421a98e3336d447a5656bf9ae262b1de4d42f (patch) | |
tree | 777dcf691ae1b13f32eb52d71dc4618d67be54ab | |
parent | 924dc064a5d8c1222ef9ea20ad8e8401f24d7569 (diff) | |
download | piny-code-a26421a98e3336d447a5656bf9ae262b1de4d42f.tar.gz piny-code-a26421a98e3336d447a5656bf9ae262b1de4d42f.zip |
libpiny: making git path configurable (default: /srv/git)
-rw-r--r-- | docs/install_notes.txt | 1 | ||||
-rw-r--r-- | libpiny/lib/Piny/Config.pm | 1 | ||||
-rw-r--r-- | libpiny/lib/Piny/Repo.pm | 8 |
3 files changed, 6 insertions, 4 deletions
diff --git a/docs/install_notes.txt b/docs/install_notes.txt index ccac508..f3fbf91 100644 --- a/docs/install_notes.txt +++ b/docs/install_notes.txt @@ -32,6 +32,7 @@ a2enmod auth_sys_group url="some.url" +gitpath="/srv/ikiwiki" ikiwikiurl="http://$url/" ikiwikidestdir="/srv/http/$url/" ikiwikisrcdir="/srv/ikiwiki" diff --git a/libpiny/lib/Piny/Config.pm b/libpiny/lib/Piny/Config.pm index bb72536..ec86955 100644 --- a/libpiny/lib/Piny/Config.pm +++ b/libpiny/lib/Piny/Config.pm @@ -256,6 +256,7 @@ sub tweakable { # Global tweakables, which only make sense in the global config file. tweakable "piny_adminemail" => "jrayhawk\@omgwallhack.org", 'Str', 'inhibit'; tweakable "piny_template" => undef, 'Maybe[PathDir]', 'inhibit'; +tweakable "piny_gitpath" => '/srv/git', 'PathDir'; # Repo-specific tweakables, in the repos' .git/config files. tweakable "piny_ikiwiki" => "true", 'GitBool'; diff --git a/libpiny/lib/Piny/Repo.pm b/libpiny/lib/Piny/Repo.pm index fe457cf..031558e 100644 --- a/libpiny/lib/Piny/Repo.pm +++ b/libpiny/lib/Piny/Repo.pm @@ -336,7 +336,7 @@ sub rebuild_apache { sub rebuild_ikiwiki { my ( $s ) = @_; - chdir( "/srv/git" ); # because git likes to chdir back to its original cwd for some dumb reason, which isn't guaranteed to work. + chdir( $s->config->piny_gitpath ); # because git likes to chdir back to its original cwd for some dumb reason, which isn't guaranteed to work. unless( getpwnam("iki-" . $s->shortname ) ) { system( "/usr/sbin/adduser", "--quiet", "--system", "--group", "--gecos", $s->shortname, "iki-" . $s->shortname ) and die "Could not create ikiwiki user!"; @@ -464,7 +464,7 @@ sub _change_owner { sub all_repos { my ( $class, $dir ) = @_; - $dir = "/srv/git" unless defined $dir; + $dir = $s->config->piny_gitpath unless defined $dir; my @ret; @@ -492,7 +492,7 @@ sub create { mkdir( $repo->path ) or die "The repo $name appears to already exist! ($!)"; - chdir( "/srv/git" ); # so git-clone can do the work of resolving local repo names for us + chdir( $s->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 +577,7 @@ sub _build_group { sub _build_path { my ( $s ) = @_; - return "/srv/git/" . $s->name . ".git"; + return $s->config->piny_gitpath . $s->name . ".git"; }; sub _build_description { |