annotate previous-work/more_control_helpers/sbin/install_package @ 30:f1d0574937b5

minor cosmetic changes.
author Robert McIntyre <rlm@mit.edu>
date Tue, 15 Jan 2013 03:56:59 +0000
parents d6bef198ae71
children
rev   line source
rlm@1 1 #!/bin/bash
rlm@1 2 # Copyright (c) 2000,2004 Matthias S. Benkmann <article AT winterdrache DOT de>
rlm@1 3 # You may do everything with this code except misrepresent its origin.
rlm@1 4 # PROVIDED `AS IS' WITH ABSOLUTELY NO WARRANTY OF ANY KIND!
rlm@1 5
rlm@1 6 if [ $# -eq 1 ]; then
rlm@1 7 set -- "$1" "$1" "$1"
rlm@1 8 fi
rlm@1 9
rlm@1 10 if [ $# -ne 3 ]; then
rlm@1 11 echo 1>&2
rlm@1 12 echo 1>&2 'USAGE 1: install_package <description> <name> <group>'
rlm@1 13 echo 1>&2 'USAGE 2: install_package <name>'
rlm@1 14 echo 1>&2
rlm@1 15 echo 1>&2 'Creates a new package user called <name> with primary group <group>'
rlm@1 16 echo 1>&2 'and description <description>.'
rlm@1 17 echo 1>&2 'If the user account has been created successfully, `su - <name>'"'"' will be'
rlm@1 18 echo 1>&2 'executed so that you can start working with the new account right away.'
rlm@1 19 echo 1>&2
rlm@1 20 echo 1>&2 '<description> needs to be a valid string for the /etc/passwd description'
rlm@1 21 echo 1>&2 ' field. This means, among other things, that it must not contain ":".'
rlm@1 22 echo 1>&2 ' Don'"'"'t forget to properly quote <description> if it contains spaces or'
rlm@1 23 echo 1>&2 ' other characters interpreted by the shell!'
rlm@1 24 echo 1>&2
rlm@1 25 echo 1>&2 'This script leaves the actual creation of the new account to the'
rlm@1 26 echo 1>&2 'add_package_user script. Check out its documentation for details.'
rlm@1 27 echo 1>&2
rlm@1 28 echo 1>&2 'When called with just one argument, that argument will be used as'
rlm@1 29 echo 1>&2 '<name>, <description> and <group>'
rlm@1 30 exit 1
rlm@1 31 fi
rlm@1 32
rlm@1 33 if [ $UID -ne 0 ]; then echo Please run this script as root. ; exit 1; fi
rlm@1 34 add_package_user "${1}" $2 10000 20000 $3 10000 20000 || exit 1
rlm@1 35 su - $2