diff --git a/README.md b/README.md index d5d3a71..d527a1d 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,6 @@ Ce package etherpad utilise les mêmes plugins que [Framapad](https://framapad.o http://etherpad.org/ https://git.framasoft.org/framasoft/ep_mypads -Le script installe les paquets *npm* et *nodejs-legacy*, ainsi que *abiword* si l'option est selectionnée. - **En raison du plugin mypads, cette version d'etherpad doit être installée à la racine d'un domaine ou d'un sous-domaine dédié. Autrement, mypads sera inaccessible.** **Mise à jour du package:** diff --git a/check_process b/check_process index 13a5b5c..3397437 100644 --- a/check_process +++ b/check_process @@ -1,4 +1,4 @@ -;; Test complet +;; Test complet avec libreoffice auto_remove=1 ; Manifest domain="domain.tld" (DOMAIN) @@ -6,7 +6,7 @@ password="password" language="en" is_public=1 (PUBLIC|public=1|private=0) - abiword="0" + export="libreoffice" ; Checks pkg_linter=1 setup_sub_dir=0 @@ -28,7 +28,18 @@ password="password" language="en" is_public=1 (PUBLIC|public=1|private=0) - abiword="1" + export="abiword" + ; Checks + setup_root=1 +;; Test sans export + auto_remove=1 + ; Manifest + domain="domain.tld" (DOMAIN) + admin="john" (USER) + password="password" + language="en" + is_public=1 (PUBLIC|public=1|private=0) + export="none" ; Checks setup_root=1 ;;; Levels diff --git a/manifest.json b/manifest.json index 0807658..22db95c 100644 --- a/manifest.json +++ b/manifest.json @@ -68,13 +68,14 @@ }, "default": true }, + { "name": "export", "ask": { - "en": "Choose abiword or libreoffice (more stable)", - "fr": "Choisissez abiword ou libreoffice (plus stable)" + "en": "Use abiword (~260Mo) or libreoffice (~400Mo) (more stable) to expand export possibilities (pdf, doc) ?", + "fr": "Utiliser abiword (~260Mo) ou libre office (~400Mo) (plus stable) pour étendre les possibilités d'export (pdf, doc) ?" }, - "choices" : ["abiword", "libreoffice"], - "default" : "libreoffice" + "choices" : ["none", "abiword", "libreoffice"], + "default" : "none" } ] } diff --git a/scripts/install b/scripts/install index 00b27ac..37d1cbe 100644 --- a/scripts/install +++ b/scripts/install @@ -82,17 +82,12 @@ ynh_app_setting_set $app port $port # INSTALL DEPENDENCIES #================================================= -if [ $export -eq 1 ] -then +if [ "$export" = "abiword" ]; then ynh_install_app_dependencies abiword - +elif [ "$export" = "libreoffice" ]; then + ynh_install_app_dependencies unoconv libreoffice-writer fi -if [ $export -eq 2 ] -then - ynh_install_app_dependencies unoconv libreoffice-writer - -fi #================================================= # INSTALL NODEJS #================================================= @@ -124,7 +119,7 @@ ynh_nginx_config # CREATE DEDICATED USER #================================================= -ynh_system_user_create $app /home/$app # Créer un utilisateur système dédié à l'app +ynh_system_user_create $app $final_path # Créer un utilisateur système dédié à l'app #================================================= # SPECIFIC SETUP @@ -163,13 +158,11 @@ ynh_replace_string "__DB_USER__" "$db_name" "$final_path/credentials.json" ynh_replace_string "__DB_PWD__" "$db_pwd" "$final_path/credentials.json" ynh_replace_string "__ADMIN__" "$admin" "$final_path/credentials.json" ynh_replace_string "__PASSWD__" "$password" "$final_path/credentials.json" -if [ "$export" -eq 1 ] +if [ "$export" = "abiword" ] then abiword_path=`which abiword` # Récupère l'emplacement de l'exécutable de abiword ynh_replace_string "\"abiword\" : null" "\"abiword\" : \"$abiword_path\"" "$final_path/settings.json" # Renseigne l'emplacement de abiword dans la config de etherpad -fi - -if [ "$export" -eq 2 ] +elif [ "$export" = "libreoffice" ] then soffice_path=`which soffice` # Récupère l'emplacement de l'exécutable de abiword ynh_replace_string "\"soffice\" : null" "\"soffice\" : \"$soffice_path\"" "$final_path/settings.json" # Renseigne l'emplacement de abiword dans la config de etherpad @@ -223,7 +216,6 @@ sudo_path npm install ep_page_view >> $install_log 2>&1 # Framapad - Add support sudo_path npm install ep_spellcheck >> $install_log 2>&1 # Framapad - Add support to do 'Spell checking' sudo_path npm install ep_subscript_and_superscript >> $install_log 2>&1 # Framapad - Add support for Subscript and Superscript sudo_path npm install ep_table_of_contents >> $install_log 2>&1 # Framapad - View a table of contents for your pad -# sudo_path npm install ep_unoconv" # Framapad - Use unoconv instead of abiword to export pads. sudo_path npm install ep_user_font_size >> $install_log 2>&1 # Framapad - User Pad Contents font size can be set in settings, this does not effect other peoples views sudo chown -R $app: $final_path/node_modules diff --git a/scripts/remove b/scripts/remove index 890fa0d..9c06770 100755 --- a/scripts/remove +++ b/scripts/remove @@ -18,7 +18,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) port=$(ynh_app_setting_get $app port) db_name=$(ynh_app_setting_get $app db_name) -abiword=$(ynh_app_setting_get $app abiword) +export=$(ynh_app_setting_get $app export) #================================================= # STANDARD REMOVE @@ -42,7 +42,7 @@ fi # REMOVE DEPENDENCIES #================================================= -if [ $abiword -eq 1 ] +if [ "$export" != "none" ] then ynh_remove_app_dependencies fi diff --git a/scripts/restore b/scripts/restore index d113f3d..81a7941 100644 --- a/scripts/restore +++ b/scripts/restore @@ -31,7 +31,7 @@ domain=$(ynh_app_setting_get $app domain) path_url=$(ynh_app_setting_get $app path_url) final_path=$(ynh_app_setting_get $app final_path) db_name=$(ynh_app_setting_get $app db_name) -abiword=$(ynh_app_setting_get $app abiword) +export=$(ynh_app_setting_get $app export) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -68,7 +68,7 @@ ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql # RECREATE OF THE DEDICATED USER #================================================= -ynh_system_user_create $app /home/$app # Recreate the dedicated user, if not exist +ynh_system_user_create $app $final_path # Recreate the dedicated user, if not exist #================================================= # SPECIFIC RESTORE @@ -90,9 +90,10 @@ ynh_restore_file "/etc/logrotate.d/$app" # INSTALL DEPENDENCIES #================================================= -if [ $abiword -eq 1 ] -then +if [ "$export" = "abiword" ]; then ynh_install_app_dependencies abiword +elif [ "$export" = "libreoffice" ]; then + ynh_install_app_dependencies unoconv libreoffice-writer fi #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 7b02bd1..e1d0055 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,7 +21,7 @@ language=$(ynh_app_setting_get $app language) is_public=$(ynh_app_setting_get $app is_public) final_path=$(ynh_app_setting_get $app final_path) port=$(ynh_app_setting_get $app port) -abiword=$(ynh_app_setting_get $app abiword) +export=$(ynh_app_setting_get $app export) db_name=$(ynh_app_setting_get $app db_name) #================================================= @@ -46,6 +46,19 @@ if [ -z $abiword ]; then # Si abiword n'est pas renseigné dans app setting ynh_app_setting_set $app abiword $abiword fi +if [ -n $abiword ]; then # Si abiword est renseigné dans app setting + if [ $abiword -eq 1 ]; then + export=abiword + fi + ynh_app_setting_set $app export $export + ynh_app_setting_delete $app abiword +fi + +if [ -z $export ]; then # Si export n'est pas renseigné dans app setting + export=none + ynh_app_setting_set $app export $export +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -114,10 +127,14 @@ password=$(ynh_app_setting_get $app password) ynh_replace_string "__DB_PWD__" "$db_pwd" "$final_path/credentials.json" ynh_replace_string "__ADMIN__" "$admin" "$final_path/credentials.json" ynh_replace_string "__PASSWD__" "$password" "$final_path/credentials.json" -if [ $abiword -eq 1 ] +if [ "$export" = "abiword" ] then abiword_path=`which abiword` # Récupère l'emplacement de l'exécutable de abiword ynh_replace_string "\"abiword\" : null" "\"abiword\" : \"$abiword_path\"" "$final_path/settings.json" # Renseigne l'emplacement de abiword dans la config de etherpad +elif [ "$export" = "libreoffice" ] +then + soffice_path=`which soffice` # Récupère l'emplacement de l'exécutable de abiword + ynh_replace_string "\"soffice\" : null" "\"soffice\" : \"$soffice_path\"" "$final_path/settings.json" # Renseigne l'emplacement de abiword dans la config de etherpad fi if test -z $language; then language=en # En cas d'upgrade d'une version ne gérant pas la langue, la langue est anglais par défaut @@ -131,7 +148,7 @@ ynh_store_file_checksum "$final_path/credentials.json" # Réenregistre la somme # CREATE DEDICATED USER #================================================= -ynh_system_user_create $app /home/$app # Create the dedicated user, if not exist +ynh_system_user_create $app $final_path # Create the dedicated user, if not exist #================================================= # SECURING FILES AND DIRECTORIES