From 2cef464c6ba44226baf0a1f0f6a512145b3929ea Mon Sep 17 00:00:00 2001 From: magikcypress Date: Sat, 29 Apr 2017 16:00:41 +0200 Subject: [fix] restore script --- scripts/restore | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) (limited to 'scripts/restore') diff --git a/scripts/restore b/scripts/restore index f754d81..70b876b 100644 --- a/scripts/restore +++ b/scripts/restore @@ -24,7 +24,7 @@ is_public=$(ynh_app_setting_get $app is_public) # Check domain/path availability sudo yunohost app checkurl "${domain}${path}" -a "$app" \ - || ynh_die "Path not available: ${domain}${path}" + || ynh_die "Path not available: ${domain}${path}" # Check $final_path final_path="/opt/${app}" @@ -66,29 +66,33 @@ fi sudo adduser $app --home /opt/$app --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password --disabled-login # Restore sources & data -sudo cp -a ./sources "$final_path" +sudo cp -a ./sources/. "$final_path" # Set permissions sudo chown -R $app: "$final_path" +sudo ls -alh "$final_path" + +# Change directory for create user & database postgresql + # Set UTF8 encoding by default sudo su -c "psql" postgres <<< \ - "update pg_database set datistemplate='false' where datname='template1';" + "update pg_database set datistemplate='false' where datname='template1';" sudo su -c "psql" postgres <<< \ - "drop database template1;" + "drop database template1;" sudo su -c "psql" postgres <<< \ - "create database template1 encoding='UTF8' template template0;" + "create database template1 encoding='UTF8' template template0;" sudo su -c "psql" postgres <<< \ - "update pg_database set datistemplate='true' where datname='template1';" + "update pg_database set datistemplate='true' where datname='template1';" -# Restore db +# Create user for db postgresql ynh_psql_create_db_without_password "$app" -sudo su - postgres <