diff options
Diffstat (limited to 'pinyadmin')
-rw-r--r-- | pinyadmin/Makefile | 1 | ||||
l--------- | pinyadmin/bin/createuser | 1 | ||||
-rw-r--r-- | pinyadmin/doc/newuser.latex | 6 | ||||
-rwxr-xr-x | pinyadmin/sbin/newuser | 13 | ||||
-rwxr-xr-x | pinyadmin/sbin/pinyconfig | 16 |
5 files changed, 26 insertions, 11 deletions
diff --git a/pinyadmin/Makefile b/pinyadmin/Makefile index 64ac713..2f679e7 100644 --- a/pinyadmin/Makefile +++ b/pinyadmin/Makefile @@ -1,7 +1,6 @@ build: mkdir -p man for f in doc/*.latex; do latex2man $$f man/$$(basename $$f .latex).man; done - ln -s newuser.man man/createuser.man install: install -o root -g root -m 755 -d $(DESTDIR)/usr/bin $(DESTDIR)/usr/sbin diff --git a/pinyadmin/bin/createuser b/pinyadmin/bin/createuser deleted file mode 120000 index e9d7937..0000000 --- a/pinyadmin/bin/createuser +++ /dev/null @@ -1 +0,0 @@ -newuser
\ No newline at end of file diff --git a/pinyadmin/doc/newuser.latex b/pinyadmin/doc/newuser.latex index 721d468..c9e4492 100644 --- a/pinyadmin/doc/newuser.latex +++ b/pinyadmin/doc/newuser.latex @@ -1,6 +1,6 @@ \usepackage{latex2man} -\begin{Name}{8piny}{newuser}{Piny Team}{Piny}{createuser} +\begin{Name}{8piny}{newuser}{Piny Team}{Piny}{newuser} \Prog{newuser} - add a piny user @@ -8,9 +8,7 @@ \Prog{newuser} -\Prog{createuser} - \section{Description} The \Prog{newuser} program is an interactive script which walks the user through the process of creating a new Piny account. -Normally it is set as the shell of a passwordless user such as "newuser" or "createuser", so that users can create accounts without any assistance from a sysadmin. +Normally it is set as the shell of a passwordless user such as "newuser", so that users can create accounts without any assistance from a sysadmin. 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; diff --git a/pinyadmin/sbin/pinyconfig b/pinyadmin/sbin/pinyconfig index f6752db..e78cf3c 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 ( $reponame 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"; |