[enh] Tell apt to explain what's wrong when there are unmet dependencies (#889)

* Ask apt to explain what's wrong when dependencies fail to install
* Add comment explaining the syntax

Co-Authored-By: Maniack Crudelis <maniackcrudelis@users.noreply.github.com>
Co-authored-by: Maniack Crudelis <maniackcrudelis@users.noreply.github.com>
This commit is contained in:
Alexandre Aubin 2020-03-22 01:28:37 +01:00 committed by GitHub
parent 2215786d6e
commit ec80cad64a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -186,7 +186,10 @@ ynh_package_install_from_equivs () {
(cd "$TMPDIR"
equivs-build ./control 1> /dev/null
dpkg --force-depends -i "./${pkgname}_${pkgversion}_all.deb" 2>&1)
ynh_package_install -f || ynh_die --message="Unable to install dependencies"
# If install fails we use "apt-get check" to try to debug and diagnose possible unmet dependencies
# Note the use of { } which allows to group commands without starting a subshell (otherwise the ynh_die wouldn't exit the current shell).
# Be careful with the syntax : the semicolon + space at the end is important!
ynh_package_install -f || { apt-get check 2>&1; ynh_die --message="Unable to install dependencies"; }
[[ -n "$TMPDIR" ]] && rm -rf $TMPDIR # Remove the temp dir.
# check if the package is actually installed