[enh] Better name ynh_wait_dpkg_free

This commit is contained in:
ljf (zamentur) 2018-11-20 20:47:36 +01:00 committed by GitHub
parent b67105f04b
commit eb8792376c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,8 +2,8 @@
# #
# [internal] # [internal]
# #
# usage: ynh_is_dpkg_free # usage: ynh_wait_dpkg_free
ynh_is_dpkg_free() { ynh_wait_dpkg_free() {
local try local try
# With seq 1 17, timeout will be almost 30 minutes # With seq 1 17, timeout will be almost 30 minutes
for try in `seq 1 17` for try in `seq 1 17`
@ -28,7 +28,7 @@ ynh_is_dpkg_free() {
# usage: ynh_package_is_installed name # usage: ynh_package_is_installed name
# | arg: name - the package name to check # | arg: name - the package name to check
ynh_package_is_installed() { ynh_package_is_installed() {
ynh_is_dpkg_free ynh_wait_dpkg_free
dpkg-query -W -f '${Status}' "$1" 2>/dev/null \ dpkg-query -W -f '${Status}' "$1" 2>/dev/null \
| grep -c "ok installed" &>/dev/null | grep -c "ok installed" &>/dev/null
} }
@ -54,7 +54,7 @@ ynh_package_version() {
# #
# usage: ynh_apt update # usage: ynh_apt update
ynh_apt() { ynh_apt() {
ynh_is_dpkg_free ynh_wait_dpkg_free
DEBIAN_FRONTEND=noninteractive sudo apt-get -y $@ DEBIAN_FRONTEND=noninteractive sudo apt-get -y $@
} }
@ -130,7 +130,7 @@ ynh_package_install_from_equivs () {
# Create a fake deb package with equivs-build and the given control file # Create a fake deb package with equivs-build and the given control file
# 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_is_dpkg_free ynh_wait_dpkg_free
(cp "$controlfile" "${TMPDIR}/control" && cd "$TMPDIR" \ (cp "$controlfile" "${TMPDIR}/control" && cd "$TMPDIR" \
&& equivs-build ./control 1>/dev/null \ && equivs-build ./control 1>/dev/null \
&& sudo dpkg --force-depends \ && sudo dpkg --force-depends \