fixed references to scripts directory and added linux package lister command.
authorChris Koeritz <fred@gruntose.com>
Mon, 28 Jan 2013 15:29:42 +0000 (10:29 -0500)
committerChris Koeritz <fred@gruntose.com>
Mon, 28 Jan 2013 15:29:42 +0000 (10:29 -0500)
scripts/buildor/buildor_strip_code.sh
scripts/core/functions.sh
scripts/core/variables.sh
scripts/generator/whack_build.sh
scripts/system/list_packages.sh [new file with mode: 0644]
scripts/system/write_uptime_report.sh

index eb5c6d4784c029aa3bca5fee64cdc05e06be76d3..e82206e71a2742c8b8ea275f5083c479b54ccd47 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-source "$FEISTY_MEOW_DIR/scripts/build/seek_all_source.sh"
+source "$FEISTY_MEOW_SCRIPTS/build/seek_all_source.sh"
 
 function strip_file {
   file="$1"
index 1cb2a2e4007ea9c308d8e041696d6d60c97172ba..aa9c512a918cfa91703226c4f77a1efe413b85d4 100644 (file)
@@ -172,15 +172,25 @@ if [ -z "$skip_all" ]; then
     # we always remove dos slashes in favor of forward slashes.
     echo "$1" | sed -e 's/\\/\//g' | sed -e 's/\([a-zA-Z]\):\/\(.*\)/\/\1\/\2/'
   }
-  
-  # su function: makes su perform a login.
-  # for some OSes, this transfers the X authority information to the new login.
-  function su() {
+
+  # returns a successful value (0) if this system is debian or ubuntu.
+  function debian_like() {
     # decide if we think this is debian or ubuntu or a variant.
     DEBIAN_LIKE=$(if [ ! -z "$(grep -i debian /etc/issue)" \
         -o ! -z "$(grep -i ubuntu /etc/issue)" ]; then echo 1; else echo 0; fi)
-  
     if [ $DEBIAN_LIKE -eq 1 ]; then
+      # success; this is debianish.
+      return 0
+    else
+      # this seems like some other OS.
+      return 1
+    fi
+  }
+  
+  # su function: makes su perform a login.
+  # for some OSes, this transfers the X authority information to the new login.
+  function su() {
+    if debian_like; then
       # debian currently requires the full version which imports X authority
       # information for su.
   
@@ -230,7 +240,7 @@ if [ -z "$skip_all" ]; then
     if [ -z "$wheres_nechung" ]; then
       echo "The nechung oracle program cannot be found.  You may want to consider"
       echo "rebuilding the feisty meow applications with this command:"
-      echo "   bash $FEISTY_MEOW_DIR/scripts/generator/bootstrap_build.sh"
+      echo "   bash $FEISTY_MEOW_SCRIPTS/generator/bootstrap_build.sh"
     else
       $wheres_nechung
     fi
index 7c67e440fb270d412784e41ab44fb9c445629b2a..bb7878c92ca1b6596a02b9a8354125d8f071abca 100644 (file)
@@ -63,7 +63,7 @@ if [ -z "$NECHUNG" ]; then
   if [ -z "$FEISTY_MEOW_DIR" ]; then
     if [ -d "$HOME/feisty_meow" ]; then
       export FEISTY_MEOW_DIR="$HOME/feisty_meow"
-      export FEISTY_MEOW_SCRIPTS="$FEISTY_MEOW_DIR/scripts"
+      export FEISTY_MEOW_SCRIPTS="$FEISTY_MEOW_SCRIPTS"
     fi
   fi
   
@@ -142,7 +142,7 @@ if [ -z "$NECHUNG" ]; then
     # we need to know the feisty meow directory, or we bail.
     if [ -z "$FEISTY_MEOW_DIR" ]; then return; fi
     # pick from our expected generator folder, but make sure it's there...
-    buildvars="$FEISTY_MEOW_DIR/scripts/generator/build_variables.sh"
+    buildvars="$FEISTY_MEOW_SCRIPTS/generator/build_variables.sh"
     if [ -f "$buildvars" ]; then
       # yep, that one looks good, so pull in the build defs.
       source "$buildvars" "$buildvars"
index 0778fb6da08ef9bf1c4339d82ceb8c2c5cafc33c..0647b0ab430417f1a8106b98bfca47a0db78dc34 100644 (file)
@@ -49,7 +49,7 @@ function whack_single_build_area()
 
   if [ "$clean_src" == "clean" -o "$clean_src" == "CLEAN"  ]; then
     echo $(date): "    ** aggressive cleaning activated..."
-    perl "$FEISTY_MEOW_DIR/scripts/files/zapdirs.pl" "$FEISTY_MEOW_DIR" >>"$CRUDFILE"
+    perl "$FEISTY_MEOW_SCRIPTS/files/zapdirs.pl" "$FEISTY_MEOW_DIR" >>"$CRUDFILE"
   fi
 
   echo $(date): "cleaned [$choprepo]."
diff --git a/scripts/system/list_packages.sh b/scripts/system/list_packages.sh
new file mode 100644 (file)
index 0000000..6b3222f
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"
+
+if debian_like; then
+  dpkg -la | grep $*
+  exit $?
+fi
+
+rpm_available="$(which rpm)"
+if [ ! -z "$rpm_available" ]; then
+#is that the right phrase for rpm?  somewhat forgotten.
+  rpm -qa | grep $*
+  exit $?
+fi
+
+yum_available="$(which yum)"
+if [ ! -z "$yum_available" ]; then
+  yum list | grep $*
+  exit $?
+fi
+
+echo "Could not deduce what type of OS this is; missing package listing commands."
+exit 1
index e5dfb35571fb3e8e1a1c3031f57fe4fad9f4b67e..e9627f5ffb22e9a36a066bcd4170709e9914ed5d 100644 (file)
@@ -1,7 +1,7 @@
 #!/bin/bash
 # writes an uptime report to a file in the home directory which is named
 # after the current machine's hostname.
-source "$FEISTY_MEOW_DIR/scripts/core/functions.sh"
+source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"
 export hosty=$(hostname | sed -e 's/^\([^.]*\).*$/\1/')
 export REPORT_FILE="$HOME/${hosty}_uptime.log"
 echo "$(date_stringer) -- $(uptime)" >>"$REPORT_FILE" 2>&1