summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-06-15 10:33:52 +0200
committerMatthias Beyer <mail@beyermatthias.de>2016-06-19 15:16:01 +0200
commit4ce68819b673eb4ec40fbd49d6e5e0aae1205e37 (patch)
treed038bfec854dc509a4bd6ac51dd15d78e0bd8ffb
parent9f1d43384da1113f4db2b5010fe57a9f9c16bca3 (diff)
Add flag (-C) to append channel generation to tag name
-rwxr-xr-xnix-script-switch.sh18
1 files changed, 17 insertions, 1 deletions
diff --git a/nix-script-switch.sh b/nix-script-switch.sh
index e91fe8c..7fc3b9c 100755
--- a/nix-script-switch.sh
+++ b/nix-script-switch.sh
@@ -22,6 +22,8 @@ usage() {
-t <tagname> Custom tag name
+ -C Append channel generation in tag (<tag>-channel-<gen>)
+
-p [<pkgs>] Generate the switch tag in the nixpkgs at <pkgs>
as well. (default: '$RC_NIXPKGS')
@@ -78,6 +80,7 @@ COMMAND=switch
ARGS=
WD=$RC_CONFIG
TAG_NAME=
+APPEND_CHANNEL_GEN=
HOSTNAME="$(hostname)"
TAG_NIXPKGS=0
NIXPKGS=$RC_NIXPKGS
@@ -89,7 +92,7 @@ DONT_BUILD=
QUIET=1
USE_ALTERNATIVE_SOURCE_NIXPKGS=0
-while getopts "c:w:t:nbp:f:qs:r:h" OPTION
+while getopts "c:w:t:Cnbp:f:qs:r:h" OPTION
do
case $OPTION in
c)
@@ -107,6 +110,11 @@ do
dbg "TAG_NAME = $TAG_NAME"
;;
+ C)
+ APPEND_CHANNEL_GEN=1
+ dbg "APPEND_CHANNEL_GEN = $APPEND_CHANNEL_GEN"
+ ;;
+
n)
HOSTNAME=""
dbg "HOSTNAME = $HOSTNAME"
@@ -207,6 +215,14 @@ then
fi
fi
+if [[ $APPEND_CHANNEL_GEN -eq 1 ]]; then
+ dbg "Appending channel generation to tag name"
+ TAG_NAME="${TAG_NAME}-channel-$(current_channel_generation)"
+ dbg "TAG_NAME = $TAG_NAME"
+else
+ dbg "Not appending channel generation to tag name"
+fi
+
if [[ "$COMMAND" =~ "build" ]]
then
stdout "Command is 'build'. Not generating config tag"