diff options
Diffstat (limited to 'usr/src/pinyadmin/sbin')
-rwxr-xr-x | usr/src/pinyadmin/sbin/addaccess | 19 | ||||
-rwxr-xr-x | usr/src/pinyadmin/sbin/newrepo | 40 | ||||
-rwxr-xr-x | usr/src/pinyadmin/sbin/newuser | 129 | ||||
-rwxr-xr-x | usr/src/pinyadmin/sbin/pinyconfig | 38 | ||||
-rwxr-xr-x | usr/src/pinyadmin/sbin/rebuildrepo | 14 | ||||
-rwxr-xr-x | usr/src/pinyadmin/sbin/rmaccess | 19 | ||||
-rwxr-xr-x | usr/src/pinyadmin/sbin/rmrepo | 21 |
7 files changed, 0 insertions, 280 deletions
diff --git a/usr/src/pinyadmin/sbin/addaccess b/usr/src/pinyadmin/sbin/addaccess deleted file mode 100755 index e351114..0000000 --- a/usr/src/pinyadmin/sbin/addaccess +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use Piny; - -my $env = Piny::Environment->instance( ); - -my ( $reponame, @users ) = @ARGV; - -my $repo = Piny::Repo->new( $reponame ); - -if ( $repo->owner->uid != $env->user->uid ) { - print "You are not the owner of that repo!\n"; - exit( 3 ); -}; - -$repo->add_access( map { Piny::User->new( $_ ) } @users ); diff --git a/usr/src/pinyadmin/sbin/newrepo b/usr/src/pinyadmin/sbin/newrepo deleted file mode 100755 index a178ecb..0000000 --- a/usr/src/pinyadmin/sbin/newrepo +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use Moose::Util::TypeConstraints qw( find_type_constraint ); - -use Piny; - -my ( $name ) = @ARGV; - -if ( not defined $name ) { - print "Usage: newrepo REPONAME\n"; - exit 1; -}; - -if ( not find_type_constraint( "Reponame" )->check( $name ) ) { - print "That is not a valid repo name; must be at least 1 character long, begin with a lowercase alphanumeric character, and contain only alphanumeric characters and dashes.\n"; - exit 1; -}; - -my $description; -while( 1 ) { - - print "Provide a one-line description to be used in repo listings, the shorter the better:\n"; - chomp( $description = <STDIN> ); - - if ( not find_type_constraint( "SimpleText" )->check( $description ) ) { - print "Must be 1-80 characters long; control characters (including tab) not allowed.\n"; - next; - }; - - print "Okay! Working, please wait...\n"; - last; - -}; - -my $repo = Piny::Repo->create( $name, $description ); - -print "Repo URL: " . $repo->ikiwiki_url . "\n"; diff --git a/usr/src/pinyadmin/sbin/newuser b/usr/src/pinyadmin/sbin/newuser deleted file mode 100755 index e064f06..0000000 --- a/usr/src/pinyadmin/sbin/newuser +++ /dev/null @@ -1,129 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use Email::Valid::Loose qw( ); - -# If they passed any arguments, complain and exit. -if ( scalar @ARGV ) { - print "You can't pass any arguments to this script!\n"; - exit 2; -}; - -# If they didn't provide a terminal definition, then assume xterm. -# Everybody emulates xterm to at least a basic extent. -if ( not exists $ENV{"TERM"} ) { - $ENV{"TERM"} = "xterm"; - print "I don't know what terminal you're using; guessing xterm...\n"; -}; - -# Disable buffering. -$|++; - -# Configure the strictness of our email checks. -my $checker = Email::Valid::Loose->new - ( "-fqdn" => 1 - , "-fudge" => 0 - , "-local_rules" => 0 - , "-mxcheck" => 1 - , "-tldcheck" => 0 - ); - -my ( $email, $username, $password1, $password2 ); - -while ( 1 ) { - - print "Email address to associate with new user: "; - chomp ( $email = <STDIN> ); - - if ( $email eq "" ) { - print "You must provide an email address!\n"; - next; - }; - - $email = $checker->address( $email ); - if ( not defined $email ) { - print "Please, at least pretend to provide a valid email address.\n"; - next; - }; - - last; - -}; - -while ( 1 ) { - - print "Desired username: "; - chomp ( $username = <STDIN> ); - - if ( $username eq "" ) { - print "You have to enter a username!\n"; - next; - }; - - if ( $username =~ /^git-|^ikiwiki-/ ) { - print "Your username cannot start with git- or ikiwiki-!\n"; - next - }; - - if ( $username !~ /^[a-zA-Z0-9_.][a-zA-Z0-9_.-]+$/ ) { - print( "Usernames must consist only of letters, digits, underscores, periods, and dashes, and not start with a dash. Usernames are case sensitive.\n" ); - next - }; - - last; - -}; - -while ( 1 ) { - - system( "stty", "-echo" ); - print "Desired password: "; - chomp ( $password1 = <STDIN> ); - print "\nRetype password: "; - chomp ( $password2 = <STDIN> ); - print "\n"; - system( "stty", "echo" ); - - if ( $password1 ne $password2 ) { - print "Provided passwords do not match; try again.\n"; - next; - }; - - if ( $password1 eq "" ) { - print "You have to enter a password!\n"; - next; - }; - - last; - -}; - -my @saltchars = - ( 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' - , 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' - , '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' - , '.', '/' - ); - -my $salt = "\$6\$"; - -foreach my $n ( 1 .. 16 ) { - $salt .= $saltchars[int ( rand ( scalar @saltchars ) )]; -}; - -$salt .= "\$"; - -my $crypt = crypt( $password1, $salt ); - -my $ret = system( "/usr/sbin/useradd", "-c", "$email", "-k", "/var/empty", "-g", "users", "-m", "-p", $crypt, "-s", "/usr/bin/pinyshell", $username ); - -if ( $ret ) { - print "An error occured creating the user; most likely, that username is already taken.\n"; - exit 1; -}; - -print "Your user has been created. Try logging in!\n"; - -exit 0; diff --git a/usr/src/pinyadmin/sbin/pinyconfig b/usr/src/pinyadmin/sbin/pinyconfig deleted file mode 100755 index f6752db..0000000 --- a/usr/src/pinyadmin/sbin/pinyconfig +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use Piny; - -my ( $reponame, $attr, $value ) = @ARGV; - -if ( not defined $reponame or not defined $attr ) { - die "Usage: $0 reponame tweakable [value]\n"; -}; - -$attr = lc $attr; -$attr =~ s/\./_/g; - -my $repo = Piny::Repo->new( $reponame ); - -if ( defined $value ) { - undef $@; - eval { - $repo->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 ) { - print STDERR "Failed to set $attr (perhaps an override is in place)\n"; - }; -}; - -undef $@; -eval { - print "$attr = " . $repo->config->$attr . "\n"; -}; -if ( $@ ) { - print STDERR "$attr is not a legal tweakable, or its current value is illegal.\n$@\n"; -}; diff --git a/usr/src/pinyadmin/sbin/rebuildrepo b/usr/src/pinyadmin/sbin/rebuildrepo deleted file mode 100755 index 9d4e359..0000000 --- a/usr/src/pinyadmin/sbin/rebuildrepo +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use Piny; - -foreach my $reponame ( @ARGV ) { - - my $repo = Piny::Repo->new( $reponame ); - - $repo->rebuild; - -}; diff --git a/usr/src/pinyadmin/sbin/rmaccess b/usr/src/pinyadmin/sbin/rmaccess deleted file mode 100755 index d6c22a9..0000000 --- a/usr/src/pinyadmin/sbin/rmaccess +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use Piny; - -my $env = Piny::Environment->instance( ); - -my ( $reponame, @users ) = @ARGV; - -my $repo = Piny::Repo->new( $reponame ); - -if ( $repo->owner->uid != $env->user->uid ) { - print "You are not the owner of that repo!\n"; - exit( 3 ); -}; - -$repo->remove_access( map { Piny::User->new( $_ ) } @users ); diff --git a/usr/src/pinyadmin/sbin/rmrepo b/usr/src/pinyadmin/sbin/rmrepo deleted file mode 100755 index dff8fe5..0000000 --- a/usr/src/pinyadmin/sbin/rmrepo +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use Piny; - -my $env = Piny::Environment->instance( ); - -foreach my $reponame ( @ARGV ) { - - my $repo = Piny::Repo->new( $reponame ); - - if ( $env->user->uid != 0 and $repo->owner->uid != $env->user->uid ) { - print STDERR "You are not the owner of $reponame!\n"; - exit 1; - }; - - $repo->destroy; - -}; |