summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2015-09-18 19:22:30 +0200
committerMatthias Beyer <mail@beyermatthias.de>2015-09-18 19:22:30 +0200
commit0cfdf27ff951306458502e049dda1ad0748bb830 (patch)
tree30851fbbad05816e155fe669c1ed0df3ab3502d1
parenta29bcf131cf172d9d52f1e54b2de3c43fb6af587 (diff)
parent2a5f0f927ac6d3519b11d4be3aab5dc70b8dbc6c (diff)
Merge pull request #89 from matthiasbeyer/fix-switch-nixpkgs_tag_generating
Fix: switch: Generate tag only if argument for it is passed
-rwxr-xr-xnix-script-switch.sh25
1 files changed, 20 insertions, 5 deletions
diff --git a/nix-script-switch.sh b/nix-script-switch.sh
index 19b04a2..3c1e7c9 100755
--- a/nix-script-switch.sh
+++ b/nix-script-switch.sh
@@ -15,7 +15,7 @@ usage() {
-w <path> Path to your configuration git directory (default: '$RC_CONFIG')
-n DON'T include hostname in tag name
-t <tagname> Custom tag name
- -p <pkgs> Generate the switch tag in the nixpkgs at <pkgs> as well. (default: '$RC_NIXPKGS')
+ -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.
-h Show this help and exit
@@ -59,6 +59,7 @@ ARGS=
WD=$RC_CONFIG
TAG_NAME=
HOSTNAME="$(hostname)"
+TAG_NIXPKGS=0
NIXPKGS=$RC_NIXPKGS
TAG_FLAGS="$RC_SWITCH_DEFAULT_TAG_FLAGS"
TAG_FLAGS_NIXPKGS="$RC_SWITCH_DEFAULT_TAG_FLAGS_NIXPKGS"
@@ -84,7 +85,11 @@ do
;;
p)
- NIXPKGS=$OPTARG
+ if [[ ! -z "$OPTARG" ]]
+ then
+ NIXPKGS=$OPTARG
+ fi
+ TAG_NIXPKGS=1
;;
f)
@@ -165,10 +170,20 @@ then
__git "$WD" tag $TAG_FLAGS "$TAG_NAME"
- if [[ ! -z "$NIXPKGS" ]]
+ if [[ $TAG_NIXPKGS -eq 1 ]]
then
- stdout "Trying to generate tag in $NIXPKGS"
- tag_nixpkgs "$NIXPKGS"
+ if [[ ! -z "$NIXPKGS" ]]
+ then
+ stdout "Trying to generate tag in $NIXPKGS"
+ tag_nixpkgs "$NIXPKGS"
+ else
+ stderr "Do not generate a tag in the nixpkgs clon"
+ stderr "no NIXPKGS given."
+ usage
+ stderr "Continuing..."
+ fi
+ else
+ stdout "nixpkgs tag generating disabled"
fi
else