diff --git a/README.md b/README.md index 4fe4817..6d5b174 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Mastodon est un réseau social gratuit et open source. Une alternative décentra ### Mise à jour -`$ sudo yunohost app upgrade --verbose mastodon -u https://github.com/YunoHost-Apps/mastoron_ynh.git` +`$ sudo yunohost app upgrade --verbose mastodon -u https://github.com/YunoHost-Apps/mastodon_ynh.git` ## What is Mastodon? @@ -25,8 +25,8 @@ Mastodon is a free, open-source social network. A decentralized alternative to c ### Install -`$ sudo yunohost app install https://github.com/YunoHost-Apps/mastoron_ynh.git` +`$ sudo yunohost app install https://github.com/YunoHost-Apps/mastodon_ynh.git` ### Update -`$ sudo yunohost app upgrade --verbose mastoron -u https://github.com/YunoHost-Apps/mastoron_ynh.git` \ No newline at end of file +`$ sudo yunohost app upgrade --verbose mastodon -u https://github.com/YunoHost-Apps/mastodon_ynh.git` diff --git a/scripts/.fonctions b/scripts/.fonctions index 59e4f46..8abb720 100644 --- a/scripts/.fonctions +++ b/scripts/.fonctions @@ -176,6 +176,15 @@ ynh_psql_create_user() { "CREATE USER ${1} WITH PASSWORD '${2}';" } +# Create a user without password +# +# usage: ynh_mysql_create_user user pwd [host] +# | arg: user - the user name to create +ynh_psql_create_user_without_password() { + sudo su -c "psql" postgres <<< \ + "CREATE USER ${1};" +} + # Create a database and grant optionnaly privilegies to a user # # usage: ynh_mysql_create_db db [user [pwd]] @@ -217,4 +226,4 @@ ynh_psql_drop_db() { # | arg: user - the user name to drop ynh_psql_drop_user() { sudo su -c "dropuser ${1}" postgres -} \ No newline at end of file +} diff --git a/scripts/install b/scripts/install index d8c61b7..6a1fe20 100644 --- a/scripts/install +++ b/scripts/install @@ -70,32 +70,35 @@ sudo apt-get -y install nodejs # Install Yarn ynh_package_install yarn -# sudo npm install -g yarn # Set UTF8 encoding by default -# Bug: Warning: PG::InsufficientPrivilege: ERROR: permission denied to copy database "template1" -# Exec db:setup -# sudo su -c "psql" postgres <<< \ -# "update pg_database set datistemplate='false' where datname='template1';"\ -# "drop database template1;"\ -# "create database template1 encoding='UTF8' template template0;"\ -# "update pg_database set datistemplate='true' where datname='template1';" +sudo su -c "psql" postgres <<< \ + "update pg_database set datistemplate='false' where datname='template1';" +sudo su -c "psql" postgres <<< \ + "drop database template1;" +sudo su -c "psql" postgres <<< \ + "create database template1 encoding='UTF8' template template0;" +sudo su -c "psql" postgres <<< \ + "update pg_database set datistemplate='true' where datname='template1';" # Create DB without password ynh_psql_create_db_without_password "$app" sudo systemctl restart postgresql # Download all Ruby source -sudo git clone https://github.com/rbenv/rbenv.git $final_path/.rbenv -sudo git clone https://github.com/rbenv/ruby-build.git $final_path/.rbenv/plugins/ruby-build +sudo su - $app <