Skip to content

Commit 0b23db1

Browse files
authored
fix: fix is_in_apt function for virtual packages (#41)
Signed-off-by: Stefan Dej <[email protected]>
1 parent 3c4dcea commit 0b23db1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/common.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ function is_installed(){
1212
function is_in_apt(){
1313
# Checks if a package is in the apt repo, returns 1 if exists and 0 if not
1414
# Usage is_in_apt <package_name>
15-
if [ $(apt-cache policy $1 | wc | awk '{print $1}') -gt 0 ]; then
15+
16+
local output
17+
output=$(apt-cache search --names-only "^${1}$")
18+
19+
if [ -n "$output" ]; then
1620
echo 1
1721
else
1822
echo 0

0 commit comments

Comments
 (0)