bc2ca60cca0a8c167b7b971f96de9a346a50796a
3 # DO NOT EXECUTE DIRECTLY
4 # This is only to be executed by create-user
7 # (If it's not clear, for user fred, PATHBITS = f/fr/fred)
8 PATHBITS
=`echo $USER | head -c 1`/`echo $USER | head -c 2`/$USER
9 DBPATH
=/srv
/databases
/$PATHBITS
10 PGDIR
=$DBPATH/postgres
11 MYSQLDIR
=$DBPATH/mysql
13 # Create postgres user and tablespace placeholder within volume
14 # FIXME: This assumes the status-quo of database accounts not being
15 # removed by destroy-user...
16 if ! test -d $PGDIR; then
18 chown postgres
:postgres
$PGDIR
19 sudo
-u postgres psql
-c "CREATE TABLESPACE \"user_$USER\" OWNER postgres LOCATION '$PGDIR'" template1
22 # Create mysql user and databases placeholder within volume
23 # FIXME: Same as postgres...
24 if ! test -d $MYSQLDIR; then
26 chown mysql
:mysql
$MYSQLDIR