From 8851530afb57a97830a20f5290da64e76e0175e0 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 6 Mar 2007 00:45:33 +0000 Subject: [PATCH] * Setting boot.localCommands for anything you want to execute before Upstart is started. svn path=/nixos/trunk/; revision=8229 --- boot/boot-stage-2-init.sh | 4 ++++ boot/boot-stage-2.nix | 6 +++++- system/options.nix | 10 ++++++++++ system/system.nix | 3 ++- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/boot/boot-stage-2-init.sh b/boot/boot-stage-2-init.sh index 5eab996beb2..7b0d48c73bc 100644 --- a/boot/boot-stage-2-init.sh +++ b/boot/boot-stage-2-init.sh @@ -100,6 +100,10 @@ mknod -m 0644 /dev/urandom c 1 9 # needed for passwd export MODULE_DIR=@kernel@/lib/modules/ +# Run any user-specified commands. +@shell@ @bootLocal@ + + # Start an interactive shell. #exec @shell@ diff --git a/boot/boot-stage-2.nix b/boot/boot-stage-2.nix index 8772759aaf4..d5f4f4bacf6 100644 --- a/boot/boot-stage-2.nix +++ b/boot/boot-stage-2.nix @@ -1,4 +1,4 @@ -{ substituteAll, coreutils +{ substituteAll, writeText, coreutils , utillinux, kernel, udev, upstart , activateConfiguration @@ -8,6 +8,9 @@ , # Path for Upstart jobs. Should be quite minimal. upstartPath + +, # User-supplied command to be run just before Upstart is started. + bootLocal ? "" }: substituteAll { @@ -20,4 +23,5 @@ substituteAll { udev upstart ]; + bootLocal = writeText "boot.local" bootLocal; } diff --git a/system/options.nix b/system/options.nix index fa3a6f07744..5bc09612503 100644 --- a/system/options.nix +++ b/system/options.nix @@ -179,6 +179,16 @@ } + { + name = ["boot" "localCommands"]; + default = ""; + example = "text=anything; echo You can put $text here."; + description = " + Shell commands to be executed just before Upstart is started. + "; + } + + { name = ["networking" "hostName"]; default = "nixos"; diff --git a/system/system.nix b/system/system.nix index e4c093c5dd2..6b2c8000010 100644 --- a/system/system.nix +++ b/system/system.nix @@ -248,7 +248,7 @@ rec { # The init script of boot stage 2, which is supposed to do # everything else to bring up the system. bootStage2 = import ../boot/boot-stage-2.nix { - inherit (pkgs) substituteAll coreutils + inherit (pkgs) substituteAll writeText coreutils utillinux kernel udev upstart; inherit activateConfiguration; readOnlyRoot = config.get ["boot" "readOnlyRoot"]; @@ -259,6 +259,7 @@ rec { pkgs.gnused pkgs.upstart ]; + bootLocal = config.get ["boot" "localCommands"]; };