diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2015-09-23 22:03:24 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2015-09-23 22:03:24 +0200 |
commit | e27c36908e61b267330e063ae11f5efdfed70626 (patch) | |
tree | 1b63274e9b69849c9ca55cad564de40a98d896c5 | |
parent | 94bf820fc9c85effddb7214a9f0b0a154f23466f (diff) | |
parent | 6c74642f191452d69485a82df5c78f6ad51260a6 (diff) |
Merge pull request #92 from matthiasbeyer/quiet-by-default
switch: Be quiet by default
-rwxr-xr-x | nix-script-switch.sh | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/nix-script-switch.sh b/nix-script-switch.sh index 3c1e7c9..749b929 100755 --- a/nix-script-switch.sh +++ b/nix-script-switch.sh @@ -9,7 +9,7 @@ COMMAND="switch" usage() { cat <<EOS - $(help_synopsis "${BASH_SOURCE[0]}" "[-h] [-c <command>] [-w <working directory>] [-- args...]") + $(help_synopsis "${BASH_SOURCE[0]}" "[-h] [-q] [-c <command>] [-w <working directory>] [-- args...]") -c <command> Command for nixos-rebuild. See 'man nixos-rebuild' (default: switch) -w <path> Path to your configuration git directory (default: '$RC_CONFIG') @@ -18,6 +18,7 @@ usage() { -p [<pkgs>] Generate the switch tag in the nixpkgs at <pkgs> as well. (default: '$RC_NIXPKGS') -f <tag-flags> Flags for git-tag (see 'git tag --help') (default: '$RC_SWITCH_DEFAULT_TAG_FLAGS') -b Do not call nixos-rebuild at all. + -q Don't pass -Q to nixos-rebuild -h Show this help and exit This command helps you rebuilding your system and keeping track @@ -64,8 +65,9 @@ NIXPKGS=$RC_NIXPKGS TAG_FLAGS="$RC_SWITCH_DEFAULT_TAG_FLAGS" TAG_FLAGS_NIXPKGS="$RC_SWITCH_DEFAULT_TAG_FLAGS_NIXPKGS" DONT_BUILD= +QUIET=1 -while getopts "c:w:t:nbp:f:h" OPTION +while getopts "c:w:t:nbp:f:qh" OPTION do case $OPTION in c) @@ -101,6 +103,11 @@ do dbg "DONT_BUILD = $DONT_BUILD" ;; + q) + QUIET=0 + dbg "QUIET = $QUIET" + ;; + h) usage exit 1 @@ -146,7 +153,9 @@ dbg "ARGS = $ARGS" if [[ -z "$DONT_BUILD" ]] then - explain sudo nixos-rebuild $COMMAND $ARGS + __q="-Q" + [[ $QUIET -eq 0 ]] && __q="" + explain sudo nixos-rebuild $__q $COMMAND $ARGS REBUILD_EXIT=$? else stdout "Do not call nixos-rebuild" |