#!/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 abiword then # Abiword is already a dependence of etherpad_mypads. # Abiword should be removed. abiword=0 action1=removed action2=Removing else # Abiword isn't a dependence of etherpad_mypads. # Abiword should be installed. abiword=1 action1=installed action2=Installing fi ynh_print_info --message="Abiword will be $action1." if apt-cache depends ${app//_/-}-ynh-deps | grep --quiet libreoffice-writer then # LibreOffice is already a dependence of Etherpad MyPads. # Keep it libreoffice=1 else # LibreOffice isn't a dependence of Etherpad MyPads. # Do not add it libreoffice=0 fi #================================================= # SPECIFIC ACTION #================================================= # INSTALL OR REMOVE ABIWORD #================================================= ynh_script_progression --message="$action2 AbiWord..." --weight=3 # Load common variables, and especially Abiword dependencies. source scripts/_variables dependencies="" if [ $abiword -eq 1 ] then # Add abiword dependencies if Abiword has to be installed dependencies="$dependencies $abiword_app_depencencies" fi if [ $libreoffice -eq 1 ] then # Add LibreOffice dependencies if LibreOffice is already installed to keep it as a dependence. dependencies="$dependencies $libreoffice_app_dependencies" 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 [ $abiword -eq 1 ] then # Set Abiword as default export app yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=abiword" elif [ $libreoffice -eq 1 ] then # Set LibreOffice as default export app yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=libreoffice" 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