Change MySQL script to follow multi-level directory scheme
[hcoop/domtool2.git] / src / plugins / domtool-mysql
index 48af512..c7aac5f 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh -e
+#!/bin/bash -e
 
 case $1 in
        adduser)
@@ -19,12 +19,12 @@ case $1 in
                USERNAME=$2
                DBNAME_BASE=$3
                DBNAME="${USERNAME}_${DBNAME_BASE}"
-               DIR=/afs/hcoop.net/common/databases/$USERNAME/mysql
+               DIR=/afs/hcoop.net/common/databases/${USERNAME:0:1}/${USERNAME:0:2}/$USERNAME/mysql
 
                kinit -k -t /etc/keytabs/root.admin.keytab root/admin
                aklog
 
-               if ! -d $DIR; then
+               if [ ! -d $DIR ]; then
                        echo WARNING: $DIR must already exist!
                fi