add libgtest-dev to install-hdl-apt-reqs
[dev-env-setup.git] / mk-deb-chroot
index d83f85c0003cc5b7253bac93746f4b60254c6584..a02e46ffea4bb2b1297ce3ea8ee9648c788e9fdf 100755 (executable)
@@ -42,7 +42,21 @@ fi
 # Install debootstrap and schroot
 if [ -e /etc/debian_version ]; then
     # Debian detected: use apt
-    apt install -y debootstrap schroot
+    REQUIRED_PKG="debootstrap"
+    PKG_OK=$(dpkg-query -W --showformat='${Status}\n'\
+    $REQUIRED_PKG|grep "install ok installed")
+    echo Checking for $REQUIRED_PKG: $PKG_OK
+    if [ "" = "$PKG_OK" ]; then
+        apt install -y debootstrap
+    fi
+
+    REQUIRED_PKG="schroot"
+    PKG_OK=$(dpkg-query -W --showformat='${Status}\n'\
+    $REQUIRED_PKG|grep "install ok installed")
+    echo Checking for $REQUIRED_PKG: $PKG_OK
+    if [ "" = "$PKG_OK" ]; then
+        apt install -y schroot
+    fi
 elif [ -e /etc/arch-release ]; then
     # Arch Linux detected: use pacman
     pacman -S --needed debootstrap schroot
@@ -112,6 +126,7 @@ fi
 #!!! buster backports is needed for a lot of things
 cat << EOF > /opt/chroot/$chrootdir/etc/apt/sources.list.d/buster_backports.list
 deb http://deb.debian.org/debian buster-backports main
+deb-src http://deb.debian.org/debian buster-backports main
 EOF
 
 # oooo annoying, pin preferences for buster-backports
@@ -119,7 +134,7 @@ EOF
 cat << EOF > /opt/chroot/$chrootdir/etc/apt/preferences.d/99buster-backports
 Package: *
 Pin: release a=buster-backports
-Pin-Priority: 300
+Pin-Priority: 100
 
 Package: libcurl3-gnutls
 Pin: version 7.64*