satisfy shellcheck
[log-quiet] / setup
diff --git a/setup b/setup
index 44ef3f548c02dcc5e3dacb9bc2135036daf9de99..eefb056f98aac1b098c29fb196eaf86193a78ecc 100755 (executable)
--- a/setup
+++ b/setup
@@ -1,5 +1,12 @@
 #!/bin/bash
-# Copyright (C) 2017 Ian Kelling
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to switch
+# its license to GPL.
+
+# Copyright 2024 Ian Kelling
 
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+
 set -eE -o pipefail
 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
 
 [[ $EUID == 0 ]] || exec sudo "$BASH_SOURCE" "$@"
 
 usage() {
-    cat <<EOF
+  cat <<EOF
 Usage: ${0##*/} []
 Install or uninstall files to /usr/local/bin
 
@@ -29,20 +37,20 @@ Install or uninstall files to /usr/local/bin
 
 Note: Uses GNU getopt options parsing style
 EOF
-    exit $1
+  exit $1
 }
 dry=false
 uninstall=false # default
 temp=$(getopt -l help,uninstall,dry-run hun "$@") || usage 1
 eval set -- "$temp"
 while true; do
-    case $1 in
-        -n|--dry-run) dry=true; shift ;;
-        -u|--uninstall) uninstall=true; shift ;;
-        -h|--help) usage ;;
-        --) shift; break ;;
-        *) echo "$0: Internal error! unexpected args: $*" ; exit 1 ;;
-    esac
+  case $1 in
+    -n|--dry-run) dry=true; shift ;;
+    -u|--uninstall) uninstall=true; shift ;;
+    -h|--help) usage ;;
+    --) shift; break ;;
+    *) echo "$0: Internal error! unexpected args: $*" ; exit 1 ;;
+  esac
 done
 
 
@@ -50,23 +58,23 @@ x="$(readlink -f "$BASH_SOURCE")"; cd ${x%/*} # directory of this file
 
 files=()
 for f in *; do
-    if [[ -x $f && ! -d $f && ! -L $f && $f != setup ]]; then
-        files+=($f)
-    fi
+  if [[ -x $f && ! -d $f && ! -L $f && $f != setup ]]; then
+    files+=($f)
+  fi
 done
 
 if $uninstall; then
-    if $dry; then
-        echo "setup dry run: cd /usr/local/bin"
-        echo "setup dry run: rm -fv ${files[*]}"
-    else
-        cd /usr/local/bin
-        rm -fv ${files[@]}
-    fi
+  if $dry; then
+    echo "setup dry run: cd /usr/local/bin"
+    echo "setup dry run: rm -fv ${files[*]}"
+  else
+    cd /usr/local/bin
+    rm -fv ${files[@]}
+  fi
 else
-    if $dry; then
-        echo "setup dry run: install -v ${files[*]} /usr/local/bin"
-    else
-        install -v ${files[@]} /usr/local/bin
-    fi
+  if $dry; then
+    echo "setup dry run: install ${files[*]} /usr/local/bin"
+  else
+    install -C ${files[@]} /usr/local/bin
+  fi
 fi