From: Ian Kelling Date: Thu, 5 Feb 2026 23:01:27 +0000 (-0500) Subject: minor fixes X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=HEAD;p=distro-functions minor fixes --- diff --git a/src/package-manager-abstractions b/src/package-manager-abstractions index a765967..18d2f1a 100644 --- a/src/package-manager-abstractions +++ b/src/package-manager-abstractions @@ -20,6 +20,13 @@ # 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 @@ -102,7 +109,7 @@ elif command -v apt-get &>/dev/null; then 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 @@ -216,6 +223,8 @@ EOF apt-cache show "$@" fi } + # for locally installed files, do + # dpkg -S "$file" pfile() { # -a = search all repos local -a arg all @@ -236,18 +245,14 @@ EOF # 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() {