From ff8b5180562a90f5f44447c627f86ab60467f55e Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Wed, 20 Apr 2011 21:41:14 -0700 Subject: Create .gitconfig for new users. --- pinyadmin/sbin/newuser | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'pinyadmin/sbin') diff --git a/pinyadmin/sbin/newuser b/pinyadmin/sbin/newuser index e38e791..ef61cd7 100755 --- a/pinyadmin/sbin/newuser +++ b/pinyadmin/sbin/newuser @@ -5,6 +5,8 @@ use warnings; use Email::Valid::Loose qw( ); +use Piny::User; + my ( $email, $username, $password ); # Configure the strictness of our email checks. @@ -147,6 +149,17 @@ if ( $ret ) { exit 1; }; +my $u = Piny::User->new( $username ); + +open( GITCONFIG, ">", $u->home . "/.gitconfig" ) or die "Could not open .gitconfig for new user: $!\n"; +print GITCONFIG <uid, $u->group->gid, $u->home . "/.gitconfig" ); + print "Your user has been created. Try logging in!\n"; exit 0; -- cgit v1.2.3 From d2977669bb388de0a991af6548427e896550e646 Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Wed, 20 Apr 2011 21:49:06 -0700 Subject: Allow changes to .gitconfig using pinyconfig interface. --- pinyadmin/sbin/pinyconfig | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'pinyadmin/sbin') diff --git a/pinyadmin/sbin/pinyconfig b/pinyadmin/sbin/pinyconfig index f6752db..4b6f84b 100755 --- a/pinyadmin/sbin/pinyconfig +++ b/pinyadmin/sbin/pinyconfig @@ -8,30 +8,36 @@ use Piny; my ( $reponame, $attr, $value ) = @ARGV; if ( not defined $reponame or not defined $attr ) { - die "Usage: $0 reponame tweakable [value]\n"; + die "Usage: $0 reponame|--user tweakable [value]\n"; }; $attr = lc $attr; $attr =~ s/\./_/g; -my $repo = Piny::Repo->new( $reponame ); +my $config; + +if ( $repo eq "--user" ) { + $config = Piny::Environment->instance->user->config; +} else { + $config = Piny::Repo->new( $reponame )->config; +}; if ( defined $value ) { undef $@; eval { - $repo->config->$attr( $value ); + $config->$attr( $value ); }; if ( $@ ) { print STDERR "$attr is not a legal tweakable, or $value is not a legal value for that tweakable.\n$@\n"; }; - if ( $value ne $repo->config->$attr ) { + if ( $value ne $config->$attr ) { print STDERR "Failed to set $attr (perhaps an override is in place)\n"; }; }; undef $@; eval { - print "$attr = " . $repo->config->$attr . "\n"; + print "$attr = " . $config->$attr . "\n"; }; if ( $@ ) { print STDERR "$attr is not a legal tweakable, or its current value is illegal.\n$@\n"; -- cgit v1.2.3 From d7a522d4e85c88b9f8068b9d0a0ede271b382295 Mon Sep 17 00:00:00 2001 From: "jrayhawk+piny.be@omgwallhack.org" Date: Wed, 20 Apr 2011 22:30:18 -0700 Subject: Use the right variable name so pinyconfig actually compiles --- pinyadmin/sbin/pinyconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pinyadmin/sbin') diff --git a/pinyadmin/sbin/pinyconfig b/pinyadmin/sbin/pinyconfig index 4b6f84b..e78cf3c 100755 --- a/pinyadmin/sbin/pinyconfig +++ b/pinyadmin/sbin/pinyconfig @@ -16,7 +16,7 @@ $attr =~ s/\./_/g; my $config; -if ( $repo eq "--user" ) { +if ( $reponame eq "--user" ) { $config = Piny::Environment->instance->user->config; } else { $config = Piny::Repo->new( $reponame )->config; -- cgit v1.2.3 From 7663a27030cbcd138fd2c9e7b324e314fb1f7d4c Mon Sep 17 00:00:00 2001 From: "jrayhawk+piny.be@omgwallhack.org" Date: Wed, 20 Apr 2011 23:57:59 -0700 Subject: Hard-coding gid for newuser --- pinyadmin/sbin/newuser | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pinyadmin/sbin') diff --git a/pinyadmin/sbin/newuser b/pinyadmin/sbin/newuser index ef61cd7..22c73ef 100755 --- a/pinyadmin/sbin/newuser +++ b/pinyadmin/sbin/newuser @@ -158,7 +158,7 @@ print GITCONFIG <uid, $u->group->gid, $u->home . "/.gitconfig" ); +chown( $u->uid, (getgrnam("users"))[2] , $u->home . "/.gitconfig" ); print "Your user has been created. Try logging in!\n"; -- cgit v1.2.3