From ab2b7db0cfd452fc15d2a3634bd55eae3e6e6b39 Mon Sep 17 00:00:00 2001 From: Josue-T Date: Fri, 13 Apr 2018 14:31:36 +0200 Subject: [PATCH] Trigger error if app dependency install fails (Redmine 1006) + allow for 'or' in dependencies (#381) * Solve issue https://dev.yunohost.org/issues/1006 I purpose this change to improve the helper 'ynh_install_app_dependencies'. Before this change if the dependences are not installable the install didn't fail. By these change the helper generate an error and the install stop. * Get the error if apt fail * Remove old change * Add dependence choice --- data/helpers.d/package | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/data/helpers.d/package b/data/helpers.d/package index 4d147488c..a1d29651e 100644 --- a/data/helpers.d/package +++ b/data/helpers.d/package @@ -109,7 +109,7 @@ ynh_package_install_from_equivs () { && equivs-build ./control 1>/dev/null \ && sudo dpkg --force-depends \ -i "./${pkgname}_${pkgversion}_all.deb" 2>&1 \ - && ynh_package_install -f) + && ynh_package_install -f) || ynh_die "Unable to install dependencies" [[ -n "$TMPDIR" ]] && rm -rf $TMPDIR # Remove the temp dir. # check if the package is actually installed @@ -121,8 +121,13 @@ ynh_package_install_from_equivs () { # # usage: ynh_install_app_dependencies dep [dep [...]] # | arg: dep - the package name to install in dependence +# You can give a choice between some package with this syntax : "dep1|dep2" +# Example : ynh_install_app_dependencies dep1 dep2 "dep3|dep4|dep5" +# This mean in the dependence tree : dep1 & dep2 & (dep3 | dep4 | dep5) ynh_install_app_dependencies () { local dependencies=$@ + local dependencies=${dependencies// /, } + local dependencies=${dependencies//|/ | } local 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 @@ -139,7 +144,7 @@ Section: misc Priority: optional Package: ${dep_app}-ynh-deps Version: ${version} -Depends: ${dependencies// /, } +Depends: ${dependencies} Architecture: all Description: Fake package for ${app} (YunoHost app) dependencies This meta-package is only responsible of installing its dependencies. @@ -158,4 +163,4 @@ EOF ynh_remove_app_dependencies () { local dep_app=${app//_/-} # Replace all '_' by '-' ynh_package_autopurge ${dep_app}-ynh-deps # Remove the fake package and its dependencies if they not still used. -} +} \ No newline at end of file