# 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