# See the License for the specific language governing permissions and
# limitations under the License.
+if [[ $(type -t m) != function ]]; then
+ m() {
+ printf "%s\n" "$*";
+ "$@"
+ }
+fi
+
# basic yum/apt package manager abstraction, plus a few minor conveniences
if command -v yum &> /dev/null; then
# package manager
pbuild-dep() {
local pkg="$1"
shift
- p build-dep "$pkg"/$(debian-archive) "$@"
+ p build-dep "$pkg/$(debian-archive)" "$@"
}
pupdate() {
local now t s f cachetime limittime; [[ $EUID != 0 ]] && s=sudo
apt-cache show "$@"
fi
}
+ # for locally installed files, do
+ # dpkg -S "$file"
pfile() {
# -a = search all repos
local -a arg all
# if [[ $file == /* ]] && ! ucfq -w $file | grep ::: &>/dev/null; then
# ucfq $file
+ if ! $all; then
+ arg=(--filter-origins "$(positive-origins)")
+ fi
if [[ $file == /* ]]; then
- dpkg -S "$file"
+ m apt-file "${arg[@]}" find -x "$file"\$
+ m update-alternatives --list "$file" 2>/dev/null
else
- if ! $all; then
- arg=(--filter-origins "$(positive-origins)")
- fi
- if [[ $file == /* ]]; then
- apt-file "${arg[@]}" find -x /"$file"\$
- update-alternatives --list "$file" 2>/dev/null
- else
- apt-file "${arg[@]}" find -x "$file"\$
- fi
+ m apt-file "${arg[@]}" find -x "$file"\$
fi
}
pkgfiles() {