Add a quiet mode. Remove the seemingly unused sact variable. Signed-off-by: Kel Modderman <kel@xxxxxxxxxx> --- --- a/storage-fixup +++ b/storage-fixup @@ -27,10 +27,6 @@ # Executes ACTION on matched devices. ACTION can contain $DEV # which will be substituted with device file of matching device. # -# sact ACTION -# Silent version of "act". Useful when the action to take is -# printing out a warning message. -# # PATTERN is bash extglob pattern. # # For example, the following (useless) rule disables APM on the first @@ -47,10 +43,11 @@ # declare usage=" -Usage: storage-fixup [-h] [-V] [-v] [-b] [-c config_file] [-m max_devs] +Usage: storage-fixup [-h] [-V] [-q] [-v] [-b] [-c config_file] [-m max_devs] -h Print this help message and exit -V Print version and exit + -q Quiet -v Verbose -d Dry run, don't actually execute action -c Use config_file instead of /etc/storage-fixup.conf @@ -81,7 +78,7 @@ warn() { } debug() { - if [ $verbose -ne 0 ]; then + if [ $verbose -gt 0 ]; then warn "$@" fi } @@ -242,8 +239,10 @@ do_act() { for idx in ${matches[@]}; do DEV=${storage_devs[idx]} if [ $dry_run -eq 0 ]; then - if [ $verbose -ne 0 ]; then + if [ $verbose -gt 0 ]; then eval log "$rule_name: executing \"$act\"" + elif [ $verbose -lt 0 ]; then + act=${act//$hdparm/$hdparm -q} fi eval "$act" else @@ -259,10 +258,12 @@ do_act() { # shopt -s extglob -while getopts "dvVc:m:h" option; do +while getopts "dqvVc:m:h" option; do case $option in d) dry_run=1;; + q) + verbose=-1;; v) verbose=1;; V) @@ -345,10 +346,7 @@ while read f0 f1 f2; do do_storage scsi "$f1" "$f2" ;; act) - do_act "$f1 $f2" 1 - ;; - sact) - do_act "$f1 $f2" 0 + do_act "$f1 $f2" "$verbose" ;; *) false --- -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html