summaryrefslogtreecommitdiff
path: root/libpiny/lib
diff options
context:
space:
mode:
Diffstat (limited to 'libpiny/lib')
-rw-r--r--libpiny/lib/Piny/Config.pm1
-rw-r--r--libpiny/lib/Piny/Repo.pm8
2 files changed, 5 insertions, 4 deletions
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 {