diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2016-06-15 10:43:53 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-06-19 15:16:01 +0200 |
commit | c58fe70fa1de0015f8cf824a2eab53a7715b28b1 (patch) | |
tree | ccafa3e3cea00462c910294008f52891a78ec06d | |
parent | 022de6e384043e9a5b0a02edc2bf5e7fdfc80262 (diff) |
Add flag to add the channel name in the tag for channel-update tags
-rwxr-xr-x | nix-script-channel-update.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/nix-script-channel-update.sh b/nix-script-channel-update.sh index 505e4b0..ca4ef93 100755 --- a/nix-script-channel-update.sh +++ b/nix-script-channel-update.sh @@ -7,6 +7,7 @@ usage() { $(help_synopsis "channel" "update [-h] [-t <name>] [-w <cfgdir>] [-n]") -t <name> | Name for the new tag, instead of nixos-<host>-channel-<num> + -n | Add channel name (from config) in the tag name, currently: $RC_CHANNEL_NAME -w <cfgdir> | Alternative config dir, default: $RC_CONFIG -n | DON'T include hostname in tag name -h | Show this help and exit @@ -16,6 +17,7 @@ EOS } TAG_NAME="" +ADD_CHANNEL_NAME=0 CONFIG=$RC_CONFIG HOST="$(hostname)" @@ -27,6 +29,11 @@ do dbg "TAG_NAME = $TAG_NAME" ;; + n) + ADD_CHANNEL_NAME=1 + dbg "ADD_CHANNEL_NAME = $ADD_CHANNEL_NAME" + ;; + w) CONFIG=$OPTARG dbg "CONFIG = $CONFIG" @@ -61,6 +68,17 @@ then stdout "Tag name: '$TAG_NAME'" fi +if [[ $ADD_CHANNEL_NAME -eq 1 ]]; then + [[ -z "$RC_CHANNEL_NAME" ]] && \ + stderr "RC SETTING MISSING: RC_CHANNEL_NAME" && exit 1 + + dbg "Add the channel name in the tag" + TAG_NAME="${TAG_NAME}-${RC_CHANNEL_NAME}" + dbg "TAG_NAME = ${TAG_NAME}" +else + dbg "Do not add the channel name in the tag" +fi + stdout "Resetting sudo password" sudo -k |