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