7 if test -z "$USERNM"; then
8 echo Usage
: create-user-wrapper USERNAME
\'NAME SURNAME
\' [EMAIL
]
12 if test -z "$REALNM"; then
13 echo Usage
: create-user-wrapper USERNAME
\'NAME SURNAME
\' [EMAIL
]
17 INITPW
=$
(sudo
-u hcoop psql hcoop_hcoop
-tc "select unix_passwd from MemberApp where name = '${USERNM}';")
23 /afs
/hcoop.net
/common
/etc
/scripts
/create-user
$USERNM || \
24 ( echo "create-user $USERNM failed" && exit 2 )
27 # Entry in LDAP is created, set real name
30 #dn: uid=$USERNM,ou=People,dc=hcoop,dc=net
34 #" | sudo ldapmodify -x -D cn=admin,dc=hcoop,dc=net -y /etc/ldap.secret || \
35 # (echo Error modifying LDAP entry && exit 3 )
38 # Now set the password
40 if test -z "$INITPW"; then
41 echo "Skipping password set from $PWFILE (doesn't exist or permission denied)"
44 echo Setting password from database
46 sudo sh
-c "echo $INITPW | tee -| /afs/hcoop.net/common/etc/scripts/change-user-password $USERNM" || \
47 ( echo "echo XXX | tee - | change-user-password $USERNM failed" && exit 5 )
52 # Set email forwarding
54 if test -z "$EMAILADDR"; then
55 echo "Skipping email forwarding, no email address was specified."
57 echo setting email forward to
"$EMAILADDR"
58 FORWARD_PATH
=$
(sh
-c "echo ~$USERNM/.public/.forward")
59 echo "$EMAILADDR" > $FORWARD_PATH || \
60 ( echo "Failed to set forward address" && exit 6 )
61 chown
$USERNM $FORWARD_PATH