minor fixes master
authorIan Kelling <iank@fsf.org>
Thu, 5 Feb 2026 23:01:27 +0000 (18:01 -0500)
committerIan Kelling <iank@fsf.org>
Thu, 5 Feb 2026 23:01:27 +0000 (18:01 -0500)
src/package-manager-abstractions

index a765967c595abbe55292bad465529b7d9de4f4e2..18d2f1a656919ffdc5da9c4eca99ebdc88327cea 100644 (file)
 # 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() {