[tor-commits] [rbm/master] Fix install_package on Debian

boklm at torproject.org boklm at torproject.org
Mon Mar 6 12:40:05 UTC 2017


commit 845bb904fb87b6c56ab789f35cd02bce32453f52
Author: Nicolas Vigier <boklm at torproject.org>
Date:   Mon Mar 6 13:34:11 2017 +0100

    Fix install_package on Debian
    
    dpkg -s not returning an error means that the package has a status, but
    its status is not always installed, so checking the exit value is not
    enough. We are now checking that the status is "install ok installed".
---
 lib/RBM/DefaultConfig.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/RBM/DefaultConfig.pm b/lib/RBM/DefaultConfig.pm
index 2f6264e..c0764bd 100644
--- a/lib/RBM/DefaultConfig.pm
+++ b/lib/RBM/DefaultConfig.pm
@@ -525,7 +525,7 @@ OPT_END
         my $dnf = 'rpm -q [% c("pkg_name") %] > /dev/null || dnf install -y [% c("pkg_name") %]';
         my $zypper = 'rpm -q [% c("pkg_name") %] > /dev/null || zypper install [% c("pkg_name") %]';
         my $urpmi = 'rpm -q [% c("pkg_name") %] > /dev/null || urpmi [% c("pkg_name") %]';
-        my $apt = 'dpkg -s [% c("pkg_name") %] > /dev/null 2>&1 || apt-get install -y [% c("pkg_name") %]';
+        my $apt = 'dpkg -s [% c("pkg_name") %] 2> /dev/null | grep -q "^Status: install ok installed\$" || apt-get install -y [% c("pkg_name") %]';
         my %install = (
             Fedora      => $dnf,
             'Fedora-20' => $yum,



More information about the tor-commits mailing list