* In the activation script, don't require the path to the "system"

derivation on the command line.

svn path=/nixos/trunk/; revision=23770
This commit is contained in:
Eelco Dolstra 2010-09-13 18:19:15 +00:00
parent d48e2fdb4d
commit 4046056cdc
6 changed files with 18 additions and 17 deletions

View File

@ -51,10 +51,12 @@ in
merge = mergeTypedOption "script" builtins.isAttrs (fold mergeAttrs {}); merge = mergeTypedOption "script" builtins.isAttrs (fold mergeAttrs {});
apply = set: { apply = set: {
script = pkgs.writeScript "nixos-activation-script" script =
'' ''
#! ${pkgs.stdenv.shell} #! ${pkgs.stdenv.shell}
systemConfig=@out@
export PATH=/empty export PATH=/empty
for i in ${toString path}; do for i in ${toString path}; do
PATH=$PATH:$i/bin:$i/sbin; PATH=$PATH:$i/bin:$i/sbin;
@ -87,14 +89,6 @@ in
config = { config = {
system.activationScripts.systemConfig =
''
systemConfig="$1"
if test -z "$systemConfig"; then
systemConfig="/system" # for the installation CD
fi
'';
system.activationScripts.stdio = system.activationScripts.stdio =
'' ''
# Needed by some programs. # Needed by some programs.

View File

@ -102,9 +102,15 @@ let
if [ -n "$grub" ]; then if [ -n "$grub" ]; then
ln -s $grub $out/grub ln -s $grub $out/grub
fi fi
ln -s ${config.system.build.bootStage2} $out/init ln -s ${config.system.build.bootStage2} $out/init
ln -s ${config.system.build.initialRamdisk}/initrd $out/initrd ln -s ${config.system.build.initialRamdisk}/initrd $out/initrd
ln -s ${config.system.activationScripts.script} $out/activate
echo "$activationScript" > $out/activate
substituteInPlace $out/activate --subst-var out
chmod u+x $out/activate
unset activationScript
ln -s ${config.system.build.etc}/etc $out/etc ln -s ${config.system.build.etc}/etc $out/etc
ln -s ${config.system.path} $out/sw ln -s ${config.system.path} $out/sw
ln -s ${config.system.build.upstart} $out/upstart ln -s ${config.system.build.upstart} $out/upstart
@ -142,6 +148,7 @@ let
config.boot.kernelParams ++ config.boot.extraKernelParams; config.boot.kernelParams ++ config.boot.extraKernelParams;
menuBuilder = config.system.build.menuBuilder; menuBuilder = config.system.build.menuBuilder;
initScriptBuilder = config.system.build.initScriptBuilder; initScriptBuilder = config.system.build.initScriptBuilder;
activationScript = config.system.activationScripts.script;
# Most of these are needed by grub-install. # Most of these are needed by grub-install.
path = [ path = [
pkgs.coreutils pkgs.coreutils

View File

@ -153,7 +153,7 @@ fi
# 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.
echo "running activation script..." echo "running activation script..."
@activateConfiguration@ "$systemConfig" "$systemConfig"/activate
# Record the boot configuration. # Record the boot configuration.

View File

@ -43,7 +43,7 @@ let
bootStage2 = substituteAll { bootStage2 = substituteAll {
src = ./stage-2-init.sh; src = ./stage-2-init.sh;
isExecutable = true; isExecutable = true;
inherit kernel activateConfiguration; inherit kernel;
inherit (config.boot) devShmSize; inherit (config.boot) devShmSize;
ttyGid = config.ids.gids.tty; ttyGid = config.ids.gids.tty;
upstart = config.system.build.upstart; upstart = config.system.build.upstart;

View File

@ -55,7 +55,7 @@ in
system.build.etc = etc; system.build.etc = etc;
system.activationScripts.etc = stringAfter [ "systemConfig" "stdio" ] system.activationScripts.etc = stringAfter [ "stdio" ]
'' ''
# Set up the statically computed bits of /etc. # Set up the statically computed bits of /etc.
echo "setting up /etc..." echo "setting up /etc..."

View File

@ -82,8 +82,8 @@ in
jobs.klogd.preStart = "dmesg -c > /dev/null"; jobs.klogd.preStart = "dmesg -c > /dev/null";
# Prevent tests from accessing the Internet. # Prevent tests from accessing the Internet.
networking.defaultGateway = mkOverrideTemplate 150 {} ""; networking.defaultGateway = mkOverride 150 "";
networking.nameservers = mkOverrideTemplate 150 {} [ ]; networking.nameservers = mkOverride 150 [ ];
# Require a patch to the kernel to increase the 15s CIFS timeout. # Require a patch to the kernel to increase the 15s CIFS timeout.
assertions = assertions =