1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/libreerp_ynh.git synced 2024-09-03 19:36:13 +02:00

[fix] could not change directory to /root: Permission denied

This commit is contained in:
ljf 2016-12-14 13:44:39 +01:00
parent 9b6aaec88a
commit d27dc888f2

View file

@ -27,7 +27,7 @@ PKGDIR=$(cd ../; pwd)
# | arg: sql - the SQL command to execute # | arg: sql - the SQL command to execute
# | arg: db - the database to connect to # | arg: db - the database to connect to
ynh_psql_execute_as_root () { ynh_psql_execute_as_root () {
sudo su -c "psql" postgres <<< ${1} sudo su -c "psql" - postgres <<< ${1}
} }
# Create a user # Create a user
@ -51,9 +51,9 @@ ynh_psql_create_db() {
# grant all privilegies to user # grant all privilegies to user
if [[ $# -gt 1 ]]; then if [[ $# -gt 1 ]]; then
ynh_psql_create_user ${2} "${3}" ynh_psql_create_user ${2} "${3}"
sudo su -c "createdb -O ${2} $db" postgres sudo su -c "createdb -O ${2} $db" - postgres
else else
sudo su -c "createdb $db" postgres sudo su -c "createdb $db" - postgres
fi fi
} }
@ -63,7 +63,7 @@ ynh_psql_create_db() {
# usage: ynh_psql_drop_db db # usage: ynh_psql_drop_db db
# | arg: db - the database name to drop # | arg: db - the database name to drop
ynh_psql_drop_db() { ynh_psql_drop_db() {
sudo su -c "dropdb ${1}" postgres sudo su -c "dropdb ${1}" - postgres
} }
# Drop a user # Drop a user
@ -71,7 +71,7 @@ ynh_psql_drop_db() {
# usage: ynh_psql_drop_user user # usage: ynh_psql_drop_user user
# | arg: user - the user name to drop # | arg: user - the user name to drop
ynh_psql_drop_user() { ynh_psql_drop_user() {
sudo su -c "dropuser ${1}" postgres sudo su -c "dropuser ${1}" - postgres
} }