nixpkgs/configuration/switch-to-configuration.sh
Eelco Dolstra acf656125c * Lots of refactoring.
* Clear the PATH in most scripts.  This helps to ensure purity.

svn path=/nixos/trunk/; revision=7299
2006-12-10 22:29:44 +00:00

38 lines
945 B
Bash

#! @shell@
set -e
export PATH=/empty
for i in @path@; do PATH=$PATH:$i/bin; done
action="$1"
if test -z "$action"; then
cat <<EOF
Usage: $0 [switch|boot|test]
switch: make the configuration the boot default and activate now
boot: make the configuration the boot default
test: activate the configuration, but don't make it the boot default
EOF
exit 1
fi
if test "$action" = "switch" -o "$action" = "boot"; then
if test -n "@grubDevice@"; then
mkdir -m 0700 -p /boot/grub
@grubMenuBuilder@ @out@
if test "$NIXOS_INSTALL_GRUB" = 1; then
@grub@/sbin/grub-install "@grubDevice@" --no-floppy --recheck
fi
else
echo "Warning: don't know how to make this configuration bootable" 1>&2
fi
fi
if test "$action" = "switch" -o "$action" = "test"; then
echo "Activating the configuration..."
@out@/activate
kill -TERM 1 # make Upstart reload its events
fi
sync