summary refs log tree commit diff
path: root/modules/installer/tools/nixos-rebuild.sh
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-01-16 13:21:59 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-01-16 13:21:59 +0100
commitea358b4eae2509722b849c054fdff69cc31ac8c7 (patch)
treef6cce3d8a5de6e092a98f750958e095aac7c47d6 /modules/installer/tools/nixos-rebuild.sh
parent4d983d4955fcb6eb6b633b216ee0e29839b3b4a5 (diff)
downloadnixpkgs-ea358b4eae2509722b849c054fdff69cc31ac8c7.tar
nixpkgs-ea358b4eae2509722b849c054fdff69cc31ac8c7.tar.gz
nixpkgs-ea358b4eae2509722b849c054fdff69cc31ac8c7.tar.bz2
nixpkgs-ea358b4eae2509722b849c054fdff69cc31ac8c7.tar.lz
nixpkgs-ea358b4eae2509722b849c054fdff69cc31ac8c7.tar.xz
nixpkgs-ea358b4eae2509722b849c054fdff69cc31ac8c7.tar.zst
nixpkgs-ea358b4eae2509722b849c054fdff69cc31ac8c7.zip
nixos-rebuild: Use ‘[ ... ]’ instead of ‘test’
Diffstat (limited to 'modules/installer/tools/nixos-rebuild.sh')
-rw-r--r--modules/installer/tools/nixos-rebuild.sh24
1 files changed, 12 insertions, 12 deletions
diff --git a/modules/installer/tools/nixos-rebuild.sh b/modules/installer/tools/nixos-rebuild.sh
index 66acf908710..0b149610e32 100644
--- a/modules/installer/tools/nixos-rebuild.sh
+++ b/modules/installer/tools/nixos-rebuild.sh
@@ -50,7 +50,7 @@ buildNix=1
 rollback=
 upgrade=
 
-while test "$#" -gt 0; do
+while [ "$#" -gt 0 ]; do
     i="$1"; shift 1
     case "$i" in
       --help)
@@ -94,13 +94,13 @@ while test "$#" -gt 0; do
     esac
 done
 
-if test -z "$action"; then showSyntax; fi
+if [ -z "$action" ]; then showSyntax; fi
 
-if test "$action" = dry-run; then
+if [ "$action" = dry-run ]; then
     extraBuildFlags+=(--dry-run)
 fi
 
-if test -n "$rollback"; then
+if [ -n "$rollback" ]; then
     buildNix=
 fi
 
@@ -143,12 +143,12 @@ fi
 # Either upgrade the configuration in the system profile (for "switch"
 # or "boot"), or just build it and create a symlink "result" in the
 # current directory (for "build" and "test").
-if test -z "$rollback"; then
+if [ -z "$rollback" ]; then
     echo "building the system configuration..." >&2
-    if test "$action" = switch -o "$action" = boot; then
+    if [ "$action" = switch -o "$action" = boot ]; then
         nix-env "${extraBuildFlags[@]}" -p /nix/var/nix/profiles/system -f '<nixos>' --set -A system
         pathToConfig=/nix/var/nix/profiles/system
-    elif test "$action" = test -o "$action" = build -o "$action" = dry-run; then
+    elif [ "$action" = test -o "$action" = build -o "$action" = dry-run ]; then
         nix-build '<nixos>' -A system -K -k "${extraBuildFlags[@]}" > /dev/null
         pathToConfig=./result
     elif [ "$action" = build-vm ]; then
@@ -160,11 +160,11 @@ if test -z "$rollback"; then
     else
         showSyntax
     fi
-else # test -n "$rollback"
-    if test "$action" = switch -o "$action" = boot; then
+else # [ -n "$rollback" ]
+    if [ "$action" = switch -o "$action" = boot ]; then
         nix-env --rollback -p /nix/var/nix/profiles/system
         pathToConfig=/nix/var/nix/profiles/system
-    elif test "$action" = test -o "$action" = build; then
+    elif [ "$action" = test -o "$action" = build ]; then
         systemNumber=$(
             nix-env -p /nix/var/nix/profiles/system --list-generations |
             sed -n '/current/ {g; p;}; s/ *\([0-9]*\).*/\1/; h'
@@ -179,7 +179,7 @@ fi
 
 # If we're not just building, then make the new configuration the boot
 # default and/or activate it now.
-if test "$action" = switch -o "$action" = boot -o "$action" = test; then
+if [ "$action" = switch -o "$action" = boot -o "$action" = test ]; then
     # Just in case the new configuration hangs the system, do a sync now.
     sync
 
@@ -187,7 +187,7 @@ if test "$action" = switch -o "$action" = boot -o "$action" = test; then
 fi
 
 
-if test "$action" = build-vm; then
+if [ "$action" = build-vm ]; then
     cat >&2 <<EOF
 
 Done.  The virtual machine can be started by running $(echo $pathToConfig/bin/run-*-vm).