diff --git a/deploy.sh b/deploy.sh index e74b71a..9b3ae4b 100755 --- a/deploy.sh +++ b/deploy.sh @@ -3,6 +3,7 @@ set -euo pipefail TARGET_KERNEL= +VERBOSE=false function main() { local VERSION @@ -19,13 +20,21 @@ function get_version() { } function parse-cli-args() { - while $#; do + while [[ $# -gt 0 ]]; do case "$1" in + -v | --verbose) + VERBOSE=true + shift + ;; -h | --help) - print-usage >&2 - exit 1 + print-usage + exit 0 ;; *) + if [[ -n "${TARGET_KERNEL}" ]]; then + echo "Only one target kernel can be specified!" >&2 + exit 1 + fi TARGET_KERNEL="$1" shift ;; @@ -35,13 +44,14 @@ function parse-cli-args() { function print-usage() { cat </dev/null || true } - function put_sources_in_place() { local VERSION="$1" - sudo rsync --delete --exclude=.git -rvhP ./ "/usr/src/rtl88x2bu-${VERSION}" + sudo rsync --delete --exclude=.git -rvhP ./ "/usr/src/rtl88x2bu-${VERSION}" >/dev/null + log "Sources copied to /usr/src/rtl88x2bu-${VERSION}" } function deploy_driver() { @@ -89,4 +99,10 @@ function list-kernels() { fi } +function log() { + if [[ "$VERBOSE" = "true" ]]; then + echo "$1" + fi +} + main "$@"