From c58fe70fa1de0015f8cf824a2eab53a7715b28b1 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 15 Jun 2016 10:43:53 +0200 Subject: Add flag to add the channel name in the tag for channel-update tags --- nix-script-channel-update.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 ] [-w ] [-n]") -t | Name for the new tag, instead of nixos--channel- + -n | Add channel name (from config) in the tag name, currently: $RC_CHANNEL_NAME -w | 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 -- cgit v1.2.3