From fd16dedd2c9074d4a08b54714009387ba0b3c98b Mon Sep 17 00:00:00 2001 From: Anmol Date: Sat, 22 Jul 2017 03:54:08 +0530 Subject: [PATCH] Resloved issue https://github.com/YunoHost-Apps/hubzilla_ynh/issues/17 and removed asking of is_public,admin_email and set path to root by default --- manifest.json | 37 ------------------------------------- scripts/install | 24 +++++------------------- scripts/remove | 8 -------- scripts/restore | 23 +++++------------------ scripts/upgrade | 22 ++-------------------- 5 files changed, 12 insertions(+), 102 deletions(-) diff --git a/manifest.json b/manifest.json index c3ac1a4d..946de185 100644 --- a/manifest.json +++ b/manifest.json @@ -32,16 +32,6 @@ "fr": "Indiquez un domain pour Hubzilla. Hubzilla doit être installé à la racine du domaine. Cela implique qu'aucune autre app ne pourra être installée ou accessible sur ce domain. Nous conseillons un sous-domaine dédié par exemple hubzilla.domain.tld." } }, - { - "name": "path", - "type": "path", - "ask": { - "en": "No choice, Hubzilla must be installed on the ROOT domain, so be careful", - "fr": "Pas de choix, Hubzilla doit etre installe a la racine, soyez prudent" - }, - "choices": ["/"], - "default": "/" - }, { "name": "admin", "type": "user", @@ -50,15 +40,6 @@ "fr": "Choisissez l'administrateur de Hubzilla (doit être un utilisateur YunoHost existant)" } }, - { - "name": "email", - "ask": { - "en": "Email address for the Hubzilla hub admin", - "fr": "Adresse email pour l'admin du hub Hubzilla" - }, - "example": "peter@example.com", - "optional": false - }, { "name": "upload", "ask": { @@ -68,24 +49,6 @@ "choices": ["64M", "128M", "256M", "512M", "1024M"], "default": "256M", "optional": false - }, - { - "name": "is_public", - "ask": { - "en": "Is it a public website ?", - "fr": "Est-ce un site publique ?" - }, - "choices": ["Yes", "No"], - "default": "Yes" - }, - { - "name": "run_exec", - "ask": { - "en": "Do you agree to modify php.ini to allow exec() function to be used by hubzilla ?", - "fr": "Acceptez-vous de modifier php.ini pour autoriser exec() à être utilisée par hubzilla ?" - }, - "choices": ["Yes", "No"], - "default": "No" } ] } diff --git a/scripts/install b/scripts/install index 143b5781..fa44c7a7 100755 --- a/scripts/install +++ b/scripts/install @@ -8,12 +8,10 @@ TRAP_ON # Active trap pour arrêter le script si une erreur est détectée. app=$YNH_APP_INSTANCE_NAME domain=$YNH_APP_ARG_DOMAIN -path=$YNH_APP_ARG_PATH +path="/" admin=$YNH_APP_ARG_ADMIN -email=$YNH_APP_ARG_EMAIL +email=$(sudo yunohost user info $admin | grep "mail:" | cut -d' ' -f2) upload=$YNH_APP_ARG_UPLOAD -is_public=$YNH_APP_ARG_IS_PUBLIC -run_exec=$YNH_APP_ARG_RUN_EXEC # Source app helpers source /usr/share/yunohost/helpers @@ -37,7 +35,6 @@ ynh_app_setting_set $app path $path ynh_app_setting_set $app admin $admin ynh_app_setting_set $app email $email ynh_app_setting_set $app upload $upload -ynh_app_setting_set $app is_public $is_public # Install dependencies sudo apt-get update @@ -101,13 +98,6 @@ sudo cp ../conf/nginx.conf $nginxconf sudo chown root: $nginxconf sudo chmod 600 $nginxconf -# Modify php.ini to allow exec() function and increase the upload size limits -if [ "$run_exec" = "Yes" ]; -then - sudo sed -i 's/pcntl_exec//g' /etc/php5/fpm/php.ini -else - echo "no modification of php.ini" -fi # Dedicated php-fpm sed -i "s@UPLOADTOCHANGE@$upload@g" ../conf/php-fpm.conf sed -i "s@NAMETOCHANGE@$app@g" ../conf/php-fpm.conf @@ -120,13 +110,9 @@ sudo chmod 644 $phpfpmconf sed -i "s@YNH_WWW_PATH@$final_path@g" ../conf/poller-cron sudo cp ../conf/poller-cron /etc/cron.d/$app -# Make app public if necessary -if [ "$is_public" = "Yes" ]; -then - ynh_app_setting_set $app skipped_uris "/" -else - ynh_app_setting_set $app protected_uris "/" -fi +# Make app public +ynh_app_setting_set $app skipped_uris "/" + # Reload services diff --git a/scripts/remove b/scripts/remove index 911e96a5..2a367e53 100755 --- a/scripts/remove +++ b/scripts/remove @@ -10,7 +10,6 @@ source /usr/share/yunohost/helpers domain=$(ynh_app_setting_get $app domain) db_user=$(ynh_app_setting_get $app db_user) -run_exec=$(ynh_app_setting_get $app run_exec) REMOVE_BDD $db_user # Suppression de la base de donnée et de l'utilisateur associé. @@ -23,13 +22,6 @@ REMOVE_FPM_CONF # Suppression de la configuration du pool php-fpm # Remove poller cron job sudo rm -f /etc/cron.d/$app -# Restore php.ini as it was before installing hubzilla -if [ "$run_exec" = "Yes" ]; -then - sudo sed -i 's/,,/,pcntl_exec,/g' /etc/php5/fpm/php.ini -else - echo "no modification of php.ini" -fi # Reload services after cleaning sudo service php5-fpm reload diff --git a/scripts/restore b/scripts/restore index 386203ee..c381b7b5 100644 --- a/scripts/restore +++ b/scripts/restore @@ -8,12 +8,10 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) path=$(ynh_app_setting_get $app path) -is_public=$(ynh_app_setting_get $app is_public) admin=$(ynh_app_setting_get $app admin) final_path=$(ynh_app_setting_get $app final_path) db_user=$(ynh_app_setting_get $app db_user) db_pwd=$(ynh_app_setting_get $app db_pwd) -run_exec=$(ynh_app_setting_get $app run_exec) if [ -d $final_path ]; then echo "There is already a directory: $final_path " >&2 @@ -38,30 +36,19 @@ sudo cp -a ./sources/. $final_path/ ynh_mysql_create_db $db_user $db_user $db_pwd mysql --debug-check -u $db_user -p$db_pwd $db_user < ./backupdb.sql -# Modify php.ini to allow exec() function and increase the upload size limits -if [ "$run_exec" = "Yes" ]; -then - sudo sed -i 's/pcntl_exec//g' /etc/php5/fpm/php.ini -else - echo "no modification of php.ini" -fi + # Copy dedicated php-fpm process from backup folder to the right location sudo cp -a ./php-fpm.conf /etc/php5/fpm/pool.d/$app.conf -# Backup cron job +# Restore cron job sudo cp -a ./cron.job /etc/cron.d/$app -# Make app public if necessary -if [ "$is_public" = "Yes" ]; -then - ynh_app_setting_set $app skipped_uris "/" -else - ynh_app_setting_set $app protected_uris "/" -fi +# Make app public +ynh_app_setting_set $app skipped_uris "/" + # And Reload services sudo service php5-fpm reload sudo service nginx reload sudo yunohost app ssowatconf - diff --git a/scripts/upgrade b/scripts/upgrade index 98a24899..1b8bf77e 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -10,14 +10,8 @@ source /usr/share/yunohost/helpers domain=$(ynh_app_setting_get $app domain) path=$(ynh_app_setting_get $app path) -is_public=$(ynh_app_setting_get $app is_public) -admin=$(ynh_app_setting_get $app admin) final_path=$(ynh_app_setting_get $app final_path) -db_pwd=$(ynh_app_setting_get $app db_pwd) -db_user=$(ynh_app_setting_get $app db_user) -email=$(ynh_app_setting_get $app email) upload=$(ynh_app_setting_get $app upload) -run_exec=$(ynh_app_setting_get $app run_exec) CHECK_PATH # Vérifie et corrige la syntaxe du path. @@ -62,13 +56,6 @@ sudo cp ../conf/nginx.conf $nginxconf sudo chown root: $nginxconf sudo chmod 600 $nginxconf -# Modify php.ini to allow exec() function and increase the upload size limits -if [ "$run_exec" = "Yes" ]; -then - sudo sed -i 's/pcntl_exec//g' /etc/php5/fpm/php.ini -else - echo "no modification of php.ini" -fi # Dedicated php-fpm sed -i "s@UPLOADTOCHANGE@$upload@g" ../conf/php-fpm.conf sed -i "s@NAMETOCHANGE@$app@g" ../conf/php-fpm.conf @@ -80,13 +67,8 @@ sudo chown root: $phpfpmconf sed -i "s@YNH_WWW_PATH@$final_path@g" ../conf/poller-cron sudo cp ../conf/poller-cron /etc/cron.d/$app -# Make app public if necessary -if [ "$is_public" = "Yes" ]; -then - ynh_app_setting_set $app skipped_uris "/" -else - ynh_app_setting_set $app protected_uris "/" -fi +# Make app public +ynh_app_setting_set $app skipped_uris "/" # Reload services sudo service php5-fpm reload || true