* Make that dry-run' (as an action) instead of
--dry-run'.
svn path=/nixos/trunk/; revision=12488
This commit is contained in:
parent
3ea5264b1b
commit
64fc690afa
@ -5,13 +5,14 @@ showSyntax() {
|
|||||||
# !!! more or less cut&paste from
|
# !!! more or less cut&paste from
|
||||||
# system/switch-to-configuration.sh (which we call, of course).
|
# system/switch-to-configuration.sh (which we call, of course).
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Usage: $0 [switch|boot|test|build]
|
Usage: $0 [switch|boot|test|build|dry-run]
|
||||||
|
|
||||||
switch: make the configuration the boot default and activate now
|
switch: make the configuration the boot default and activate now
|
||||||
boot: make the configuration the boot default
|
boot: make the configuration the boot default
|
||||||
test: activate the configuration, but don't make it the boot default
|
test: activate the configuration, but don't make it the boot default
|
||||||
build: build the configuration, but don't make it the default or
|
build: build the configuration, but don't make it the default or
|
||||||
activate it
|
activate it
|
||||||
|
dry-run: just show what store paths would be built/downloaded
|
||||||
EOF
|
EOF
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
@ -19,16 +20,12 @@ EOF
|
|||||||
|
|
||||||
# Parse the command line.
|
# Parse the command line.
|
||||||
extraBuildFlags=
|
extraBuildFlags=
|
||||||
dryRun=
|
|
||||||
action=
|
action=
|
||||||
|
|
||||||
for i in "$@"; do
|
for i in "$@"; do
|
||||||
if test "$i" = "--help"; then
|
if test "$i" = "--help"; then
|
||||||
showSyntax
|
showSyntax
|
||||||
elif test "$i" = "--dry-run"; then
|
elif test "$i" = switch -o "$i" = boot -o "$i" = test -o "$i" = build -o "$i" = dry-run; then
|
||||||
extraBuildFlags="$extraBuildFlags --dry-run"
|
|
||||||
dryRun=1
|
|
||||||
elif test "$i" = "switch" -o "$i" = "boot" -o "$i" = "test" -o "$i" = "build"; then
|
|
||||||
action="$i"
|
action="$i"
|
||||||
else
|
else
|
||||||
echo "$0: unknown option \`$i'"
|
echo "$0: unknown option \`$i'"
|
||||||
@ -38,7 +35,9 @@ done
|
|||||||
|
|
||||||
if test -z "$action"; then showSyntax; fi
|
if test -z "$action"; then showSyntax; fi
|
||||||
|
|
||||||
if test -n "$dryRun"; then action=build; fi
|
if test "$action" = dry-run; then
|
||||||
|
extraBuildFlags="$extraBuildFlags --dry-run"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Allow the location of NixOS sources and the system configuration
|
# Allow the location of NixOS sources and the system configuration
|
||||||
@ -86,10 +85,10 @@ fi
|
|||||||
# Either upgrade the configuration in the system profile (for "switch"
|
# Either upgrade the configuration in the system profile (for "switch"
|
||||||
# or "boot"), or just build it and create a symlink "result" in the
|
# or "boot"), or just build it and create a symlink "result" in the
|
||||||
# current directory (for "build" and "test").
|
# current directory (for "build" and "test").
|
||||||
if test "$action" = "switch" -o "$action" = "boot"; then
|
if test "$action" = switch -o "$action" = boot; then
|
||||||
nix-env -p /nix/var/nix/profiles/system -f $NIXOS --set -A system $extraBuildFlags
|
nix-env -p /nix/var/nix/profiles/system -f $NIXOS --set -A system $extraBuildFlags
|
||||||
pathToConfig=/nix/var/nix/profiles/system
|
pathToConfig=/nix/var/nix/profiles/system
|
||||||
elif test "$action" = "test" -o "$action" = "build"; then
|
elif test "$action" = test -o "$action" = build -o "$action" = dry-run; then
|
||||||
nix-build $NIXOS -A system -K -k $extraBuildFlags
|
nix-build $NIXOS -A system -K -k $extraBuildFlags
|
||||||
pathToConfig=./result
|
pathToConfig=./result
|
||||||
else
|
else
|
||||||
@ -99,7 +98,7 @@ fi
|
|||||||
|
|
||||||
# If we're not just building, then make the new configuration the boot
|
# If we're not just building, then make the new configuration the boot
|
||||||
# default and/or activate it now.
|
# default and/or activate it now.
|
||||||
if test "$action" = "switch" -o "$action" = "boot" -o "$action" = "test"; then
|
if test "$action" = switch -o "$action" = boot -o "$action" = test; then
|
||||||
$pathToConfig/bin/switch-to-configuration "$action"
|
$pathToConfig/bin/switch-to-configuration "$action"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user