new seek_package script for precise install checks
authorFred T. Hamster <fred@gruntose.com>
Mon, 1 Dec 2025 17:14:23 +0000 (12:14 -0500)
committerFred T. Hamster <fred@gruntose.com>
Mon, 1 Dec 2025 17:14:23 +0000 (12:14 -0500)
and removed yum case from list_package, which was redundant.
and fixed the screensaver setup script to use seek_package, so it's an exact check now. sweet.

scripts/system/list_packages.sh
scripts/system/seek_package.sh [new file with mode: 0644]
scripts/system/start_xwin_screensaver.sh

index 65840e1b1827944d93edd7cec97bf5dfa1720225..8fd2af00c8c99c511ff7e56abd55997b7cf53446 100644 (file)
@@ -23,11 +23,13 @@ if [ ! -z "$rpm_available" ]; then
   exit $?
 fi
 
-yum_available="$(whichable yum)"
-if [ ! -z "$yum_available" ]; then
-  yum list | eval $SEEK_PIECE
-  exit $?
-fi
+# yum should never be available if rpm was not!
+#yum_available="$(whichable yum)"
+#if [ ! -z "$yum_available" ]; then
+#  yum list | eval $SEEK_PIECE
+#  exit $?
+#fi
 
 echo "Could not deduce what type of OS this is; missing package listing commands."
 exit 1
+
diff --git a/scripts/system/seek_package.sh b/scripts/system/seek_package.sh
new file mode 100644 (file)
index 0000000..3a0743c
--- /dev/null
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+
+source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"
+
+if [ -z "$*" ]; then
+  echo This script requires a package name to find in the installed list of packages.
+  exit 1
+fi
+
+if debian_like; then
+  apt -qq list "$1" 2>/dev/null | grep -q '[installed]'
+ret=$?
+echo ret from seeking actual is $ret
+exit $ret
+
+  exit $?
+fi
+
+rpm_available="$(whichable rpm)"
+if [ ! -z "$rpm_available" ]; then
+  rpm -q --queryformat %{NAME} -p "$1"
+#hmmm: this is probably noisy, but we need an rpm system to test on.
+  exit $?
+fi
+
+# yum should never be available if rpm was not!
+#yum_available="$(whichable yum)"
+#if [ ! -z "$yum_available" ]; then
+#  yum list | eval $SEEK_PIECE
+#  exit $?
+#fi
+
+echo "Could not deduce what type of OS this is; missing package listing commands."
+exit 1
+
index 2cb9c40f5ad74c12f615024a3647bbc00893b5b0..1216eabef224fcbf3dd0948860bc4e1b8aa97d05 100644 (file)
@@ -17,12 +17,16 @@ fi
 # tests whether the package name provided as a parameter is already installed on the host.
 function check_installed()
 {
-  bash $FEISTY_MEOW_SCRIPTS/system/list_packages.sh "$1" &>/dev/null
+  bash $FEISTY_MEOW_SCRIPTS/system/seek_package.sh "$1" &>/dev/null
+out=$?
+echo out is $out on the seek
+return $out
+
+  return $?
 }
 
 # checks whether the provided package is already present, and if not, installs it.
-#hmmm: only works with apt based systems currently!
-#hmmm: list_packages is an inexact check!  it will match xscreensaver-data for xscreensaver as pattern!!!
+#hmmm: the below code only works with apt based systems currently!
 function install_if_missing()
 {
   packname="$1"; shift