diff previous-work/more_control_helpers/sbin/install_package @ 1:d6bef198ae71

add work by Matthias S. Benkmann which is the inspiration for this project.
author Robert McIntyre <rlm@mit.edu>
date Tue, 08 Jan 2013 11:45:01 +0000
parents
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/previous-work/more_control_helpers/sbin/install_package	Tue Jan 08 11:45:01 2013 +0000
     1.3 @@ -0,0 +1,35 @@
     1.4 +#!/bin/bash
     1.5 +# Copyright (c) 2000,2004 Matthias S. Benkmann <article AT winterdrache DOT de>
     1.6 +# You may do everything with this code except misrepresent its origin.
     1.7 +# PROVIDED `AS IS' WITH ABSOLUTELY NO WARRANTY OF ANY KIND!
     1.8 +
     1.9 +if [ $# -eq 1 ]; then
    1.10 +  set -- "$1" "$1" "$1"
    1.11 +fi
    1.12 +
    1.13 +if [ $# -ne 3 ]; then
    1.14 +  echo 1>&2
    1.15 +  echo 1>&2 'USAGE 1: install_package <description> <name> <group>'
    1.16 +  echo 1>&2 'USAGE 2: install_package <name>'
    1.17 +  echo 1>&2
    1.18 +  echo 1>&2 'Creates a new package user called <name> with primary group <group>'
    1.19 +  echo 1>&2 'and description <description>.'
    1.20 +  echo 1>&2 'If the user account has been created successfully, `su - <name>'"'"' will be'
    1.21 +  echo 1>&2 'executed so that you can start working with the new account right away.'
    1.22 +  echo 1>&2
    1.23 +  echo 1>&2 '<description> needs to be a valid string for the /etc/passwd description'
    1.24 +  echo 1>&2 '  field. This means, among other things, that it must not contain ":".'
    1.25 +  echo 1>&2 '  Don'"'"'t forget to properly quote <description> if it contains spaces or'
    1.26 +  echo 1>&2 '  other characters interpreted by the shell!'
    1.27 +  echo 1>&2
    1.28 +  echo 1>&2 'This script leaves the actual creation of the new account to the'
    1.29 +  echo 1>&2 'add_package_user script. Check out its documentation for details.'
    1.30 +  echo 1>&2
    1.31 +  echo 1>&2 'When called with just one argument, that argument will be used as'
    1.32 +  echo 1>&2 '<name>, <description> and <group>'
    1.33 +  exit 1
    1.34 +fi
    1.35 +
    1.36 +if [ $UID -ne 0 ]; then echo Please run this script as root. ; exit 1; fi
    1.37 +add_package_user "${1}" $2 10000 20000 $3 10000 20000 || exit 1
    1.38 +su - $2