From: Luke Kenneth Casson Leighton Date: Mon, 15 Aug 2022 12:56:36 +0000 (+0100) Subject: check if schroot and debootstrap installed already X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=11b5a088785d5fa4dbd0a80dfc890124d300ea82;p=dev-env-setup.git check if schroot and debootstrap installed already --- diff --git a/mk-deb-chroot b/mk-deb-chroot index d1347e7..bc54c98 100755 --- a/mk-deb-chroot +++ b/mk-deb-chroot @@ -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