From: Chris Koeritz Date: Fri, 22 May 2020 22:21:46 +0000 (-0400) Subject: Merge branch 'release-2.140.117' X-Git-Tag: 2.140.117^0 X-Git-Url: https://feistymeow.org/gitweb/?p=feisty_meow.git;a=commitdiff_plain;h=2a9a70baeca7e954a659c67b634464b428510ae1;hp=d2ee06487533c604802c06c029671ce3fb98597d Merge branch 'release-2.140.117' New release 2.140.177 as usual, lots of nice changes... --- diff --git a/documentation/feisty_meow_command_reference.txt b/documentation/feisty_meow_command_reference.txt index acb6aa26..21de010d 100644 --- a/documentation/feisty_meow_command_reference.txt +++ b/documentation/feisty_meow_command_reference.txt @@ -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 index 00000000..17e986e5 Binary files /dev/null and b/infobase/document_templates/google_contacts_columns.ods differ diff --git a/infobase/feisty_inits/dot.bashrc-normal-user b/infobase/feisty_inits/dot.bashrc-normal-user index f64bbcfc..fde02321 100644 --- a/infobase/feisty_inits/dot.bashrc-normal-user +++ b/infobase/feisty_inits/dot.bashrc-normal-user @@ -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. diff --git a/infobase/fortunes.dat b/infobase/fortunes.dat index 878d403f..ab0d4fd8 100644 --- a/infobase/fortunes.dat +++ b/infobase/fortunes.dat @@ -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 diff --git a/production/feisty_meow_config.ini b/production/feisty_meow_config.ini index 437f8d55..21aec05f 100644 --- a/production/feisty_meow_config.ini +++ b/production/feisty_meow_config.ini @@ -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. diff --git a/readme.txt b/readme.txt index 7d78391e..1491d573 100644 --- a/readme.txt +++ b/readme.txt @@ -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 diff --git a/scripts/agenda/info_overload_report.sh b/scripts/agenda/info_overload_report.sh index 46a5dc25..e6b63b2f 100644 --- a/scripts/agenda/info_overload_report.sh +++ b/scripts/agenda/info_overload_report.sh @@ -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 } diff --git a/scripts/archival/raw_synch.sh b/scripts/archival/raw_synch.sh index e0cebc6e..2b0a0c1c 100644 --- a/scripts/archival/raw_synch.sh +++ b/scripts/archival/raw_synch.sh @@ -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 diff --git a/scripts/clam/cpp/rules.def b/scripts/clam/cpp/rules.def index 40a72ba4..ca59f823 100644 --- a/scripts/clam/cpp/rules.def +++ b/scripts/clam/cpp/rules.def @@ -115,7 +115,7 @@ ifeq "$(COMPILER)" "GNU_DARWIN" endif ifneq "$(USE_SSL)" "" - LIBS_USED += crypto + LIBS_USED += crypto ssl endif ifneq "$(USE_WXWIDGETS)" "" diff --git a/scripts/clam/cpp/variables.def b/scripts/clam/cpp/variables.def index c9210586..94e0f3d0 100644 --- a/scripts/clam/cpp/variables.def +++ b/scripts/clam/cpp/variables.def @@ -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 diff --git a/scripts/core/functions.sh b/scripts/core/functions.sh index f13f4afe..6389b668 100644 --- a/scripts/core/functions.sh +++ b/scripts/core/functions.sh @@ -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. diff --git a/scripts/core/launch_feisty_meow.sh b/scripts/core/launch_feisty_meow.sh index 0d7d54be..913f82b4 100644 --- a/scripts/core/launch_feisty_meow.sh +++ b/scripts/core/launch_feisty_meow.sh @@ -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 ############## diff --git a/scripts/core/variables.sh b/scripts/core/variables.sh index 3596c0c4..d8b44bc8 100644 --- a/scripts/core/variables.sh +++ b/scripts/core/variables.sh @@ -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 index 00000000..86654dd7 --- /dev/null +++ b/scripts/customize/cak0l @@ -0,0 +1 @@ +fred \ No newline at end of file diff --git a/scripts/customize/fred/fred_variables.sh b/scripts/customize/fred/fred_variables.sh index 36bee1e1..00f9637b 100644 --- a/scripts/customize/fred/fred_variables.sh +++ b/scripts/customize/fred/fred_variables.sh @@ -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. diff --git a/scripts/customize/fred/scripts/email/filter_grabber.sh b/scripts/customize/fred/scripts/email/filter_grabber.sh index dcb79464..8d6fe229 100644 --- a/scripts/customize/fred/scripts/email/filter_grabber.sh +++ b/scripts/customize/fred/scripts/email/filter_grabber.sh @@ -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 index 00000000..86654dd7 --- /dev/null +++ b/scripts/customize/root @@ -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 index 00000000..86654dd7 --- /dev/null +++ b/scripts/customize/t1-cak0l @@ -0,0 +1 @@ +fred \ No newline at end of file diff --git a/scripts/files/lesser.sh b/scripts/files/lesser.sh index f6674f13..16eb3176 100644 --- a/scripts/files/lesser.sh +++ b/scripts/files/lesser.sh @@ -30,7 +30,7 @@ function lesser() fi # run the source highlighter first if needed. - /bin/less $EXTRA_OPTIONS "${@}" + /usr/bin/env less $EXTRA_OPTIONS "${@}" } ############## diff --git a/scripts/generator/build_variables.sh b/scripts/generator/build_variables.sh index eb3a5660..8c324acc 100644 --- a/scripts/generator/build_variables.sh +++ b/scripts/generator/build_variables.sh @@ -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. diff --git a/scripts/rev_control/diff_repos.sh b/scripts/rev_control/diff_repos.sh index 32a5d48c..5a6cf750 100644 --- a/scripts/rev_control/diff_repos.sh +++ b/scripts/rev_control/diff_repos.sh @@ -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 diff --git a/scripts/rev_control/push_repo_downstream.sh b/scripts/rev_control/push_repo_downstream.sh index f12fc740..1fc6e0ba 100644 --- a/scripts/rev_control/push_repo_downstream.sh +++ b/scripts/rev_control/push_repo_downstream.sh @@ -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" diff --git a/scripts/rev_control/quick_git_release.sh b/scripts/rev_control/quick_git_release.sh index 02b04a59..bb914da1 100644 --- a/scripts/rev_control/quick_git_release.sh +++ b/scripts/rev_control/quick_git_release.sh @@ -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. diff --git a/scripts/rev_control/rcheckin.sh b/scripts/rev_control/rcheckin.sh index dc05cf47..185de49e 100644 --- a/scripts/rev_control/rcheckin.sh +++ b/scripts/rev_control/rcheckin.sh @@ -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 diff --git a/scripts/rev_control/report_new.sh b/scripts/rev_control/report_new.sh index 5a057b0b..8ecb8715 100644 --- a/scripts/rev_control/report_new.sh +++ b/scripts/rev_control/report_new.sh @@ -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 diff --git a/scripts/rev_control/rgetem.sh b/scripts/rev_control/rgetem.sh index 529fae19..11b9edd4 100644 --- a/scripts/rev_control/rgetem.sh +++ b/scripts/rev_control/rgetem.sh @@ -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 diff --git a/scripts/rev_control/rpuffer.sh b/scripts/rev_control/rpuffer.sh index ddf16337..d67332d3 100644 --- a/scripts/rev_control/rpuffer.sh +++ b/scripts/rev_control/rpuffer.sh @@ -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 diff --git a/scripts/rev_control/version_control.sh b/scripts/rev_control/version_control.sh index 282dd4d9..5342ef2c 100644 --- a/scripts/rev_control/version_control.sh +++ b/scripts/rev_control/version_control.sh @@ -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 index 00000000..7bfa0b4d --- /dev/null +++ b/scripts/system/report_disk_type.sh @@ -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 + +