create-user: misc updates for Debian Stretch / server changes
authorClinton Ebadi <clinton@hcoop.net>
Sat, 5 Jan 2019 18:15:40 +0000 (13:15 -0500)
committerClinton Ebadi <clinton@hcoop.net>
Sat, 5 Jan 2019 18:15:40 +0000 (13:15 -0500)
Specify postgres host instead of assuming we are running on the
postgres server.

Use printf instead of "tee -i" to double output when setting initial
password; newer sudo barfs with permission denied on /dev/stdout (and
printf makes it clearer anyway).

Gitweb symlink creation was cruft, a cron on the webserver manages the
symlinks automatically.

And don't check for volume sync from outpost, it is not running
openafs-fileserver (just the afs db servers).

create-user-database
lib/create-user-lib.sh
new-user

index ce65464..89eecaf 100755 (executable)
@@ -19,7 +19,7 @@ if ! test -d $PGNEWDIR; then
   mkdir -p $PGNEWDIR
   chown postgres:postgres $PGNEWDIR
   chmod 700 $PGNEWDIR
-  sudo -u postgres psql --cluster 9.1/main -c "CREATE TABLESPACE \"user_$USER\" OWNER postgres LOCATION '$PGNEWDIR'" template1
+  sudo -u postgres psql --cluster 9.6/main -c "CREATE TABLESPACE \"user_$USER\" OWNER postgres LOCATION '$PGNEWDIR'" template1
 fi
 
 # Create mysql user and databases placeholder within volume
index 716d0da..fc59d0c 100644 (file)
@@ -240,11 +240,6 @@ function seed_user_hcoop_directories () {
         # ^^ work around sudo env_reset crap without having to
         # actually figure out how to make it work cleanly -- clinton,
         # 2011-11-30
-
-    # Gitweb hosting
-    test -L /var/cache/git/$NEWUSER || \
-       sudo ln -s $HOMEPATH/.hcoop-git /var/cache/git/$NEWUSER
-
 }
 
 #
@@ -283,7 +278,7 @@ function ensure_afs_servers_synced () {
     
     # technically this might not be necessary, but for good measure...
     local srv
-    for srv in gibran lovelace outpost; do
+    for srv in gibran lovelace; do
        vos syncserv $srv
        vos syncvldb $srv
     done
index 86a5692..bf3ca2e 100755 (executable)
--- a/new-user
+++ b/new-user
@@ -14,7 +14,7 @@ if test -z "$REALNM"; then
        exit 1
 fi
 
-INITPW=$(sudo -u hcoop psql -p 5433 hcoop_portal3 -tc "select unix_passwd from MemberApp where name = '${USERNM}' order by id desc limit 1;")
+INITPW=$(sudo -u hcoop psql -h postgres -p 5433 hcoop_portal3 -tc "select unix_passwd from MemberApp where name = '${USERNM}' order by id desc limit 1;")
 
 
 #
@@ -43,7 +43,7 @@ if test -z "$INITPW"; then
 else
        echo Setting password from database
        actual_user=`whoami`
-       sudo sh -c "echo $INITPW | tee -| /afs/hcoop.net/common/etc/scripts/change-user-password $USERNM" || \
+       sudo sh -c "printf '%s\n%s\n' $INITPW $INITPW  | /afs/hcoop.net/common/etc/scripts/change-user-password $USERNM" || \
        ( echo "echo XXX | tee - | change-user-password $USERNM failed" && exit 5 )
 fi