Merge pull request #1921 from YunoHost/fix-install-from-equivs

Fix install from equivs
This commit is contained in:
Alexandre Aubin 2024-07-25 16:06:40 +02:00 committed by GitHub
commit 843771ea05
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 15 deletions

View file

@ -195,13 +195,16 @@ ynh_package_install_from_equivs() {
# Install the fake package without its dependencies with dpkg # Install the fake package without its dependencies with dpkg
# Install missing dependencies with ynh_package_install # Install missing dependencies with ynh_package_install
ynh_wait_dpkg_free ynh_wait_dpkg_free
cp "$controlfile" "${TMPDIR}/${pkgname}/DEBIAN/control" cp "$controlfile" "${TMPDIR}/${pkgname}/DEBIAN/control"
(
cd "$TMPDIR" # Install the fake package without its dependencies with dpkg --force-depends
# Install the fake package without its dependencies with dpkg --force-depends if ! LC_ALL=C dpkg-deb --build "${TMPDIR}/${pkgname}" "${TMPDIR}/${pkgname}.deb" > "${TMPDIR}/dpkg_log" 2>&1; then
LC_ALL=C dpkg-deb --build ${pkgname} ${pkgname}.deb > ./dpkg_log 2>&1 || { cat ./dpkg_log; false; } cat "${TMPDIR}/dpkg_log" >&2
LC_ALL=C dpkg --force-depends --install "./${pkgname}.deb" 2>&1 | tee ./dpkg_log ynh_die --message="Unable to install dependencies"
) fi
# Don't crash in case of error, because is nicely covered by the following line
LC_ALL=C dpkg --force-depends --install "${TMPDIR}/${pkgname}.deb" 2>&1 | tee "${TMPDIR}/dpkg_log" || true
ynh_package_install --fix-broken \ ynh_package_install --fix-broken \
|| { # If the installation failed || { # If the installation failed
@ -321,7 +324,7 @@ Section: misc
Priority: optional Priority: optional
Package: ${dep_app}-ynh-deps Package: ${dep_app}-ynh-deps
Version: ${version} Version: ${version}
Depends: ${dependencies} Depends: ${dependencies//,,/,}
Architecture: all Architecture: all
Maintainer: root@localhost Maintainer: root@localhost
Description: Fake package for ${app} (YunoHost app) dependencies Description: Fake package for ${app} (YunoHost app) dependencies

View file

@ -105,7 +105,7 @@ Section: misc
Priority: optional Priority: optional
Package: ${app_ynh_deps} Package: ${app_ynh_deps}
Version: ${version} Version: ${version}
Depends: ${dependencies} Depends: ${dependencies//,,/,}
Architecture: all Architecture: all
Maintainer: root@localhost Maintainer: root@localhost
Description: Fake package for ${app} (YunoHost app) dependencies Description: Fake package for ${app} (YunoHost app) dependencies
@ -116,13 +116,13 @@ EOF
_ynh_wait_dpkg_free _ynh_wait_dpkg_free
( # Install the fake package without its dependencies with dpkg --force-depends
# NB: this is in a subshell (though not sure why exactly not just use pushd/popd...) if ! LC_ALL=C dpkg-deb --build "${TMPDIR}/${app_ynh_deps}" "${TMPDIR}/${app_ynh_deps}.deb" > "${TMPDIR}/dpkg_log" 2>&1; then
cd "$TMPDIR" cat "${TMPDIR}/dpkg_log" >&2
# Install the fake package without its dependencies with dpkg --force-depends ynh_die --message="Unable to install dependencies"
LC_ALL=C dpkg-deb --build ${app_ynh_deps} ${app_ynh_deps}.deb > ./dpkg_log 2>&1 || { cat ./dpkg_log; false; } fi
LC_ALL=C dpkg --force-depends --install "./${app_ynh_deps}.deb" > ./dpkg_log 2>&1 # Don't crash in case of error, because is nicely covered by the following line
) LC_ALL=C dpkg --force-depends --install "${TMPDIR}/${app_ynh_deps}.deb" 2>&1 | tee "${TMPDIR}/dpkg_log" || true
# Then install the missing dependencies with apt install # Then install the missing dependencies with apt install
_ynh_apt_install --fix-broken || { _ynh_apt_install --fix-broken || {