diff --git a/scripts/_common.sh b/scripts/_common.sh index d36bede..adf100a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -341,47 +341,4 @@ ynh_backup_before_upgrade () { # Backup the current version of the app, restore else # Si le backup a échoué ynh_die "Backup failed, the upgrade process was aborted." fi -} - -# Define and install dependencies with a equivs control file -# This helper can/should only be called once per app -# -# usage: ynh_install_app_dependencies dep [dep [...]] -# | arg: dep - the package name to install in dependence -ynh_install_app_dependencies () { - dependencies=$@ - manifest_path="../manifest.json" - if [ ! -e "$manifest_path" ]; then - manifest_path="../settings/manifest.json" # Into the restore script, the manifest is not at the same place - fi - version=$(sudo grep '\"version\": ' "$manifest_path" | cut -d '"' -f 4) # Retrieve the version number in the manifest file. - dep_app=${app//_/-} # Replace all '_' by '-' - - if ynh_package_is_installed "${dep_app}-ynh-deps"; then - echo "A package named ${dep_app}-ynh-deps is already installed" >&2 - else - cat > ./${dep_app}-ynh-deps.control << EOF # Make a control file for equivs-build -Section: misc -Priority: optional -Package: ${dep_app}-ynh-deps -Version: ${version} -Depends: ${dependencies// /, } -Architecture: all -Description: Fake package for ${app} (YunoHost app) dependencies - This meta-package is only responsible of installing its dependencies. -EOF - ynh_package_install_from_equivs ./${dep_app}-ynh-deps.control \ - || ynh_die "Unable to install dependencies" # Install the fake package and its dependencies - ynh_app_setting_set $app apt_dependencies $dependencies - fi -} - -# Remove fake package and its dependencies -# -# Dependencies will removed only if no other package need them. -# -# usage: ynh_remove_app_dependencies -ynh_remove_app_dependencies () { - dep_app=${app//_/-} # Replace all '_' by '-' - ynh_package_autoremove ${dep_app}-ynh-deps # Remove the fake package and its dependencies if they not still used. } \ No newline at end of file diff --git a/scripts/install b/scripts/install index f6655b6..99e2cc6 100644 --- a/scripts/install +++ b/scripts/install @@ -42,10 +42,7 @@ grep -q -R 'jessie-backports' /etc/apt/sources.list{,.d} || { } # Install dependencies -ynh_install_app_dependencies php5-cli php5-common php5-intl php5-json \ - php5-mcrypt php-pear php-auth-sasl php-mail-mime php-patchwork-utf8 \ - php-net-smtp php-net-socket php-crypt-gpg \ - php-net-ldap2 php-net-ldap3 +ynh_package_install_from_equivs ../conf/${DEPS_PKG_NAME}.control # Create system user dedicace for this app ynh_system_user_create $app diff --git a/scripts/upgrade b/scripts/upgrade index 67b1956..fa4246e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -43,10 +43,7 @@ grep -q -R 'jessie-backports' /etc/apt/sources.list{,.d} || { } # Install dependencies -ynh_install_app_dependencies php5-cli php5-common php5-intl php5-json \ - php5-mcrypt php-pear php-auth-sasl php-mail-mime php-patchwork-utf8 \ - php-net-smtp php-net-socket php-crypt-gpg \ - php-net-ldap2 php-net-ldap3 +ynh_package_install_from_equivs ../conf/${DEPS_PKG_NAME}.control # Create system user dedicace for this app ynh_system_user_create $app