Merge branch 'release-2.140.117' 2.140.117
authorChris Koeritz <fred@gruntose.com>
Fri, 22 May 2020 22:21:46 +0000 (18:21 -0400)
committerChris Koeritz <fred@gruntose.com>
Fri, 22 May 2020 22:21:46 +0000 (18:21 -0400)
New release 2.140.177
as usual, lots of nice changes...

29 files changed:
documentation/feisty_meow_command_reference.txt
infobase/document_templates/google_contacts_columns.ods [new file with mode: 0644]
infobase/feisty_inits/dot.bashrc-normal-user
infobase/fortunes.dat
production/feisty_meow_config.ini
readme.txt
scripts/agenda/info_overload_report.sh
scripts/archival/raw_synch.sh
scripts/clam/cpp/rules.def
scripts/clam/cpp/variables.def
scripts/core/functions.sh
scripts/core/launch_feisty_meow.sh
scripts/core/variables.sh
scripts/customize/cak0l [new symlink]
scripts/customize/fred/fred_variables.sh
scripts/customize/fred/scripts/email/filter_grabber.sh
scripts/customize/root [new symlink]
scripts/customize/t1-cak0l [new symlink]
scripts/files/lesser.sh
scripts/generator/build_variables.sh
scripts/rev_control/diff_repos.sh
scripts/rev_control/push_repo_downstream.sh
scripts/rev_control/quick_git_release.sh
scripts/rev_control/rcheckin.sh
scripts/rev_control/report_new.sh
scripts/rev_control/rgetem.sh
scripts/rev_control/rpuffer.sh
scripts/rev_control/version_control.sh
scripts/system/report_disk_type.sh [new file with mode: 0644]

index acb6aa2658201034816d6dd1ed34b42e7a9e6fcc..21de010dc17fdb39d347ab594b86184e01480ad3 100644 (file)
@@ -58,6 +58,10 @@ generally useful commands
   update the feisty meow codebase from its origin and run the regeneration
   script to update the current user's feisty meow configuration.
 
+  whackem:
+  permanently delete files, rather than using safe delete (safedel).  this
+  script will accept all the standard arguments to "rm".
+
 revision control commands
 =========================
 
diff --git a/infobase/document_templates/google_contacts_columns.ods b/infobase/document_templates/google_contacts_columns.ods
new file mode 100644 (file)
index 0000000..17e986e
Binary files /dev/null and b/infobase/document_templates/google_contacts_columns.ods differ
index f64bbcfcf3d5cd178eff7d7468d06f9ab9239e26..fde023212e7de61709a0d8c90674f7a99cb34296 100644 (file)
@@ -26,7 +26,11 @@ export FEISTY_MEOW_APEX="/opt/feistymeow.org/feisty_meow"
 
 # sets up the feisty_meow scripts if appropriate for the environment.
 if [ "${TERM}" != "dumb" -a -z "$PBS_ENVIRONMENT" ]; then
-  source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"
+  if [ -d "$FEISTY_MEOW_APEX" ]; then
+    source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"
+  else
+    echo "feisty meow codebase is not available at: $FEISTY_MEOW_APEX"
+  fi
 fi
 
 # if not commented out, then feisty meow will run all the unit tests during builds.
index 878d403f334ab85e1b03a33807512b3cc5608ab3..ab0d4fd87c932b90cc7640980a7d2acb759bf5ae 100644 (file)
@@ -43864,3 +43864,24 @@ is an extension of one's penis, then that is not a very good reason to pick up
 a knife; one should probably put the knife right back down in those degenerate
 (in the mathematical sense) cases.  #WhatILearnedFromTheBoyScouts
   -- fred t. hamster
+~
+Full of trust you left home,
+and soon learned to walk the Path--
+making yourself a friend to everyone
+and making everyone a friend.
+
+When the whole world is your friend,
+fear will find no place to call home.
+
+And when you make the mind your friend,
+you'll know what trust 
+really means.
+
+Listen.
+
+I have followed this Path of friendship to its end.
+And I can say with absolute certainty--
+it will lead you home.
+
+  -- from "The First Free Women: Poems of the Early Buddhist Nuns",
+     by Matty Weingast
index 437f8d5586c2b08de618f37d1564da709f888cbf..21aec05f30f0fe2da8ea22407fa01b1ab1f598ca 100644 (file)
@@ -3,7 +3,7 @@
 # specifies the version of the code that is being constructed here.
 major=2
 minor=140
