Created
November 5, 2021 09:03
-
-
Save maxice8/a3c83e466c9aeae081cb9468840d00fe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env rc | |
# Assume all packages given are already installed | |
if(test $#* -lt 2) exit 1 | |
module=$1 | |
shift | |
for(pkg in $*) { | |
# Get all go binaries by checking for 'Go BuildID=' | |
for(bin in `{apk info -q -L $pkg \ | |
| grep -v '^usr/share' \ | |
| xargs -I '{}' file /'{}' \ | |
| grep 'Go BuildID=' \ | |
| cut -d : -f1}) { | |
# Use 'grep >/dev/null' instead of 'grep -q' since the latter | |
# gives a sigpipe for some reason | |
if(grep -q -x $module <{strings $bin}) { | |
echo $pkg | |
break | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment