summaryrefslogtreecommitdiff
path: root/libpiny/lib/Piny/Repo.pm
diff options
context:
space:
mode:
authorJoe Rayhawk <jrayhawk@omgwallhack.org>2011-04-24 12:57:38 -0700
committerJoe Rayhawk <jrayhawk@omgwallhack.org>2011-04-24 12:57:38 -0700
commit4ac0fd01b73a0b718db3a756866fee121a1615f1 (patch)
treef8b1c3054b923526fbe46608ccf9d7f39538bcaa /libpiny/lib/Piny/Repo.pm
parentba8fd5e9907dd8e132e9c6fca006824907239636 (diff)
downloadpiny-code-4ac0fd01b73a0b718db3a756866fee121a1615f1.tar.gz
piny-code-4ac0fd01b73a0b718db3a756866fee121a1615f1.zip
Switching ikiwiki- username/group over to iki-; untested and requires a mass rebuildrepo
Diffstat (limited to 'libpiny/lib/Piny/Repo.pm')
-rw-r--r--libpiny/lib/Piny/Repo.pm18
1 files changed, 13 insertions, 5 deletions
diff --git a/libpiny/lib/Piny/Repo.pm b/libpiny/lib/Piny/Repo.pm
index 17142ed..306b3a8 100644
--- a/libpiny/lib/Piny/Repo.pm
+++ b/libpiny/lib/Piny/Repo.pm
@@ -203,14 +203,22 @@ sub has_access {
sub rebuild {
my ( $s ) = @_;
- my $ikiuser = Piny::User::IkiWiki->new( "name" => "ikiwiki-" . $s->name );
+ unless( getgrnam("git-" . $s->name ); ) {
+ system( "/usr/sbin/addgroup", "--quiet", "git-$s->name" ) and die "Could not create repo group!";
+ };
+
+ unless( getpwname("iki-" . $s->name ); ) {
+ system( "/usr/sbin/adduser", "--quiet", "--system", "--group", "--gecos", $s->name, "iki-$s->name" ) and die "Could not create ikiwiki user!";
+ };
+
+ my $ikiuser = Piny::User::IkiWiki->new( "name" => "iki-" . $s->name );
foreach( "git-daemon-export-ok", "packed-refs" ) {
open( TOUCH, ">", $s->path . "/" . $_ ) or die "Could not touch $_ for repo: $!";
close( TOUCH );
};
- foreach( "info", "logs" ) {
+ foreach( "info", "logs", "branches" ) {
(-e $s->path . "/" . $_) or mkdir( $s->path . "/" . $_ ) or die "Could not mkdir $_ for repo: $!";
};
@@ -296,7 +304,7 @@ sub destroy {
system( "rm", "-rf", $s->secure_path, $s->ikiwiki_destdir, $s->ikiwiki_srcdir, "/etc/ikiwiki/piny/" . $s->name . ".setup", $s->path );
- my $ikiuser = Piny::User::IkiWiki->new( "name" => "ikiwiki-" . $s->name );
+ my $ikiuser = Piny::User::IkiWiki->new( "name" => "iki-" . $s->name );
system( "deluser", "--remove-home", $ikiuser->name );
system( "delgroup", $ikiuser->name );
@@ -374,9 +382,9 @@ sub create {
mkdir( $repo->path ) or die "The repo $name appears to already exist! ($!)";
- system( "/usr/sbin/adduser", "--quiet", "--system", "--group", "--gecos", $name, "ikiwiki-$name" ) and die "Could not create ikiwiki user!";
+ system( "/usr/sbin/adduser", "--quiet", "--system", "--group", "--gecos", $name, "iki-$name" ) and die "Could not create ikiwiki user!";
- my $ikiuser = Piny::User::IkiWiki->new( "name" => "ikiwiki-$name" );
+ my $ikiuser = Piny::User::IkiWiki->new( "name" => "iki-$name" );
system( "/usr/sbin/addgroup", "--quiet", "git-$name" ) and die "Could not create repo group!";