summaryrefslogtreecommitdiff
path: root/pinyadmin/sbin/newuser
diff options
context:
space:
mode:
authorJulian Blake Kongslie <jblake@omgwallhack.org>2011-04-20 21:41:14 -0700
committerJulian Blake Kongslie <jblake@omgwallhack.org>2011-04-20 21:41:14 -0700
commitff8b5180562a90f5f44447c627f86ab60467f55e (patch)
tree1e65ae37a42d8f0c846834fd95d9d01f663a42f5 /pinyadmin/sbin/newuser
parentf14aee049e7363e40dd817691aa8fb64c2f450e1 (diff)
downloadpiny-code-ff8b5180562a90f5f44447c627f86ab60467f55e.tar.gz
piny-code-ff8b5180562a90f5f44447c627f86ab60467f55e.zip
Create .gitconfig for new users.
Diffstat (limited to 'pinyadmin/sbin/newuser')
-rwxr-xr-xpinyadmin/sbin/newuser13
1 files changed, 13 insertions, 0 deletions
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 <<END;
+[user]
+ email = $email
+END
+close( GITCONFIG );
+
+chown( $u->uid, $u->group->gid, $u->home . "/.gitconfig" );
+
print "Your user has been created. Try logging in!\n";
exit 0;