From d27dc888f2ef14b2f45e1d2975edf937a4763cf6 Mon Sep 17 00:00:00 2001 From: ljf Date: Wed, 14 Dec 2016 13:44:39 +0100 Subject: [PATCH] [fix] could not change directory to /root: Permission denied --- scripts/_common.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index a673a1a..7ca8ef5 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -27,7 +27,7 @@ PKGDIR=$(cd ../; pwd) # | arg: sql - the SQL command to execute # | arg: db - the database to connect to ynh_psql_execute_as_root () { - sudo su -c "psql" postgres <<< ${1} + sudo su -c "psql" - postgres <<< ${1} } # Create a user @@ -51,9 +51,9 @@ ynh_psql_create_db() { # grant all privilegies to user if [[ $# -gt 1 ]]; then ynh_psql_create_user ${2} "${3}" - sudo su -c "createdb -O ${2} $db" postgres + sudo su -c "createdb -O ${2} $db" - postgres else - sudo su -c "createdb $db" postgres + sudo su -c "createdb $db" - postgres fi } @@ -63,7 +63,7 @@ ynh_psql_create_db() { # usage: ynh_psql_drop_db db # | arg: db - the database name to drop ynh_psql_drop_db() { - sudo su -c "dropdb ${1}" postgres + sudo su -c "dropdb ${1}" - postgres } # Drop a user @@ -71,7 +71,7 @@ ynh_psql_drop_db() { # usage: ynh_psql_drop_user user # | arg: user - the user name to drop ynh_psql_drop_user() { - sudo su -c "dropuser ${1}" postgres + sudo su -c "dropuser ${1}" - postgres }