diff options
author | Raphaël Hertzog <raphael@offensive-security.com> | 2019-12-19 16:21:58 +0100 |
---|---|---|
committer | Raphaël Hertzog <raphael@offensive-security.com> | 2019-12-19 16:21:58 +0100 |
commit | 0647e985fa05d09a7fecc801e9e23d6b513b7de4 (patch) | |
tree | eb0214493cfd25cd53d7ca6cf4533b9d6c9920a1 /functions/chroot.sh | |
parent | 04ea46d07bfd56d76e3405e0b279391b148a9999 (diff) | |
download | vyos-live-build-0647e985fa05d09a7fecc801e9e23d6b513b7de4.tar.gz vyos-live-build-0647e985fa05d09a7fecc801e9e23d6b513b7de4.zip |
chroot_live-packages: use dpkg-query to see if a package is installed
Closes: #944983
Diffstat (limited to 'functions/chroot.sh')
-rwxr-xr-x | functions/chroot.sh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/functions/chroot.sh b/functions/chroot.sh index 88c5466b8..0b54a3925 100755 --- a/functions/chroot.sh +++ b/functions/chroot.sh @@ -36,3 +36,14 @@ Chroot () return "${?}" } + +Chroot_has_package() { + PACKAGE="${1}"; shift + CHROOT="${2:-chroot}"; shift + + if dpkg-query --admindir=${CHROOT}/var/lib/dpkg -s ${PACKAGE} >/dev/null 2>&1 | grep -q "^Status: install" + then + return 0 + fi + return 1 +} |