mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
owncloud: Make setup more robust to repeatition
Create postgresql user and set password in two steps instead of one. This ensures that if a user already exists for some reason (setup already run), then re-running will simply set a new password and generates a new configuration. Otherwise, the user creation setup having failed because of existing user will also fail to set new password and the generated configuration is not usable.
This commit is contained in:
parent
d8ba09eb74
commit
2dd303e9ac
@ -66,7 +66,9 @@ if [ "$owncloud_enable" != "$owncloud_enable_cur" ] ; then
|
||||
if [ $db_in_config -eq 0 -a $db_in_autoconfig -eq 0 ] ; then
|
||||
# Set up postgresql database and user
|
||||
dbpwd=$(pwgen -1 30)
|
||||
su - postgres -c "psql -c \"CREATE USER owncloud WITH NOCREATEDB NOCREATEUSER ENCRYPTED PASSWORD '$dbpwd'\"" \
|
||||
su - postgres -c "psql -c \"CREATE USER owncloud WITH NOCREATEDB NOCREATEUSER\"" \
|
||||
2>&1 | logger -t owncloud-setup
|
||||
su - postgres -c "psql -c \"ALTER USER owncloud ENCRYPTED PASSWORD '$dbpwd'\"" \
|
||||
2>&1 | logger -t owncloud-setup
|
||||
su - postgres -c "createdb --owner owncloud owncloud" \
|
||||
2>&1 | logger -t owncloud-setup
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user