Skip to content

Commit

Permalink
Merge pull request #63 from swindlesmccoop/master
Browse files Browse the repository at this point in the history
Add OpenBSD pkg_*
  • Loading branch information
willeccles authored Jul 25, 2022
2 parents ffded70 + e179a95 commit e1974e8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ $ cpm [i|r|l|u|U|s|S|I|F|f|c|h] [pkg]...
- urpmi (Mageia)
- xbps (Void)
- zypper (OpenSUSE)
- pkg (OpenBSD)

## Explicitly unsupported package managers

Expand Down
19 changes: 19 additions & 0 deletions cpm
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,22 @@ _guix() {
esac
}

_pkg_() {
case "$OP" in
install) $SUDO pkg_add "$@";;
remove) $SUDO pkg_delete "$@";;
list) pkg_info -v;;
count) pkg_info -v | tot;;
update) pem "unsupported: repo list only changes when user performs sys upgrade";;
upgrade) $SUDO pkg_add -u;;
search) pkg_info "$@";;
show) pkg_info "$@";;
files) pkg_info -L "$@";;
from) pkg_info -qE "$@";;
clean) pem "unsupported: PM already does this";;
esac
}

# Use pm=PKG_MANAGER cpm COMMAND to force a specific cpm function
# ie.: pm=portage cpm list
if [ "$pm" ] && has "_$pm"; then
Expand Down Expand Up @@ -466,6 +482,9 @@ elif ! [ "$(uname -s)" = "Darwin" ]; then
elif has guix; then
# local (non-system-wide) guix
_guix "$@"
elif has pkg_info; then
# openbsd
_pkg_ "$@"
elif has snap; then
pem "Snapd is not supported [wontfix]"
exit 1
Expand Down

0 comments on commit e1974e8

Please sign in to comment.