* /var/run/current-system symlinks to the top-level path of the system

configuration now.
* /var/run/booted-system symlinks to the system configuration used at
  boot time.

svn path=/nixos/trunk/; revision=8381
This commit is contained in:
Eelco Dolstra 2007-03-20 13:01:53 +00:00
parent 8447e036fd
commit c10fe148a3
6 changed files with 20 additions and 8 deletions

View File

@ -62,6 +62,10 @@ for o in $(cat /proc/cmdline); do
safemode) safemode)
safeMode=1 safeMode=1
;; ;;
systemConfig=*)
set -- $(IFS==; echo $o)
systemConfig=$2
;;
esac esac
done done
@ -93,7 +97,13 @@ mknod -m 0644 /dev/urandom c 1 9 # needed for passwd
# Run the script that performs all configuration activation that does # Run the script that performs all configuration activation that does
# not have to be done at boot time. # not have to be done at boot time.
@activateConfiguration@ @activateConfiguration@ "$systemConfig"
# Record the boot configuration. !!! Should this be a GC root?
if test -n "$systemConfig"; then
ln -sfn "$systemConfig" /var/run/booted-system
fi
# Ensure that the module tools can find the kernel modules. # Ensure that the module tools can find the kernel modules.
@ -104,10 +114,6 @@ export MODULE_DIR=@kernel@/lib/modules/
@shell@ @bootLocal@ @shell@ @bootLocal@
# Start an interactive shell.
#exec @shell@
# Start Upstart's init. # Start Upstart's init.
export UPSTART_CFG_DIR=/etc/event.d export UPSTART_CFG_DIR=/etc/event.d
setPath "@upstartPath@" setPath "@upstartPath@"

View File

@ -48,7 +48,7 @@ addEntry() {
cat >> $tmp << GRUBEND cat >> $tmp << GRUBEND
title $name title $name
kernel $kernel init=$(readlink -f $path/init) $(cat $path/kernel-params) kernel $kernel systemConfig=$(readlink -f $path) init=$(readlink -f $path/init) $(cat $path/kernel-params)
initrd $initrd initrd $initrd
GRUBEND GRUBEND
} }

View File

@ -1,5 +1,7 @@
#! @shell@ #! @shell@
systemConfig="$1"
export PATH=/empty export PATH=/empty
for i in @path@; do PATH=$PATH:$i/bin:$i/sbin; done for i in @path@; do PATH=$PATH:$i/bin:$i/sbin; done
@ -138,7 +140,9 @@ hostname @hostName@
# Make this configuration the current configuration. # Make this configuration the current configuration.
ln -sfn @out@ /var/run/current-system if test -n "$systemConfig"; then
ln -sfn "$systemConfig" /var/run/current-system
fi
# Prevent the current configuration from being garbage-collected. # Prevent the current configuration from being garbage-collected.
ln -sfn /var/run/current-system /nix/var/nix/gcroots/current-system ln -sfn /var/run/current-system /nix/var/nix/gcroots/current-system

View File

@ -62,7 +62,7 @@ if test "$action" = "switch" -o "$action" = "test"; then
# Activate the new configuration (i.e., update /etc, make # Activate the new configuration (i.e., update /etc, make
# accounts, and so on). # accounts, and so on).
echo "Activating the configuration..." echo "Activating the configuration..."
@out@/activate @out@/activate @out@
# Make Upstart reload its events. !!! Should wait until it has # Make Upstart reload its events. !!! Should wait until it has
# finished processing its stop events. # finished processing its stop events.

View File

@ -294,6 +294,7 @@ rec {
inherit activateConfiguration; inherit activateConfiguration;
inherit grubMenuBuilder; inherit grubMenuBuilder;
inherit etc; inherit etc;
inherit systemPath;
kernel = pkgs.kernel + "/vmlinuz"; kernel = pkgs.kernel + "/vmlinuz";
initrd = initialRamdisk + "/initrd"; initrd = initialRamdisk + "/initrd";
# Most of these are needed by grub-install. # Most of these are needed by grub-install.

View File

@ -8,6 +8,7 @@ ln -s $bootStage2 $out/init
ln -s $initrd $out/initrd ln -s $initrd $out/initrd
ln -s $activateConfiguration $out/activate ln -s $activateConfiguration $out/activate
ln -s $etc/etc $out/etc ln -s $etc/etc $out/etc
ln -s $systemPath $out/sw
echo "$kernelParams" > $out/kernel-params echo "$kernelParams" > $out/kernel-params