From 4f2d7949f03e1c198bc888f2d05f421d35c57e21 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 9 Oct 2017 18:53:29 +0100 Subject: reinit the tree, so we can have metadata --- app-admin/superadduser/Manifest | 6 + app-admin/superadduser/files/1.0.9/superadduser | 407 +++++++++++++++++++++++ app-admin/superadduser/files/superadduser.8 | 20 ++ app-admin/superadduser/metadata.xml | 8 + app-admin/superadduser/superadduser-1.0.9.ebuild | 18 + 5 files changed, 459 insertions(+) create mode 100644 app-admin/superadduser/Manifest create mode 100644 app-admin/superadduser/files/1.0.9/superadduser create mode 100644 app-admin/superadduser/files/superadduser.8 create mode 100644 app-admin/superadduser/metadata.xml create mode 100644 app-admin/superadduser/superadduser-1.0.9.ebuild (limited to 'app-admin/superadduser') diff --git a/app-admin/superadduser/Manifest b/app-admin/superadduser/Manifest new file mode 100644 index 000000000000..6b62169f82c6 --- /dev/null +++ b/app-admin/superadduser/Manifest @@ -0,0 +1,6 @@ +AUX 1.0.9/superadduser 13973 SHA256 0ae832ca94b2b648dc0be30e71fda02b6dc7b8259fb3bf445d0833b37b4222bf SHA512 3eac518597abf1ce6b5562137003c875df41f30df3394a2afdb3458833736c73ad47e94edcda06f71c207c203a43449b8f740e3345f853976e550657b372bdba WHIRLPOOL 9db864f894aae334be85137b23c61a095cba1d1ddf52682d9bbda4776e7b31f5d516ca6df1c5c9196610ff97832d8acd0450e3c7b383d4ba5c5135954091e0e8 +AUX superadduser.8 517 SHA256 87c423e40c11b3608c235d2fb2b6ad2505a909c83ff9b285ab59888967b9475d SHA512 f07bc575a8ee89b2fcc27714eac4ad5c7129dedc2fa927d5490735109594f81dbe0fd7057f5c1317f3aa1905a1ac5a51e589d5eb9484b528b0174380e6c3297f WHIRLPOOL d49280376c39487e7d96451abbd5a3913e2063d0a102802ab21a56ee444dba6287a7451169db9a98bd5105e74044f2287902b99be9d829d9d259ae75f45a0c4d +EBUILD superadduser-1.0.9.ebuild 474 SHA256 d002ae3db10da62703a245ac9f23850461e0d9f892d56865dc2dc119210b56e7 SHA512 ebbbbb3e0d84d670ad93f4bd3595e6e3b9c7050bdb8360da3fdd472bf8f0682c0a7057c0d8fb8c2a29a32b8fea5a28eb1deed2b7f3bae7a2810a750c7d6e1504 WHIRLPOOL a73b5820810a98d8ac5ec77a7497e5120c145294fef61b66d17dfa99e701f76b055d3178e2a4cba004ab4e168ff01f50d5efc7b423f826a2842e6d64f92f81aa +MISC ChangeLog 2495 SHA256 87171501e61048abada67b20d8f259e2dca376287e745f478fef9d1698fc9160 SHA512 1ac0e0a2d50bd382a5d87f47dd13048418fdb8c255b34f84ab3381c78a96d6263513c2fbf22ccb9c39a2d2b8adc029fe81d39d9f852e5fb1790726eacb3afbe8 WHIRLPOOL 1346de37000d5786c154e8ec58da9be6443fa85a20f7c5ac42231b0229d9ac438470fe7b7cd2c2c4718e8ae96480c4cb09c761e939ad889ac04624d19fc51b49 +MISC ChangeLog-2015 5884 SHA256 566b8e48a39f900ff0f1125baf84d3fc39fc9dc66b702a16798cbf4060f3fd27 SHA512 419b47a12f1479d532b9325349ffcaa91cc1c5bcacc186ec90182d13a27e212139ea7734f1fab56392fee05678c561c9abdeada1ec1c421ebf3131e443d14fe3 WHIRLPOOL 80d15de6c999226bcd56f70b3cd0198dfb614529166494e15d39d0bcbd7415ce6ab2780329fb58d34dc22a4dca01cfa46add161b380084d7478190bca7ebeef0 +MISC metadata.xml 253 SHA256 d82c33ef453113a5c1ebe250dcba373c22934a69b0a86c6ab15a5ca589c25b91 SHA512 54a9069aeb4165d2dff3d473c8001bc51613aac9dff3f7f5e9971a9891a737a31511ffa11cbd523febe581ac1d9de2bdf2f40410f0c4239138f2ccca3ef15555 WHIRLPOOL e5aee23acff864609953a1e4de768f0e4aef704b44c53c021f28573e1ca5c99f1a46d92935ecec2449f7b4419a36d8373127d0ecfa8d7bae72d835e1839eb3f8 diff --git a/app-admin/superadduser/files/1.0.9/superadduser b/app-admin/superadduser/files/1.0.9/superadduser new file mode 100644 index 000000000000..dd5e3158ddad --- /dev/null +++ b/app-admin/superadduser/files/1.0.9/superadduser @@ -0,0 +1,407 @@ +#!/bin/bash +# +# Copyright 1995 Hrvoje Dogan, Croatia. +# Copyright 2002, 2003, 2004 Stuart Winter, West Midlands, England, UK. +# Copyright 2004 Slackware Linux, Inc., Concord, CA, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# +########################################################################## +# Program: /usr/sbin/adduser +# Purpose: Interactive front end to /usr/sbin/useradd for Slackware Linux +# Author : Stuart Winter +# Based on the original Slackware adduser by Hrvoje Dogan +# with modifications by Patrick Volkerding +# Version: 1.09 +########################################################################## +# Usage..: adduser [] +########################################################################## +# History # +########### +# v1.09 - 07/06/04 +# * Added standard Slackware script licence to the head of this file. +# v1.08 - 25/04/04 +# * Disallow user names that begin with a numeric because useradd +# (from shadow v4.03) does not allow them. +# 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 +# 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. +# v1.05 - 04/01/03 +# * Advise & prevent users from creating logins with '.' characters +# in the user name. +# * Made pending account creation info look neater +# 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. +# v1.03 - 20/05/02 +# * Support 'broken' (null lines in) /etc/passwd and +# /etc/group files +# * 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 +# v1.02 - 10/04/02 +# * Fix user-specified UID bug. +# v1.01 - 23/03/02 +# * Match Slackware indenting style, simplify. +# 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 [[ ! -z "$( echo $LOGIN | grep "^[0-9]" )" ]]; then + echo "- User names cannot begin with a number; 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/superadduser.8 b/app-admin/superadduser/files/superadduser.8 new file mode 100644 index 000000000000..efefadcd14d6 --- /dev/null +++ b/app-admin/superadduser/files/superadduser.8 @@ -0,0 +1,20 @@ +.TH superadduser "8" "April 2002" "superadduser 1.0" +.SH NAME +superadduser \- manual page for the superadduser program, an interactive +version of adduser. +.SH SYNOPSIS +.B superadduser +.SH DESCRIPTION +Superadduser interactively asks the user to fill in the necessary parameters to +the +.I shadow +package's useradd program. +.PP +.SH AUTHOR +Man page by Karl Trygve Kalleberg +.br +Script by Stuart Winter +.SH "SEE ALSO" +useradd(8) +.TP +The \fI/usr/sbin/superadduser\fR script. diff --git a/app-admin/superadduser/metadata.xml b/app-admin/superadduser/metadata.xml new file mode 100644 index 000000000000..56c124413057 --- /dev/null +++ b/app-admin/superadduser/metadata.xml @@ -0,0 +1,8 @@ + + + + + base-system@gentoo.org + Gentoo Base System + + diff --git a/app-admin/superadduser/superadduser-1.0.9.ebuild b/app-admin/superadduser/superadduser-1.0.9.ebuild new file mode 100644 index 000000000000..2b2feb3db800 --- /dev/null +++ b/app-admin/superadduser/superadduser-1.0.9.ebuild @@ -0,0 +1,18 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +DESCRIPTION="Interactive adduser script from Slackware" +HOMEPAGE="http://www.interlude.org.uk/unix/slackware/" +SRC_URI="" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86" +IUSE="" + +RDEPEND="sys-apps/shadow" + +src_install() { + dosbin "${FILESDIR}"/${PV}/superadduser || die + doman "${FILESDIR}"/superadduser.8 +} -- cgit v1.2.3