diff options
author | Seemant Kulleen <seemant@gentoo.org> | 2004-01-15 18:50:52 +0000 |
---|---|---|
committer | Seemant Kulleen <seemant@gentoo.org> | 2004-01-15 18:50:52 +0000 |
commit | a76d21fc70d52244ab1fe5a785ab9a813a69a035 (patch) | |
tree | edd80cfba51c08fd35a4230040f8b84ddf261dd6 /app-admin/superadduser | |
parent | new package -- contributed by Paulo J. Matos <pocm@mega.ist.utl.pt> (diff) | |
download | historical-a76d21fc70d52244ab1fe5a785ab9a813a69a035.tar.gz historical-a76d21fc70d52244ab1fe5a785ab9a813a69a035.tar.bz2 historical-a76d21fc70d52244ab1fe5a785ab9a813a69a035.zip |
version bump and cruft removal
Diffstat (limited to 'app-admin/superadduser')
-rw-r--r-- | app-admin/superadduser/ChangeLog | 9 | ||||
-rw-r--r-- | app-admin/superadduser/Manifest | 10 | ||||
-rw-r--r-- | app-admin/superadduser/files/1.0.7/superadduser | 375 | ||||
-rw-r--r-- | app-admin/superadduser/files/1.0.7/superadduser.8 (renamed from app-admin/superadduser/files/1.0/superadduser.8) | 0 | ||||
-rw-r--r-- | app-admin/superadduser/files/1.0/superadduser | 110 | ||||
-rw-r--r-- | app-admin/superadduser/files/digest-superadduser-1.0.7 (renamed from app-admin/superadduser/files/digest-superadduser-1.0-r2) | 0 | ||||
-rw-r--r-- | app-admin/superadduser/superadduser-1.0.7.ebuild (renamed from app-admin/superadduser/superadduser-1.0-r2.ebuild) | 6 |
7 files changed, 391 insertions, 119 deletions
diff --git a/app-admin/superadduser/ChangeLog b/app-admin/superadduser/ChangeLog index b1cd7c0aeedb..1c3a6ce7a331 100644 --- a/app-admin/superadduser/ChangeLog +++ b/app-admin/superadduser/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for app-admin/superadduser # Copyright 2002-2004 Gentoo Technologies, Inc.; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/app-admin/superadduser/ChangeLog,v 1.16 2004/01/14 02:56:30 avenj Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-admin/superadduser/ChangeLog,v 1.17 2004/01/15 18:50:52 seemant Exp $ + +superadduser-1.0.7 (16 Jan 2004) + + 16 Jan 2004; Seemant Kulleen <seemant@gentoo.org> + superadduser-1.0.7.ebuild : + + Version bump - ~arched on all available arches. 13 Jan 2004; Jon Portnoy <avenj@gentoo.org> superadduser-1.0.5.ebuild : Stable on AMD64. diff --git a/app-admin/superadduser/Manifest b/app-admin/superadduser/Manifest index a4453eccb539..960cefb9adeb 100644 --- a/app-admin/superadduser/Manifest +++ b/app-admin/superadduser/Manifest @@ -1,9 +1,9 @@ -MD5 79dda90ec1cacbec465e04cca893e198 ChangeLog 2204 -MD5 c01a9ed65d43aa90741e51860080faab superadduser-1.0-r2.ebuild 509 MD5 7e617eddc69316e33eec1eb3a7167a44 superadduser-1.0.5.ebuild 513 -MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-superadduser-1.0-r2 0 +MD5 72e112bb17f45d4f5bd971a0d598b03b superadduser-1.0.7.ebuild 550 +MD5 6a4816cb1a1ad842327c048b19ef0b97 ChangeLog 2374 MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-superadduser-1.0.5 0 -MD5 46e6540031d91feef7643c95ea09539a files/1.0/superadduser 2199 -MD5 0d866baf36d353055132e9ea49920b02 files/1.0/superadduser.8 522 +MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-superadduser-1.0.7 0 MD5 a2ce27f4b1af8dd990226aa524469466 files/1.0.5/superadduser 10912 MD5 0d866baf36d353055132e9ea49920b02 files/1.0.5/superadduser.8 522 +MD5 602e98c0b5014d28a71d33c9ed2744ed files/1.0.7/superadduser 12302 +MD5 0d866baf36d353055132e9ea49920b02 files/1.0.7/superadduser.8 522 diff --git a/app-admin/superadduser/files/1.0.7/superadduser b/app-admin/superadduser/files/1.0.7/superadduser new file mode 100644 index 000000000000..71b28fcb5419 --- /dev/null +++ b/app-admin/superadduser/files/1.0.7/superadduser @@ -0,0 +1,375 @@ +#!/bin/bash + +########################################################################## +# Program: /usr/sbin/adduser +# Purpose: Interactive front end to /usr/sbin/useradd for Slackware Linux +# Author : Stuart Winter <stuart@polplex.co.uk> +# Based on the original Slackware adduser by Hrvoje Dogan +# with modifications by Patrick Volkerding +# Version: 1.07 +########################################################################## +# Usage..: adduser [<new_user_name>] +########################################################################## +# History # +########### +# v1.07 - 07/03/03 +# * When supplying a null string for the uid (meaning 'Choose next available'), +# if there were file names in the range 'a-z' in the pwd then the +# egrep command considered these files rather than the null string. +# The egrep expression is now in quotes. +# Reported & fixed by Vadim O. Ustiansky <sw> +# v1.06 - 31/03/03 +# * Ask to chown user.group the home directory if it already exists. +# This helps reduce later confusion when adding users whose home dir +# already exists (mounted partition for example) and is owned +# by a user other than the user to which the directory is being +# assigned as home. Default is not to chown. +# Brought to my attention by mRgOBLIN. <sw> +# v1.05 - 04/01/03 +# * Advise & prevent users from creating logins with '.' characters +# in the user name. <sw> +# * Made pending account creation info look neater <sw> +# v1.04 - 09/06/02 +# * Catered for shadow-4.0.3's 'useradd' binary that no longer +# will let you create a user that has any uppercase chars in it +# This was reported on the userlocal.org forums +# by 'xcp' - thanks. <sw,pjv> +# v1.03 - 20/05/02 +# * Support 'broken' (null lines in) /etc/passwd and +# /etc/group files <sw> +# * For recycling UIDs (default still 'off'), we now look in +# /etc/login.defs for the UID_MIN value and use it +# If not found then default to 1000 <sw> +# v1.02 - 10/04/02 +# * Fix user-specified UID bug. <pjv> +# v1.01 - 23/03/02 +# * Match Slackware indenting style, simplify. <pjv> +# v1.00 - 22/03/02 +# * Created +####################################################################### + +# Path to files +pfile=/etc/passwd +gfile=/etc/group +sfile=/etc/shells + +# Paths to binaries +useradd=/usr/sbin/useradd +chfn=/usr/bin/chfn +passwd=/usr/bin/passwd +chmod=/bin/chmod + +# Defaults +defhome=/home +defshell=/bin/bash +defchmod=711 # home dir permissions - may be preferable to use 701, however. +defgroup=users + +# Determine what the minimum UID is (for UID recycling) +# (we ignore it if it's not at the beginning of the line (i.e. commented out with #)) +export recycleUIDMIN="$(grep ^UID_MIN /etc/login.defs | awk '{print $2}' 2>/dev/null)" +# If we couldn't find it, set it to the default of 1000 +if [ -z "$recycleUIDMIN" ]; then + export recycleUIDMIN=1000 # this is the default from Slackware's /etc/login.defs +fi + + +# This setting enables the 'recycling' of older unused UIDs. +# When you userdel a user, it removes it from passwd and shadow but it will +# never get used again unless you specify it expliticly -- useradd (appears to) just +# look at the last line in passwd and increment the uid. I like the idea of +# recycling uids but you may have very good reasons not to (old forgotten +# confidential files still on the system could then be owned by this new user). +# We'll set this to no because this is what the original adduser shell script +# did and it's what users expect. +recycleuids=no + +# Function to read keyboard input. +# bash1 is broken (even ash will take read -ep!), so we work around +# it (even though bash1 is no longer supported on Slackware). +function get_input() { + local output + if [ "`echo $BASH_VERSION | cut -b1`" = "1" ]; then + echo -n "${1} " >&2 ; # fudge for use with bash v1 + read output + else # this should work with any other /bin/sh + read -ep "${1} " output + fi + echo $output +} + +# Function to display the account info +function display () { + local goose + goose="$(echo $2 | cut -d ' ' -f 2-)" # lop off the prefixed argument useradd needs + echo -n "$1 " + # If it's null then display the 'other' information + if [ -z "$goose" -a ! -z "$3" ]; then + echo "$3" + else + echo "$goose" + fi +} + +# Function to check whether groups exist in the /etc/group file +function check_group () { + local got_error group + if [ ! -z "$@" ]; then + for group in $@ ; do + local uid_not_named="" uid_not_num="" + grep -v "$^" $gfile | awk -F: '{print $1}' | grep "^${group}$" >/dev/null 2>&1 || uid_not_named=yes + grep -v "$^" $gfile | awk -F: '{print $3}' | grep "^${group}$" >/dev/null 2>&1 || uid_not_num=yes + if [ ! -z "$uid_not_named" -a ! -z "$uid_not_num" ]; then + echo "- Group '$group' does not exist" + got_error=yes + fi + done + fi + # Return exit code of 1 if at least one of the groups didn't exist + if [ ! -z "$got_error" ]; then + return 1 + fi +} + +#: Read the login name for the new user :# +# +# Remember that most Mail Transfer Agents are case independant, so having +# 'uSer' and 'user' may cause confusion/things to break. Because of this, +# useradd from shadow-4.0.3 no longer accepts usernames containing uppercase, +# and we must reject them, too. + +# Set the login variable to the command line param +echo +LOGIN="$1" +needinput=yes +while [ ! -z $needinput ]; do + if [ -z "$LOGIN" ]; then + while [ -z "$LOGIN" ]; do LOGIN="$(get_input "Login name for new user []:")" ; done + fi + grep "^${LOGIN}:" $pfile >/dev/null 2>&1 # ensure it's not already used + if [ $? -eq 0 ]; then + echo "- User '$LOGIN' already exists; please choose another" + unset LOGIN + elif [ ! "$LOGIN" = "`echo $LOGIN | tr A-Z a-z`" ]; then # useradd does not allow uppercase + echo "- User '$LOGIN' contains illegal characters (uppercase); please choose another" + unset LOGIN + elif [ ! -z "$( echo $LOGIN | grep '\.' )" ]; then + echo "- User '$LOGIN' contains illegal characters (period/dot); please choose another" + unset LOGIN + else + unset needinput + fi +done + +# Display the user name passed from the shell if it hasn't changed +if [ "$1" = "$LOGIN" ]; then + echo "Login name for new user: $LOGIN" +fi + +#: Get the UID for the user & ensure it's not already in use :# +# +# Whilst we _can_ allow users with identical UIDs, it's not a 'good thing' because +# when you change password for the uid, it finds the first match in /etc/passwd +# which isn't necessarily the correct user +# +echo +needinput=yes +while [ ! -z "$needinput" ]; do + _UID="$(get_input "User ID ('UID') [ defaults to next available ]:")" + grep -v "^$" $pfile | awk -F: '{print $3}' | grep "^${_UID}$" >/dev/null 2>&1 + if [ $? -eq 0 ]; then + echo "- That UID is already in use; please choose another" + elif [ ! -z "$(echo $_UID | egrep '[A-Za-z]')" ]; then + echo "- UIDs are numerics only" + else + unset needinput + fi +done +# If we were given a UID, then syntax up the variable to pass to useradd +if [ ! -z "$_UID" ]; then + U_ID="-u ${_UID}" +else + # Will we be recycling UIDs? + if [ "$recycleuids" = "yes" ]; then + U_ID="-u $(awk -F: '{uid[$3]=1} END { for (i=ENVIRON["recycleUIDMIN"];i in uid;i++);print i}' $pfile)" + fi +fi + +#: Get the initial group for the user & ensure it exists :# +# +# We check /etc/group for both the text version and the group ID number +echo +needinput=yes +while [ ! -z "$needinput" ]; do + GID="$(get_input "Initial group [ ${defgroup} ]:")" + check_group "$GID" + if [ $? -gt 0 ]; then + echo "- Please choose another" + else + unset needinput + fi +done +# Syntax the variable ready for useradd +if [ -z "$GID" ]; then + GID="-g ${defgroup}" +else + GID="-g ${GID}" +fi + +#: Get additional groups for the user :# +# +echo +needinput=yes +while [ ! -z "$needinput" ]; do + AGID="$(get_input "Additional groups (comma separated) []:")" + AGID="$(echo "$AGID" | tr -d ' ' | tr , ' ')" ; # fix up for parsing + if [ ! -z "$AGID" ]; then + check_group "$AGID" # check all groups at once (treated as N # of params) + if [ $? -gt 0 ]; then + echo "- Please re-enter the group(s)" + else + unset needinput # we found all groups specified + AGID="-G $(echo "$AGID" | tr ' ' ,)" + fi + else + unset needinput # we don't *have* to have additional groups + fi +done + +#: Get the new user's home dir :# +# +echo +needinput=yes +while [ ! -z "$needinput" ]; do + HME="$(get_input "Home directory [ ${defhome}/${LOGIN} ]")" + if [ -z "$HME" ]; then + HME="${defhome}/${LOGIN}" + fi + # Warn the user if the home dir already exists + if [ -d "$HME" ]; then + echo "- Warning: '$HME' already exists !" + getyn="$(get_input " Do you wish to change the home directory path ? (Y/n) ")" + if [ "$(echo $getyn | grep -i "n")" ]; then + unset needinput + # You're most likely going to only do this if you have the dir *mounted* for this user's $HOME + getyn="$(get_input " Do you want to chown $LOGIN:$( echo $GID | awk '{print $2}') $HME ? (y/N) ")" + if [ "$(echo $getyn | grep -i "y")" ]; then + CHOWNHOMEDIR=$HME # set this to the home directory + fi + fi + else + unset needinput + fi +done +HME="-d ${HME}" + +#: Get the new user's shell :# +echo +needinput=yes +while [ ! -z "$needinput" ]; do + unset got_error + SHL="$(get_input "Shell [ ${defshell} ]")" + if [ -z "$SHL" ]; then + SHL="${defshell}" + fi + # Warn the user if the shell doesn't exist in /etc/shells or as a file + if [ -z "$(grep "^${SHL}$" $sfile)" ]; then + echo "- Warning: ${SHL} is not in ${sfile} (potential problem using FTP)" + got_error=yes + fi + if [ ! -f "$SHL" ]; then + echo "- Warning: ${SHL} does not exist as a file" + got_error=yes + fi + if [ ! -z "$got_error" ]; then + getyn="$(get_input " Do you wish to change the shell ? (Y/n) ")" + if [ "$(echo $getyn | grep -i "n")" ]; then + unset needinput + fi + else + unset needinput + fi +done +SHL="-s ${SHL}" + +#: Get the expiry date :# +echo +needinput=yes +while [ ! -z "$needinput" ]; do + EXP="$(get_input "Expiry date (YYYY-MM-DD) []:")" + if [ ! -z "$EXP" ]; then + # Check to see whether the expiry date is in the valid format + if [ -z "$(echo "$EXP" | grep "^[[:digit:]]\{4\}[-]\?[[:digit:]]\{2\}[-]\?[[:digit:]]\{2\}$")" ]; then + echo "- That is not a valid expiration date" + else + unset needinput + EXP="-e ${EXP}" + fi + else + unset needinput + fi +done + +# Display the info about the new impending account +echo +echo "New account will be created as follows:" +echo +echo "---------------------------------------" +display "Login name.......: " "$LOGIN" +display "UID..............: " "$_UID" "[ Next available ]" +display "Initial group....: " "$GID" +display "Additional groups: " "$AGID" "[ None ]" +display "Home directory...: " "$HME" +display "Shell............: " "$SHL" +display "Expiry date......: " "$EXP" "[ Never ]" +echo + +echo "This is it... if you want to bail out, hit Control-C. Otherwise, press" +echo "ENTER to go ahead and make the account." +read junk + +echo +echo "Creating new account..." +echo +echo + +# Add the account to the system +CMD="$useradd "$HME" -m "$EXP" "$U_ID" "$GID" "$AGID" "$SHL" "$LOGIN"" +$CMD + +if [ $? -gt 0 ]; then + echo "- Error running useradd command -- account not created!" + echo "(cmd: $CMD)" + exit 1 +fi + +# chown the home dir ? We can only do this once the useradd has +# completed otherwise the user name doesn't exist. +if [ ! -z "${CHOWNHOMEDIR}" ]; then + chown "$LOGIN":"$( echo $GID | awk '{print $2}')" "${CHOWNHOMEDIR}" +fi + +# Set the finger information +$chfn "$LOGIN" +if [ $? -gt 0 ]; then + echo "- Warning: an error occurred while setting finger information" +fi + +# Set a password +$passwd "$LOGIN" +if [ $? -gt 0 ]; then + echo "* WARNING: An error occured while setting the password for" + echo " this account. Please manually investigate this *" + exit 1 +fi + +# If it was created (it should have been!), set the permissions for that user's dir +HME="$(echo "$HME" | awk '{print $2}')" # We have to remove the -g prefix +if [ -d "$HME" ]; then + $chmod $defchmod "$HME" +fi + +echo +echo +echo "Account setup complete." +exit 0 diff --git a/app-admin/superadduser/files/1.0/superadduser.8 b/app-admin/superadduser/files/1.0.7/superadduser.8 index c6ced2f1a974..c6ced2f1a974 100644 --- a/app-admin/superadduser/files/1.0/superadduser.8 +++ b/app-admin/superadduser/files/1.0.7/superadduser.8 diff --git a/app-admin/superadduser/files/1.0/superadduser b/app-admin/superadduser/files/1.0/superadduser deleted file mode 100644 index 1f65997ea8e0..000000000000 --- a/app-admin/superadduser/files/1.0/superadduser +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/sh -# adduser script for use with shadow passwords and useradd command. -# by Hrvoje Dogan <hdogan@student.math.hr>, Dec 1995. -# Modified by Patrick Volkerding, Oct 1997, Mar 1999, May 2000. -# Modifier by Karl Trygve Kalleberg, Aug 2002. - -echo -echo -n "Login name for new user []: " -read LOGIN -if [ -z "$LOGIN" ]; then - echo "Come on, man, you can't leave the login field empty..." - exit -fi -echo -echo -n "User id for $LOGIN [ defaults to next available]: " -read ID -GUID="-u $ID" -if [ -z "$ID" ]; then - GUID="" -fi - -echo -echo -n "Initial group for $LOGIN [users]: " -read GID -if [ -z "$GID" ]; then - GID="users" -fi -GGID="-g $GID" -echo -echo "Additional groups for $LOGIN (seperated" -echo -n "with commas, no spaces) []: " -read AGID -GAGID="-G $AGID" -if [ -z "$AGID" ]; then - GAGID="" -fi - -echo -echo -n "$LOGIN's home directory [/home/$LOGIN]: " -read HME -if [ -z "$HME" ]; then - HME="/home/$LOGIN" -fi -GHME="-d $HME" - -echo -echo -n "$LOGIN's shell [/bin/bash]: " -read SHL -GSHL="-s $SHL" -if [ -z "$SHL" ]; then - GSHL="-s /bin/bash" - SHL="/bin/bash" -fi -echo -echo -n "$LOGIN's account expiry date (YYYY-MM-DD) []: " -read EXP -GEXP="-e $EXP" -if [ -z "$EXP" ]; then - GEXP="" -fi -echo -echo "OK, I'm about to make a new account. Here's what you entered so far:" -echo -echo New login name: $LOGIN -if [ -z "$GUID" ]; then - echo New UID: [Next available] -else - echo New UID: $UID -fi -if [ -z "$GGID" ]; then - echo Initial group: users -else - echo Initial group: $GID -fi -if [ -z "$GAGID" ]; then - echo Additional groups: [none] -else - echo Additional groups: $AGID -fi -if [ -z "$GHME" ]; then - echo Home directory: /home/$LOGIN -else - echo Home directory: $HME -fi -if [ -z "$GSHL" ]; then - echo Shell: /bin/bash -else - echo Shell: $SHL -fi -if [ -z "$GEXP" ]; then - echo Expiry date: [no expiration] -else - echo Expiry date: $EXP -fi -echo -echo "This is it... if you want to bail out, hit Control-C. Otherwise, press" -echo "ENTER to go ahead and make the account." -read FOO -echo -echo Making new account... -/usr/sbin/useradd $GHME -m $GEXP $GGID $GAGID $GSHL $GUID $LOGIN -if [ -d $HME ]; then - chmod 711 $HME - chown $LOGIN:$GID $HME -fi -echo -/usr/bin/chfn $LOGIN -echo -/usr/bin/passwd $LOGIN -echo "Done..." diff --git a/app-admin/superadduser/files/digest-superadduser-1.0-r2 b/app-admin/superadduser/files/digest-superadduser-1.0.7 index e69de29bb2d1..e69de29bb2d1 100644 --- a/app-admin/superadduser/files/digest-superadduser-1.0-r2 +++ b/app-admin/superadduser/files/digest-superadduser-1.0.7 diff --git a/app-admin/superadduser/superadduser-1.0-r2.ebuild b/app-admin/superadduser/superadduser-1.0.7.ebuild index 785c2b91a213..ebe315a4c439 100644 --- a/app-admin/superadduser/superadduser-1.0-r2.ebuild +++ b/app-admin/superadduser/superadduser-1.0.7.ebuild @@ -1,6 +1,6 @@ -# Copyright 1999-2003 Gentoo Technologies, Inc. +# Copyright 1999-2004 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/app-admin/superadduser/superadduser-1.0-r2.ebuild,v 1.8 2003/02/13 05:30:59 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-admin/superadduser/superadduser-1.0.7.ebuild,v 1.1 2004/01/15 18:50:52 seemant Exp $ DESCRIPTION="Interactive adduser script" SRC_URI="" @@ -8,7 +8,7 @@ HOMEPAGE="http://www.gentoo.org/" SLOT="0" LICENSE="GPL-2" -KEYWORDS="x86 ppc sparc alpha" +KEYWORDS="~x86 ~ppc ~sparc ~alpha ~hppa ~mips ~arm ~amd64 ~ia64 ~ppc64" RDEPEND="sys-apps/shadow" |