-revision=116
+revision=117
 build=420
 
 # specifies the remainder of the version record info.
index 7d78391e8e32676d1f303bde6873421fa8ffa1ee..1491d573090c7b0e6cee242dc1f245799ca60243 100644 (file)
@@ -61,6 +61,9 @@ installed with either apt or CPAN.
 Install using apt (on Ubuntu or Debian-based OS):
 $ sudo apt install libfile-which-perl libtext-diff-perl
 
+Install using yum (on Centos or similar distros):
+$ yum install perl-File-Which perl-Text-Diff
+
 or Install using perl's CPAN:
 $ sudo cpan install Text::Diff File::Which
 
index 46a5dc2553f2a5f824680fe812c1ff2d95f63351..e6b63b2fcdc4f28475ab0f7585583bd8b44cbdda 100644 (file)
@@ -1,3 +1,4 @@
+#!/bin/bash
 
 # these metrics are how bogged down we are in to-do type items.
 
@@ -22,7 +23,7 @@ function calculate_count()
 function calculate_weight()
 {
   local dir="$1"; shift
-  local weight=$(find "$dir" -type f -exec echo \"{}\" ';' 2>/dev/null | grep -v "\.svn" | grep -v "\.git"| grep -v "\.basket" | grep -v "\.version" | grep -v "\.keep" | xargs ls -al | awk '{ print $5 }' | paste -sd+ | bc 2>/dev/null)
+  local weight=$(find "$dir" -type f -exec echo \"{}\" ';' 2>/dev/null | grep -v "\.svn" | grep -v "\.git"| grep -v "\.basket" | grep -v "\.version" | grep -v "\.keep" | xargs ls -al | awk '{ print $5 }' | paste -sd+ | bc 2>/dev/null)
   if [ -z "$weight" ]; then echo 0; else echo "$weight"; fi
 }
 
@@ -31,7 +32,7 @@ function calculate_weight()
 function calculate_complexity()
 {
   local dir="$1"; shift
-  local complexity=$(find "$dir" -type d | wc -l)
+  local complexity=$(find "$dir" -type d | wc -l | tr -d ' ')
   if [ -z "$complexity" ]; then echo 0; else echo "$complexity"; fi
 }
 
index e0cebc6e8a172a5610fb0a6e740655fefdfbdb32..2b0a0c1cf3c9d16a5471bc8a14b22b1a78bdfde5 100644 (file)
@@ -15,7 +15,7 @@ for currdir in basement imaginations musix toaster walrus; do
   if [ -d "/z/$currdir" ]; then
     sep
     echo "synching $currdir folder from $synch_host..."
-    rsync -avz "$synch_host":/z/$currdir/* /z/$currdir/
+    rsync -avz "fred@${synch_host}:/z/$currdir"/* /z/$currdir/
     continue_on_error synching with $currdir from remote host.
   fi
 done
index 40a72ba49f22903464a01799b25f2de0a1c3f2d1..ca59f82360a30ad4341b456d98c1872406c927b5 100644 (file)
@@ -115,7 +115,7 @@ ifeq "$(COMPILER)" "GNU_DARWIN"
   endif
 
   ifneq "$(USE_SSL)" ""
-    LIBS_USED += crypto
+    LIBS_USED += crypto ssl
   endif
   
   ifneq "$(USE_WXWIDGETS)" ""
index c9210586b8b3ab3003de4cdaca976ef3e966f3f0..94e0f3d0dc08846cd763183468f56cfa3cae24b0 100644 (file)
@@ -928,9 +928,7 @@ ifeq "$(COMPILER)" "GNU_DARWIN"
   DEPENDENCY_DEFINITIONS += NO_VERSION
   DEPENDENCY_ADDITIONS = -X/usr/include -X/usr/include/c++/$(COMPILER_VERSION) -X/usr/include/c++/$(COMPILER_VERSION)/tr1 -X/usr/local/include -X/usr/include/linux -X/usr/include/wx-2.8 -X/usr/lib/gcc/i586-suse-linux/$(COMPILER_VERSION)/include -X/usr/lib/gcc/i486-linux-gnu/$(COMPILER_VERSION)/include
 
-#protect other additions to make them only for debian?
-#  COMPILER_HEADER_DIR := /usr/include /usr/local/include 
-  COMPILER_HEADER_DIR := /System/Library/Frameworks/Foundation.framework/Versions/C/Headers
+  COMPILER_HEADER_DIR := /usr/local/include /usr/include /System/Library/Frameworks/Foundation.framework/Versions/C/Headers
 
   # "USE_XWIN" specifies that this project needs X window system support.
   #USE_XWIN =
@@ -939,8 +937,7 @@ ifeq "$(COMPILER)" "GNU_DARWIN"
 #    COMPILER_LIBRARY_DIR = /lib64 /usr/lib64 /usr/local/lib64
 #  else
 
-    COMPILER_LIBRARY_DIR = /usr/lib 
-###/usr/local/lib
+    COMPILER_LIBRARY_DIR = /usr/lib /usr/local/lib
 #/lib 
 
 #  endif
index f13f4afeb83565738a042e42a051fc78ca38f826..6389b6684b4cc7215613a69c2b3ecb52aae1a6b1 100644 (file)
@@ -451,6 +451,9 @@ if [ -z "$skip_all" ]; then
   # label if they're doing an su with the sudo.
   function sudo() {
     save_terminal_title
+    # hoist our X authorization info in case environment is passed along;
+    # this can allow root to use our display to show Xorg windows.
+    export IMPORTED_XAUTH="$(xauth list $DISPLAY)"
     /usr/bin/sudo "$@"
     retval=$?
     restore_terminal_title
@@ -515,6 +518,8 @@ if [ -z "$skip_all" ]; then
         # if the user has sudo root access; we don't want to provide a custom
         # profile for root.
     fi
+    # chop off any email address style formatting to leave just the name.
+    custom_user="$(echo "$custom_user" | cut -f1 -d'@')"
 
     save_terminal_title
 
@@ -944,7 +949,7 @@ return 0
     local charnfile="$(mktemp $TMP/zz_charn.XXXXXX)"
     find "${dirs[@]}" -follow -maxdepth 1 -mindepth 1 -type f | \
         grep -i \
-"docx\|eml\|html\|jpeg\|jpg\|m4a\|mov\|mp3\|ods\|odt\|pdf\|png\|pptx\|txt\|xlsx\|zip" | \
+"doc\|docx\|eml\|html\|jpeg\|jpg\|m4a\|mov\|mp3\|ods\|odt\|pdf\|png\|ppt\|pptx\|txt\|vsd\|vsdx\|xls\|xlsx\|zip" | \
         sed -e 's/^/"/' | sed -e 's/$/"/' | \
         xargs bash "$FEISTY_MEOW_SCRIPTS/files/spacem.sh"
     # drop the temp file now that we're done.
index 0d7d54beb9d4ed27a880d33b229d29314a573dd5..913f82b43b2ac6c53273ecb2caa368799d5d21cf 100644 (file)
@@ -92,6 +92,13 @@ if [ "$NO_REPAIRS_NEEDED" == "true" ]; then
   if [ -z "$USER" -a ! -z "$CRONUSER" ]; then
     export USER="$CRONUSER"
   fi
+
+  # use the xauth info if we were given one in the environment.
+  # this allows root or other su'd identities to create windows with same
+  # display variable.
+  if [ ! -z "$DISPLAY" -a ! -z "$IMPORTED_XAUTH" ]; then
+    xauth add $IMPORTED_XAUTH
+  fi
   
   ##############
   
index 3596c0c4f5ae4141c832487dea8019dde4ba868b..d8b44bc845aeaa7b2451473caabcb822bc1e83bb 100644 (file)
@@ -318,12 +318,10 @@ done
 # a late breaking action is to set the editor, if we can.
 # we will fallback to whatever we can find on the host.
 export EDITOR
-if [ ! -z "$DISPLAY" ]; then
-  # only try to add bluefish, a gui editor, if there is an X display for it.
-  if [ -z "$EDITOR" ]; then
-    EDITOR="$(which bluefish)"
-  fi
-fi
+# note: the editors for revision control must wait while the document is
+# edited, so gvim and others that launch a separate x window are not
+# going to work well unless they can be prevented from forking the process
+# off.
 if [ -z "$EDITOR" ]; then
   EDITOR="$(which gvim)"
   if [ ! -z "$EDITOR" ]; then
@@ -337,12 +335,18 @@ fi
 if [ -z "$EDITOR" ]; then
   EDITOR="$(which vi)"
 fi
-##
+if [ -z "$EDITOR" ]; then
+  EDITOR="$(which emacs)"
+fi
+####
 # out of ideas about editors at this point.
-##
-# set the VISUAL variable from EDITOR if we found an editor to use.
+####
+# set the VISUAL and other variables from EDITOR if we found an editor to use.
 if [ ! -z "$EDITOR" ]; then
   VISUAL="$EDITOR"
+
+  export GIT_EDITOR="$EDITOR"
+  export SVN_EDITOR="$EDITOR"
 fi
 
 ##############
diff --git a/scripts/customize/cak0l b/scripts/customize/cak0l
new file mode 120000 (symlink)
index 0000000..86654dd
--- /dev/null
@@ -0,0 +1 @@
+fred
\ No newline at end of file
index 36bee1e1cac0be0cb52ef5db6114af3a4b66eff4..00f9637bc9d870df4a576fd4d3fd5a8af9539c9d 100644 (file)
@@ -38,31 +38,9 @@ if [ -z "$USER_CUSTOMIZATIONS_LOADED" ]; then
   # set our browser for seti and others that use the variable.
 #  export BROWSER=/usr/bin/firefox
 
-  # editor and other mixed settings...
-  export EDITOR="$(which gvim)"
-  if [ -z "$EDITOR" ]; then
-    export EDITOR="$(which vim)"
-  else
-    # special case for gvim; tell it not to fork or we can't wait for it.
-    EDITOR+=" --nofork"
-  fi
-  if [ -z "$EDITOR" ]; then
-    EDITOR="$(which vi)"
-  fi
-  if [ -z "$EDITOR" ]; then
-    EDITOR="$(which emacs)"
-  fi
-  if [ -z "$EDITOR" ]; then
-    echo "Cannot find a friendly editor."
-  fi
-  export VISUAL="$EDITOR"
-  # the editors for revision control must wait while document is edited,
-  # so gvim and others launched to x window are not appropriate.
-  export GIT_EDITOR="$EDITOR"
-  export SVN_EDITOR="$EDITOR"
-
-  # this hideous mess is necessitated by our not having found the source of the
-  # settings yet.  we override a few colors that look bad on a dark background.
+  # this hideous mess is necessitated by our not having found the source of
+  # the "ls" color settings yet.  we override a few colors that look bad on
+  # a dark background.
   export LS_COLORS='no=00:fi=00:di=01;37:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;35:*.rpm=00;33:*.deb=00;33:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;35:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;35:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:'
 
   # options for the lame mp3 encoder.
index dcb794644d053c17003c79fcee5c230f26bbba31..8d6fe22936161d62f66df4a7a5c3561300e1d36e 100644 (file)
@@ -7,7 +7,7 @@ source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
 cp $HOME/.thunderbird/oqv30zg4.default/ImapMail/zooty.koeritz.com/msgFilterRules.dat $CLOUD_BASE/magic_cabinet/mail_filters/zooty_serene_hamstertronic_$(date_stringer).filters
 exit_on_error "copying feistymeow.org filters"
 
-cp $HOME/.thunderbird/oqv30zg4.default/ImapMail/mail.eservices.virginia.edu/msgFilterRules.dat $CLOUD_BASE/magic_cabinet/mail_filters/uva_email_$(date_stringer).filters 
-exit_on_error "copying UVa filters"
+#GONE: cp $HOME/.thunderbird/oqv30zg4.default/ImapMail/mail.eservices.virginia.edu/msgFilterRules.dat $CLOUD_BASE/magic_cabinet/mail_filters/uva_email_$(date_stringer).filters 
+#GONE: exit_on_error "copying UVa filters"
 
 
diff --git a/scripts/customize/root b/scripts/customize/root
new file mode 120000 (symlink)
index 0000000..86654dd
--- /dev/null
@@ -0,0 +1 @@
+fred
\ No newline at end of file
diff --git a/scripts/customize/t1-cak0l b/scripts/customize/t1-cak0l
new file mode 120000 (symlink)
index 0000000..86654dd
--- /dev/null
@@ -0,0 +1 @@
+fred
\ No newline at end of file
index f6674f1364880583496ede3baa4281de51a21395..16eb3176bd70af0ccc1066faf011f38f80a0700c 100644 (file)
@@ -30,7 +30,7 @@ function lesser()
   fi
 
   # run the source highlighter first if needed.
-  /bin/less $EXTRA_OPTIONS "${@}" 
+  /usr/bin/env less $EXTRA_OPTIONS "${@}" 
 }
 
 ##############
index eb3a56605c3c60ffe6d95567b14060b91649c699..8c324acc5c61b98862fb7c4f38cf2269d1aadc17 100644 (file)
@@ -208,7 +208,7 @@ if [ -z "$got_bad" ]; then
   if [ "$OPERATING_SYSTEM" == "WIN32" ]; then
     source "$BUILD_SCRIPTS_PATH/vis_stu_vars.sh"
   else
-    export LD_LIBRARY_PATH="$TARGETS_STORE"
+    export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TARGETS_STORE"
   fi
   
   popd &>/dev/null # checking is over, jump back to the starting point.
index 32a5d48c6e94fc1287ff74520c9e1c5d2df054f6..5a6cf750ece71a566d1ba9f5787a1f021880e89f 100644 (file)
@@ -25,5 +25,7 @@ popd &>/dev/null
 perform_revctrl_action_on_file "$tempfile" do_revctrl_diff
 exit_on_error "performing revision control action do_revctrl_diff on: $tempfile"
 
+rm "$tempfile"
+
 restore_terminal_title
 
index f12fc74080918d53cf90175c7cdcbf38fc9fe010..1fc6e0ba904d351ee99218237f47fc9218c989d4 100644 (file)
@@ -53,6 +53,8 @@ exit_on_error "generating revision control file list"
 perform_revctrl_action_on_file "$tempfile" do_revctrl_careful_update
 exit_on_error "doing a careful update on: $tempfile"
 
+rm "$tempfile"
+
 # seems to be needed to cause a merge to be resolved.
 git pull downstream master
 # -m "unfortunate merge"
index 02b04a598092c77a8ef914b91eef010b05961bc8..bb914da1d8ad533fc5e0cf745a74b826660b8170 100644 (file)
@@ -38,54 +38,60 @@ branch name and release tag name of the new release.
   # make up a release name based on the version number.
   local new_release="release-${new_version}"
   # make a new branch for the release based on the dev branch.
-echo about to git checkout
+echo about to git checkout--hit enter
 read line
   git checkout -b $new_release dev
   exit_on_error checking out a new branch called $new_release
   # bump feisty meow version. 
   bash ./scripts/generator/next_version.sh
   exit_on_error bumping version for feisty meow codebase
-echo about to commit
-read line
   # check in the changes in the new release branch, which now includes a revised version.
+echo about to commit--hit enter
+read line
   git commit -a
   exit_on_error committing all changes
-echo about to check out master
+
+  # not sure if we really need to check in the release branch as a remote, but we like to see it in the list.
+echo about to push new release branch--hit enter
 read line
+  git push --set-upstream origin "$new_release"
+
   # grab out the master branch as the active one.
+echo about to check out master--hit enter
+read line
   git checkout master
   exit_on_error checking out master branch
-echo about to merge
-read line
   # merge the master branch with the new release.
+echo about to merge--hit enter
+read line
   git merge --no-ff $new_release
   exit_on_error merging in the new release in master
   # let the committer see the most recent changes.
   echo "=> launching gitk to show you the full set of changes;"
-  echo "=> please prepare a kick-ass commit comment."
+  echo "=> please prepare an excellent commit comment."
   gitk
   exit_on_error launching gitk
   # now make a tag for the new release, which is where we should go crazy with the detailed
   # and useful comments for what has changed in this release, gathered from the gitk that
   # we just launched.  this should include all of the work on the development branch since
   # the last release...
-echo about to TAG
+echo about to TAG--hit enter
 read line
   git tag -a $new_version
   exit_on_error tagging new version as $new_version
-echo about to commit master branch with all those changes
-read line
   # commit the full set of changes for the master branch now, including the tags.
+echo about to commit master branch with all those changes--hit enter
+read line
   rcheckin .
   exit_on_error checking in the changes in master branch
-echo switching to dev branch
-read line
   # switch back to the dev branch.
+echo switching to dev branch--hit enter
+read line
   git checkout dev
   exit_on_error checking the dev branch out again
-echo merging in from master
-read line
   # merge in the latest changes from master, which should only be the revised version really.
+echo merging in from release branch to dev--hit enter
+read line
   git merge --no-ff $new_release
   exit_on_error merging the release changes into the dev branch
   # back to where we started.
index dc05cf47e1c8655461a9aea134d01d30405e2d5c..185de49e8c7a832351d4ada1a107611caa36bc44 100644 (file)
@@ -25,4 +25,6 @@ popd &>/dev/null
 perform_revctrl_action_on_file "$tempfile" do_revctrl_checkin
 exit_on_error "doing a check-in on: $tempfile"
 
+rm "$tempfile"
+
 restore_terminal_title
index 5a057b0be2f6db8f74c1432ab4726444371d5955..8ecb8715147bf32aab000474f0a4899731ba39d1 100644 (file)
@@ -26,5 +26,7 @@ popd &>/dev/null
 perform_revctrl_action_on_file "$tempfile" do_revctrl_report_new
 exit_on_error "running revision control report"
 
+rm "$tempfile"
+
 restore_terminal_title
 
index 529fae19b59e8e363602dd716222b1d419fc5d29..11b9edd4d7eb2bd1c61bec9f817acb10f56a69cd 100644 (file)
@@ -25,5 +25,7 @@ popd &>/dev/null
 perform_revctrl_action_on_file "$tempfile" do_revctrl_simple_update
 exit_on_error "running revision control update"
 
+rm "$tempfile"
+
 restore_terminal_title
 
index ddf163373ee5f4d03f69212c96f96f98497ff75a..d67332d37823b7e8ecb0e34979ba6aad630fe887 100644 (file)
@@ -29,5 +29,7 @@ popd &>/dev/null
 perform_revctrl_action_on_file "$tempfile" do_revctrl_careful_update
 exit_on_error "puffing out repository at: $tempfile"
 
+rm "$tempfile"
+
 restore_terminal_title
 
index 282dd4d922ff3bd9aa2708bbd34cca9760b679aa..5342ef2cc8fd672189c48bff0baf9ecfc006dec4 100644 (file)
@@ -156,7 +156,7 @@ function do_revctrl_diff
     svn diff .
     exit_on_error "subversion diff"
   elif [ -d ".git" ]; then
-    git diff 
+    git --no-pager diff 
     exit_on_error "git diff"
   elif [ -d "CVS" ]; then
     cvs diff .
diff --git a/scripts/system/report_disk_type.sh b/scripts/system/report_disk_type.sh
new file mode 100644 (file)
index 0000000..7bfa0b4
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+# reports whether a disk is spinning physical media or solid state.
+# if no drive is specified, then /dev/sda is the default.
+
+source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"
+
+drive="$1"; shift
+
+# plug in a default drive if none is provided.
+if [ -z "$drive" ]; then drive="sda"; fi
+
+# chop off the /dev/ portion of the disk name, if it exists.  also chop off
+# any partition numbers, since the script can only check whole drives (where,
+# so far at least, all partitions on a drive are the same type).
+if [[ "$drive" =~ ^/dev/.*$ ]]; then
+  drive="$(echo "$drive" | sed -e 's/^\/dev\///')"
+#  echo "after mangle, drive is: '$drive'"
+fi
+
+#hmmm: could do the check on multiple drives if weren't so lazy.
+
+# let's make sure that the drive exists...
+if [ ! -e "/sys/block/${drive}/queue/rotational" ]; then
+  false || exit_on_error "failed to find a record for drive '$drive'"
+fi
+
+# the value for the block device's rotational parameter should be 1 for hard
+# disks and 0 for SSDs.  apparently the linux kernel has supported this check
+# since version 2.6.29.
+if [ $(cat /sys/block/${drive}/queue/rotational) -eq 0 ]; then
+  echo "drive $drive is a solid state disk."
+else
+  echo "drive $drive is a spinning physical disk."
+fi
+
+