Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check exact version of port packages #8

Open
FranklinYu opened this issue Jul 24, 2021 · 0 comments
Open

check exact version of port packages #8

FranklinYu opened this issue Jul 24, 2021 · 0 comments

Comments

@FranklinYu
Copy link
Owner

FranklinYu commented Jul 24, 2021

package_url="https://packages.macports.org/$1/"
if curl --head --fail --silent "$package_url" >/dev/null
then print-field 'Binary Package' "$package_url"
else print-field 'Binary Package' no
fi

This only checks the existence of the folder, not the exact version of the package. Need to get the package version and OS version.

Package version can come from the command, or another invocation of

port info --epoch --version --revision $package

Note that the invocation takes about a second. OS version can come from $OSTYPE (Bash one is different from Zsh one), or uname -r:

shopt -s extglob
os_version=$(uname -r)
echo ${ver%%+(.+([[:digit:]]))}

See shell parameter expansion and pattern matching in Bash manual. Another option is to use a proper scripting language.

Example URL: https://packages.macports.org/openssh/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant