#!/bin/bash #================================================= # GENERIC STARTING #================================================= # IMPORT GENERIC HELPERS #================================================= source scripts/_common.sh source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= # Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS #================================================= app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF ARGUMENTS ARE CORRECT #================================================= #================================================= # CHECK IF AN ACTION HAS TO BE DONE #================================================= # Check the dependencies of the meta packages of Etherpad MyPads with apt-cache if apt-cache depends ${app//_/-}-ynh-deps | grep --quiet libreoffice-writer then # LibreOffice is already a dependence of Etherpad myPads. # LibreOffice should be removed. libreoffice=0 action1=removed action2=Removing else # LibreOffice isn't a dependence of Etherpad MyPads. # LibreOffice should be installed. libreoffice=1 action1=installed action2=Installing fi ynh_print_info --message="LibreOffice will be $action1." if apt-cache depends ${app//_/-}-ynh-deps | grep --quiet abiword then # Abiword is already a dependence of Etherpad MyPads. # Keep it abiword=1 else # Abiword isn't a dependence of Etherpad MyPads. # Do not add it abiword=0 fi #================================================= # SPECIFIC ACTION #================================================= # INSTALL OR REMOVE LIBREOFFICE #================================================= ynh_script_progression --message="$action2 LibreOffice..." --weight=3 dependencies="" if [ $libreoffice -eq 1 ] then # Add LibreOffice dependencies if LibreOffice has to be installed dependencies="$dependencies $libreoffice_app_dependencies" fi if [ $abiword -eq 1 ] then # Add Abiword dependencies if abiword is already installed to keep it as a dependence. dependencies="$dependencies $abiword_app_depencencies" fi # Rebuild the meta package and install the new dependencies ( cd scripts # Move to scripts directory to allow the helper to find the manifest where it expects to find it. ynh_exec_warn_less ynh_install_app_dependencies $dependencies) # Remove all unused dependencies ynh_package_autopurge #================================================= # SET THE DEFAULT EXPORT APP #================================================= if [ $libreoffice -eq 1 ] then # Set LibreOffice as default export app yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=libreoffice" elif [ $abiword -eq 1 ] then # Set Abiword as default export app yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=abiword" else # Remove any export app yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=none" fi #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Execution completed" --last