summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorJoe Rayhawk <jrayhawk@omgwallhack.org>2010-10-15 19:54:35 -0700
committerJoe Rayhawk <jrayhawk@omgwallhack.org>2010-10-15 19:54:35 -0700
commit2d1f8319667741c57697613d27a99dbbf0e49663 (patch)
treed6d1ec481741b70d5da9e5e3757a22650a536317 /usr
parentfd6029e4531e4f8d3f5b54efc57167f7e9b89460 (diff)
downloadpiny-code-2d1f8319667741c57697613d27a99dbbf0e49663.tar.gz
piny-code-2d1f8319667741c57697613d27a99dbbf0e49663.zip
Change owner/group data from $s->path to $s->path . "/objects" in repostat, create, and rebuild functions.
Diffstat (limited to 'usr')
-rw-r--r--usr/src/libpiny/lib/Piny/Repo.pm41
1 files changed, 32 insertions, 9 deletions
diff --git a/usr/src/libpiny/lib/Piny/Repo.pm b/usr/src/libpiny/lib/Piny/Repo.pm
index 84eb0c9..facc812 100644
--- a/usr/src/libpiny/lib/Piny/Repo.pm
+++ b/usr/src/libpiny/lib/Piny/Repo.pm
@@ -198,10 +198,21 @@ sub rebuild {
my $ikiuser = Piny::User::IkiWiki->new( "name" => "ikiwiki-" . $s->name );
- open( TOUCH, ">", $s->path . "/git-daemon-export-ok" ) or die "Could not touch git-daemon-export-ok for repo: $!";
- close( TOUCH );
+ foreach( "git-daemon-export-ok", "packed-refs" ) {
+ open( TOUCH, ">", $s->path . "/" . $_ ) or die "Could not touch $_ for repo: $!";
+ close( TOUCH );
+ };
+
+ foreach( "info", "logs" ) {
+ mkdir( $s->path . "/" . $_ ) and die "Could not mkdir $_ for repo: $!";
+ };
+
+ chown( 0, 0, $s->path, $s->path . '/config' ) and die "Could not change ownership of git dir!";
+
+ foreach( "branches", "description", "HEAD", "info", "logs", "objects", "packed-refs", "refs" ) {
+ system( "/bin/chown", "-R", $s->owner->name . "." . $s->group->name, $s->path . "/" . $_ ) and die "Could not change ownership of $_ for repo: $!";
+ };
- system( "/bin/chown", "-R", $s->owner->name . "." . $s->group->name, $s->path ) and die "Could not change ownership of git repo!";
system( "/bin/chown", "-R", $ikiuser->name . "." . $ikiuser->name, $s->path . "/hooks" ) and die "Could not change ownership of git hooks!";
open( SETUP, ">", "/etc/ikiwiki/piny/" . $s->name . ".setup" ) or die "Could not open new ikiwiki setup file: $!";
@@ -363,7 +374,7 @@ sub _change_owner {
return unless defined $old_owner;
- find( { wanted => sub { chown( $new_owner->uid, -1, $_ ) or die "Couldn't chown $_: $!"; }, no_chdir => 1 }, $s->path );
+ find( { wanted => sub { chown( $new_owner->uid, -1, $_ ) or die "Couldn't chown $_: $!"; }, no_chdir => 1 }, $s->path . "/objects" );
$s->clear_ikiwiki_setup;
};
@@ -413,10 +424,22 @@ sub create {
$repo->description( $description );
- open( TOUCH, ">", $repo->path . "/git-daemon-export-ok" ) or die "Could not touch git-daemon-export-ok for repo: $!";
- close( TOUCH );
+ foreach( "git-daemon-export-ok", "packed-refs" ) {
+ open( TOUCH, ">", $repo->path . "/" . $_ ) or die "Could not touch $_ for repo: $!";
+ close( TOUCH );
+ };
+
+ foreach( "info", "logs" ) {
+ mkdir( $repo->path . "/" . $_ ) and die "Could not mkdir $_ for repo: $!";
+ };
+
+
+ foreach( "branches", "description", "HEAD", "info", "logs", "objects", "packed-refs", "refs" ) {
+ system( "/bin/chown", "-R", $user->name . "." . $group->name, $repo->path . "/" . $_ ) and die "Could not change ownership of $_ for repo: $!";
+ };
+
+ chown( 0, 0, $repo->path, $repo->path . '/config' ) and die "Could not change ownership of git dir!";
- system( "/bin/chown", "-R", $user->name . "." . $group->name, $repo->path ) and die "Could not change ownership of git repo!";
system( "/bin/chown", "-R", $ikiuser->name . "." . $ikiuser->name, $repo->path . "/hooks" ) and die "Could not change ownership of git hooks!";
open( SETUP, ">", "/etc/ikiwiki/piny/" . $repo->name . ".setup" ) or die "Could not open new ikiwiki setup file: $!";
@@ -527,8 +550,8 @@ sub _build_description {
sub _build_repostat {
my ( $s ) = @_;
- my @res = stat( $s->path );
- die "stat( " . $s->path . " ) failed: $!" unless @res;
+ my @res = stat( $s->path . "/objects" );
+ die "stat( " . $s->path . "/objects ) failed: $!" unless @res;
return \@res;
};