Gentoo Archives: gentoo-commits

From: David Seifert <soap@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-admin/superadduser/files/1.0.9/, app-admin/superadduser/
Date: Sun, 25 Apr 2021 09:17:02
Message-Id: 1619342191.1174ca4869197bd35b02217c6c30d7fd4c2e43b1.soap@gentoo
1 commit: 1174ca4869197bd35b02217c6c30d7fd4c2e43b1
2 Author: David Seifert <soap <AT> gentoo <DOT> org>
3 AuthorDate: Sun Apr 25 09:16:31 2021 +0000
4 Commit: David Seifert <soap <AT> gentoo <DOT> org>
5 CommitDate: Sun Apr 25 09:16:31 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1174ca48
7
8 app-admin/superadduser: Remove old 1.0.9
9
10 Package-Manager: Portage-3.0.18, Repoman-3.0.3
11 Signed-off-by: David Seifert <soap <AT> gentoo.org>
12
13 app-admin/superadduser/files/1.0.9/superadduser | 407 -----------------------
14 app-admin/superadduser/superadduser-1.0.9.ebuild | 22 --
15 2 files changed, 429 deletions(-)
16
17 diff --git a/app-admin/superadduser/files/1.0.9/superadduser b/app-admin/superadduser/files/1.0.9/superadduser
18 deleted file mode 100644
19 index dd5e3158dda..00000000000
20 --- a/app-admin/superadduser/files/1.0.9/superadduser
21 +++ /dev/null
22 @@ -1,407 +0,0 @@
23 -#!/bin/bash
24 -#
25 -# Copyright 1995 Hrvoje Dogan, Croatia.
26 -# Copyright 2002, 2003, 2004 Stuart Winter, West Midlands, England, UK.
27 -# Copyright 2004 Slackware Linux, Inc., Concord, CA, USA
28 -# All rights reserved.
29 -#
30 -# Redistribution and use of this script, with or without modification, is
31 -# permitted provided that the following conditions are met:
32 -#
33 -# 1. Redistributions of this script must retain the above copyright
34 -# notice, this list of conditions and the following disclaimer.
35 -#
36 -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
37 -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
38 -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
39 -# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
41 -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
42 -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
43 -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
44 -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
45 -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46 -#
47 -#
48 -##########################################################################
49 -# Program: /usr/sbin/adduser
50 -# Purpose: Interactive front end to /usr/sbin/useradd for Slackware Linux
51 -# Author : Stuart Winter <stuart@××××××××××.uk>
52 -# Based on the original Slackware adduser by Hrvoje Dogan
53 -# with modifications by Patrick Volkerding
54 -# Version: 1.09
55 -##########################################################################
56 -# Usage..: adduser [<new_user_name>]
57 -##########################################################################
58 -# History #
59 -###########
60 -# v1.09 - 07/06/04
61 -# * Added standard Slackware script licence to the head of this file.
62 -# v1.08 - 25/04/04
63 -# * Disallow user names that begin with a numeric because useradd
64 -# (from shadow v4.03) does not allow them. <sw>
65 -# v1.07 - 07/03/03
66 -# * When supplying a null string for the uid (meaning 'Choose next available'),
67 -# if there were file names in the range 'a-z' in the pwd then the
68 -# egrep command considered these files rather than the null string.
69 -# The egrep expression is now in quotes.
70 -# Reported & fixed by Vadim O. Ustiansky <sw>
71 -# v1.06 - 31/03/03
72 -# * Ask to chown user.group the home directory if it already exists.
73 -# This helps reduce later confusion when adding users whose home dir
74 -# already exists (mounted partition for example) and is owned
75 -# by a user other than the user to which the directory is being
76 -# assigned as home. Default is not to chown.
77 -# Brought to my attention by mRgOBLIN. <sw>
78 -# v1.05 - 04/01/03
79 -# * Advise & prevent users from creating logins with '.' characters
80 -# in the user name. <sw>
81 -# * Made pending account creation info look neater <sw>
82 -# v1.04 - 09/06/02
83 -# * Catered for shadow-4.0.3's 'useradd' binary that no longer
84 -# will let you create a user that has any uppercase chars in it
85 -# This was reported on the userlocal.org forums
86 -# by 'xcp' - thanks. <sw,pjv>
87 -# v1.03 - 20/05/02
88 -# * Support 'broken' (null lines in) /etc/passwd and
89 -# /etc/group files <sw>
90 -# * For recycling UIDs (default still 'off'), we now look in
91 -# /etc/login.defs for the UID_MIN value and use it
92 -# If not found then default to 1000 <sw>
93 -# v1.02 - 10/04/02
94 -# * Fix user-specified UID bug. <pjv>
95 -# v1.01 - 23/03/02
96 -# * Match Slackware indenting style, simplify. <pjv>
97 -# v1.00 - 22/03/02
98 -# * Created
99 -#######################################################################
100 -
101 -# Path to files
102 -pfile=/etc/passwd
103 -gfile=/etc/group
104 -sfile=/etc/shells
105 -
106 -# Paths to binaries
107 -useradd=/usr/sbin/useradd
108 -chfn=/usr/bin/chfn
109 -passwd=/usr/bin/passwd
110 -chmod=/bin/chmod
111 -
112 -# Defaults
113 -defhome=/home
114 -defshell=/bin/bash
115 -defchmod=711 # home dir permissions - may be preferable to use 701, however.
116 -defgroup=users
117 -
118 -# Determine what the minimum UID is (for UID recycling)
119 -# (we ignore it if it's not at the beginning of the line (i.e. commented out with #))
120 -export recycleUIDMIN="$(grep ^UID_MIN /etc/login.defs | awk '{print $2}' 2>/dev/null)"
121 -# If we couldn't find it, set it to the default of 1000
122 -if [[ -z "$recycleUIDMIN" ]]; then
123 - export recycleUIDMIN=1000 # this is the default from Slackware's /etc/login.defs
124 -fi
125 -
126 -
127 -# This setting enables the 'recycling' of older unused UIDs.
128 -# When you userdel a user, it removes it from passwd and shadow but it will
129 -# never get used again unless you specify it expliticly -- useradd (appears to) just
130 -# look at the last line in passwd and increment the uid. I like the idea of
131 -# recycling uids but you may have very good reasons not to (old forgotten
132 -# confidential files still on the system could then be owned by this new user).
133 -# We'll set this to no because this is what the original adduser shell script
134 -# did and it's what users expect.
135 -recycleuids=no
136 -
137 -# Function to read keyboard input.
138 -# bash1 is broken (even ash will take read -ep!), so we work around
139 -# it (even though bash1 is no longer supported on Slackware).
140 -function get_input() {
141 - local output
142 - if [[ "`echo $BASH_VERSION | cut -b1`" = "1" ]]; then
143 - echo -n "${1} " >&2 # fudge for use with bash v1
144 - read output
145 - else # this should work with any other /bin/sh
146 - read -ep "${1} " output
147 - fi
148 - echo $output
149 -}
150 -
151 -# Function to display the account info
152 -function display () {
153 - local goose
154 - goose="$(echo $2 | cut -d ' ' -f 2-)" # lop off the prefixed argument useradd needs
155 - echo -n "$1 "
156 - # If it's null then display the 'other' information
157 - if [ -z "$goose" -a ! -z "$3" ]; then
158 - echo "$3"
159 - else
160 - echo "$goose"
161 - fi
162 -}
163 -
164 -# Function to check whether groups exist in the /etc/group file
165 -function check_group () {
166 - local got_error group
167 - if [[ ! -z "$@" ]]; then
168 - for group in $@ ; do
169 - local uid_not_named="" uid_not_num=""
170 - grep -v "$^" $gfile | awk -F: '{print $1}' | grep "^${group}$" >/dev/null 2>&1 || uid_not_named=yes
171 - grep -v "$^" $gfile | awk -F: '{print $3}' | grep "^${group}$" >/dev/null 2>&1 || uid_not_num=yes
172 - if [ ! -z "$uid_not_named" -a ! -z "$uid_not_num" ]; then
173 - echo "- Group '$group' does not exist"
174 - got_error=yes
175 - fi
176 - done
177 - fi
178 - # Return exit code of 1 if at least one of the groups didn't exist
179 - if [[ ! -z "$got_error" ]]; then
180 - return 1
181 - fi
182 -}
183 -
184 -#: Read the login name for the new user :#
185 -#
186 -# Remember that most Mail Transfer Agents are case independant, so having
187 -# 'uSer' and 'user' may cause confusion/things to break. Because of this,
188 -# useradd from shadow-4.0.3 no longer accepts usernames containing uppercase,
189 -# and we must reject them, too.
190 -
191 -# Set the login variable to the command line param
192 -echo
193 -LOGIN="$1"
194 -needinput=yes
195 -while [[ ! -z $needinput ]]; do
196 - if [[ -z "$LOGIN" ]]; then
197 - while [[ -z "$LOGIN" ]]; do LOGIN="$(get_input "Login name for new user []:")" ; done
198 - fi
199 - grep "^${LOGIN}:" $pfile >/dev/null 2>&1 # ensure it's not already used
200 - if [[ $? -eq 0 ]]; then
201 - echo "- User '$LOGIN' already exists; please choose another"
202 - unset LOGIN
203 - elif [[ ! -z "$( echo $LOGIN | grep "^[0-9]" )" ]]; then
204 - echo "- User names cannot begin with a number; please choose another"
205 - unset LOGIN
206 - elif [[ ! "$LOGIN" = "`echo $LOGIN | tr A-Z a-z`" ]]; then # useradd does not allow uppercase
207 - echo "- User '$LOGIN' contains illegal characters (uppercase); please choose another"
208 - unset LOGIN
209 - elif [[ ! -z "$( echo $LOGIN | grep '\.' )" ]]; then
210 - echo "- User '$LOGIN' contains illegal characters (period/dot); please choose another"
211 - unset LOGIN
212 - else
213 - unset needinput
214 - fi
215 -done
216 -
217 -# Display the user name passed from the shell if it hasn't changed
218 -if [[ "$1" = "$LOGIN" ]]; then
219 - echo "Login name for new user: $LOGIN"
220 -fi
221 -
222 -#: Get the UID for the user & ensure it's not already in use :#
223 -#
224 -# Whilst we _can_ allow users with identical UIDs, it's not a 'good thing' because
225 -# when you change password for the uid, it finds the first match in /etc/passwd
226 -# which isn't necessarily the correct user
227 -#
228 -echo
229 -needinput=yes
230 -while [[ ! -z "$needinput" ]]; do
231 - _UID="$(get_input "User ID ('UID') [ defaults to next available ]:")"
232 - grep -v "^$" $pfile | awk -F: '{print $3}' | grep "^${_UID}$" >/dev/null 2>&1
233 - if [[ $? -eq 0 ]]; then
234 - echo "- That UID is already in use; please choose another"
235 - elif [ ! -z "$(echo $_UID | egrep '[A-Za-z]')" ]; then
236 - echo "- UIDs are numerics only"
237 - else
238 - unset needinput
239 - fi
240 -done
241 -# If we were given a UID, then syntax up the variable to pass to useradd
242 -if [[ ! -z "$_UID" ]]; then
243 - U_ID="-u ${_UID}"
244 -else
245 - # Will we be recycling UIDs?
246 - if [[ "$recycleuids" = "yes" ]]; then
247 - U_ID="-u $(awk -F: '{uid[$3]=1} END { for (i=ENVIRON["recycleUIDMIN"];i in uid;i++);print i}' $pfile)"
248 - fi
249 -fi
250 -
251 -#: Get the initial group for the user & ensure it exists :#
252 -#
253 -# We check /etc/group for both the text version and the group ID number
254 -echo
255 -needinput=yes
256 -while [[ ! -z "$needinput" ]]; do
257 - GID="$(get_input "Initial group [ ${defgroup} ]:")"
258 - check_group "$GID"
259 - if [[ $? -gt 0 ]]; then
260 - echo "- Please choose another"
261 - else
262 - unset needinput
263 - fi
264 -done
265 -# Syntax the variable ready for useradd
266 -if [[ -z "$GID" ]]; then
267 - GID="-g ${defgroup}"
268 -else
269 - GID="-g ${GID}"
270 -fi
271 -
272 -#: Get additional groups for the user :#
273 -#
274 -echo
275 -needinput=yes
276 -while [[ ! -z "$needinput" ]]; do
277 - AGID="$(get_input "Additional groups (comma separated) []:")"
278 - AGID="$(echo "$AGID" | tr -d ' ' | tr , ' ')" # fix up for parsing
279 - if [[ ! -z "$AGID" ]]; then
280 - check_group "$AGID" # check all groups at once (treated as N # of params)
281 - if [[ $? -gt 0 ]]; then
282 - echo "- Please re-enter the group(s)"
283 - else
284 - unset needinput # we found all groups specified
285 - AGID="-G $(echo "$AGID" | tr ' ' ,)"
286 - fi
287 - else
288 - unset needinput # we don't *have* to have additional groups
289 - fi
290 -done
291 -
292 -#: Get the new user's home dir :#
293 -#
294 -echo
295 -needinput=yes
296 -while [[ ! -z "$needinput" ]]; do
297 - HME="$(get_input "Home directory [ ${defhome}/${LOGIN} ]")"
298 - if [[ -z "$HME" ]]; then
299 - HME="${defhome}/${LOGIN}"
300 - fi
301 - # Warn the user if the home dir already exists
302 - if [[ -d "$HME" ]]; then
303 - echo "- Warning: '$HME' already exists !"
304 - getyn="$(get_input " Do you wish to change the home directory path ? (Y/n) ")"
305 - if [[ "$(echo $getyn | grep -i "n")" ]]; then
306 - unset needinput
307 - # You're most likely going to only do this if you have the dir *mounted* for this user's $HOME
308 - getyn="$(get_input " Do you want to chown $LOGIN.$( echo $GID | awk '{print $2}') $HME ? (y/N) ")"
309 - if [[ "$(echo $getyn | grep -i "y")" ]]; then
310 - CHOWNHOMEDIR=$HME # set this to the home directory
311 - fi
312 - fi
313 - else
314 - unset needinput
315 - fi
316 -done
317 -HME="-d ${HME}"
318 -
319 -#: Get the new user's shell :#
320 -echo
321 -needinput=yes
322 -while [[ ! -z "$needinput" ]]; do
323 - unset got_error
324 - SHL="$(get_input "Shell [ ${defshell} ]")"
325 - if [[ -z "$SHL" ]]; then
326 - SHL="${defshell}"
327 - fi
328 - # Warn the user if the shell doesn't exist in /etc/shells or as a file
329 - if [[ -z "$(grep "^${SHL}$" $sfile)" ]]; then
330 - echo "- Warning: ${SHL} is not in ${sfile} (potential problem using FTP)"
331 - got_error=yes
332 - fi
333 - if [[ ! -f "$SHL" ]]; then
334 - echo "- Warning: ${SHL} does not exist as a file"
335 - got_error=yes
336 - fi
337 - if [[ ! -z "$got_error" ]]; then
338 - getyn="$(get_input " Do you wish to change the shell ? (Y/n) ")"
339 - if [[ "$(echo $getyn | grep -i "n")" ]]; then
340 - unset needinput
341 - fi
342 - else
343 - unset needinput
344 - fi
345 -done
346 -SHL="-s ${SHL}"
347 -
348 -#: Get the expiry date :#
349 -echo
350 -needinput=yes
351 -while [[ ! -z "$needinput" ]]; do
352 - EXP="$(get_input "Expiry date (YYYY-MM-DD) []:")"
353 - if [[ ! -z "$EXP" ]]; then
354 - # Check to see whether the expiry date is in the valid format
355 - if [ -z "$(echo "$EXP" | grep "^[[:digit:]]\{4\}[-]\?[[:digit:]]\{2\}[-]\?[[:digit:]]\{2\}$")" ]; then
356 - echo "- That is not a valid expiration date"
357 - else
358 - unset needinput
359 - EXP="-e ${EXP}"
360 - fi
361 - else
362 - unset needinput
363 - fi
364 -done
365 -
366 -# Display the info about the new impending account
367 -echo
368 -echo "New account will be created as follows:"
369 -echo
370 -echo "---------------------------------------"
371 -display "Login name.......: " "$LOGIN"
372 -display "UID..............: " "$_UID" "[ Next available ]"
373 -display "Initial group....: " "$GID"
374 -display "Additional groups: " "$AGID" "[ None ]"
375 -display "Home directory...: " "$HME"
376 -display "Shell............: " "$SHL"
377 -display "Expiry date......: " "$EXP" "[ Never ]"
378 -echo
379 -
380 -echo "This is it... if you want to bail out, hit Control-C. Otherwise, press"
381 -echo "ENTER to go ahead and make the account."
382 -read junk
383 -
384 -echo
385 -echo "Creating new account..."
386 -echo
387 -echo
388 -
389 -# Add the account to the system
390 -CMD="$useradd "$HME" -m "$EXP" "$U_ID" "$GID" "$AGID" "$SHL" "$LOGIN""
391 -$CMD
392 -
393 -if [[ $? -gt 0 ]]; then
394 - echo "- Error running useradd command -- account not created!"
395 - echo "(cmd: $CMD)"
396 - exit 1
397 -fi
398 -
399 -# chown the home dir ? We can only do this once the useradd has
400 -# completed otherwise the user name doesn't exist.
401 -if [[ ! -z "${CHOWNHOMEDIR}" ]]; then
402 - chown "$LOGIN"."$( echo $GID | awk '{print $2}')" "${CHOWNHOMEDIR}"
403 -fi
404 -
405 -# Set the finger information
406 -$chfn "$LOGIN"
407 -if [[ $? -gt 0 ]]; then
408 - echo "- Warning: an error occurred while setting finger information"
409 -fi
410 -
411 -# Set a password
412 -$passwd "$LOGIN"
413 -if [[ $? -gt 0 ]]; then
414 - echo "* WARNING: An error occured while setting the password for"
415 - echo " this account. Please manually investigate this *"
416 - exit 1
417 -fi
418 -
419 -# If it was created (it should have been!), set the permissions for that user's dir
420 -HME="$(echo "$HME" | awk '{print $2}')" # We have to remove the -g prefix
421 -if [[ -d "$HME" ]]; then
422 - $chmod $defchmod "$HME"
423 -fi
424 -
425 -echo
426 -echo
427 -echo "Account setup complete."
428 -exit 0
429 -
430
431 diff --git a/app-admin/superadduser/superadduser-1.0.9.ebuild b/app-admin/superadduser/superadduser-1.0.9.ebuild
432 deleted file mode 100644
433 index bb0a3d8ddff..00000000000
434 --- a/app-admin/superadduser/superadduser-1.0.9.ebuild
435 +++ /dev/null
436 @@ -1,22 +0,0 @@
437 -# Copyright 1999-2021 Gentoo Authors
438 -# Distributed under the terms of the GNU General Public License v2
439 -
440 -EAPI=6
441 -
442 -DESCRIPTION="Interactive adduser script from Slackware"
443 -HOMEPAGE="http://www.interlude.org.uk/unix/slackware/"
444 -SRC_URI=""
445 -
446 -LICENSE="BSD"
447 -SLOT="0"
448 -KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~m68k ~mips ppc ppc64 ~s390 sparc x86"
449 -IUSE=""
450 -
451 -RDEPEND="sys-apps/shadow"
452 -
453 -S=${WORKDIR}
454 -
455 -src_install() {
456 - dosbin "${FILESDIR}"/${PV}/superadduser
457 - doman "${FILESDIR}"/superadduser.8
458 -}