1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
|
#!/bin/bash
# Purpose: OpenBSD support
# Author : Somasis <somasissounds@gmail.com>
# License: Fair license (http://www.opensource.org/licenses/fair)
# Source : http://github.com/somasis/pacapt
# Copyright (C) 2014 Somasis
#
# Usage of the works is permitted provided that this instrument is
# retained with the works, so that any entity that uses the works is
# notified of this instrument.
#
# DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
_pkg_tools_init() {
:
}
pkg_tools_Qi() {
# disable searching mirrors for packages
export PKG_PATH=
pkg_info "$@"
}
pkg_tools_Ql() {
export PKG_PATH=
pkg_info -L "$@"
}
pkg_tools_Qo() {
export PKG_PATH=
pkg_info -E "$@"
}
pkg_tools_Qp() {
_not_implemented
}
pkg_tools_Qu() {
export PKG_PATH=
pkg_add -u "$@"
}
pkg_tools_Q() {
export PKG_PATH=
# the dash after the pkg name is so we don't catch partial matches
# because all packages in openbsd have the format 'pkgname-pkgver'
if [[ "$_TOPT" == "q" && ! -z "$@" ]]; then
pkg_info -q | grep "^${*}-"
elif [[ "$_TOPT" == "q" && -z "$@" ]];then
pkg_info -q
elif [[ "$_TOPT" == "" && ! -z "$@" ]]; then
pkg_info | grep "^${*}-"
elif [[ "$_TOPT" == "" && -z "$@" ]];then
pkg_info
else
_not_implemented
fi
}
pkg_tools_Rs() {
if [[ "$_TOPT" == "" ]]; then
pkg_delete -D dependencies "$@"
else
_not_implemented
fi
}
pkg_tools_Rn() {
if [[ "$_TOPT" == "" ]];then
pkg_delete -c "$@"
else
_not_implemented
fi
}
pkg_tools_Rns() {
_not_implemented
}
pkg_tools_R() {
pkg_delete "$@"
}
pkg_tools_Si() {
pkg_info "$@"
}
pkg_tools_Sl() {
pkg_info -L "$@"
}
pkg_tools_Suy() {
# pkg_tools doesn't really have any concept of a database
# there's actually not really any database to update, so
# this function is mostly just for convienience since on arch
# doing -Su is normally a bad thing to do since it's a partial upgrade
pkg_tools_Su "$@"
}
pkg_tools_Su() {
pkg_add -u "$@"
}
pkg_tools_Sy() {
_not_implemented
}
pkg_tools_Ss() {
if [[ -z "$@" ]];then
_not_implemented
else
pkg_info -Q "$@"
fi
}
pkg_tools_Sc() {
# by default no cache directory is used
if [[ -z "$PKG_CACHE" ]];then
echo "You have no cache directory set, set \$PKG_CACHE for a cache directory."
elif [[ ! -d "$PKG_CACHE" ]];then
echo "You have a cache directory set, but it does not exist. Create \"$PKG_CACHE\"."
else
_removing_is_dangerous "rm -rf $PKG_CACHE/*"
fi
}
pkg_tools_Scc() {
_not_implemented
}
pkg_tools_S() {
pkg_add "$@"
}
|