From 668c146e33291e933ccfb19fd39fab9cd2b7900d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 23 Jan 2007 13:44:41 +0000 Subject: [PATCH] * Doh! Make sure that we put *only* splash_helper in the initrd and not all of splashutils, otherwise we get Glibc in the initrd. svn path=/nixos/trunk/; revision=7771 --- configuration/rescue-cd.nix | 10 +++++++-- doc/manual/manual.xml | 1 + helpers/make-iso9660-image.nix | 31 ++++++++++++++------------- helpers/make-iso9660-image.sh | 38 ++++++++++++++++++++++++++-------- system/system.nix | 5 ++++- upstart-jobs/nscd.conf | 5 +++-- 6 files changed, 62 insertions(+), 28 deletions(-) diff --git a/configuration/rescue-cd.nix b/configuration/rescue-cd.nix index 661bcdf33a56..52bd0888f7d2 100644 --- a/configuration/rescue-cd.nix +++ b/configuration/rescue-cd.nix @@ -128,7 +128,8 @@ rec { rescueCD = import ../helpers/make-iso9660-image.nix { inherit (pkgs) stdenv cdrtools; isoName = "nixos.iso"; - + + # Single files to be copied to fixed locations on the CD. contents = [ { source = pkgs.syslinux + "/lib/syslinux/isolinux.bin"; target = "isolinux/isolinux.bin"; @@ -153,7 +154,12 @@ rec { } ]; - init = system.bootStage2; + # Closures to be copied to the Nix store on the CD. + storeContents = [ + { object = system.bootStage2; + symlink = "/init"; + } + ]; bootable = true; bootImage = "isolinux/isolinux.bin"; diff --git a/doc/manual/manual.xml b/doc/manual/manual.xml index a20c8e93a335..96368ed68763 100644 --- a/doc/manual/manual.xml +++ b/doc/manual/manual.xml @@ -19,6 +19,7 @@ + \ No newline at end of file diff --git a/helpers/make-iso9660-image.nix b/helpers/make-iso9660-image.nix index e98de8ffcb44..3cecb6106e5c 100644 --- a/helpers/make-iso9660-image.nix +++ b/helpers/make-iso9660-image.nix @@ -9,16 +9,12 @@ # grafted in the file system at path `target'. contents -/* , # In addition to `contents', the closure of the store paths listed - # in `packages' are also placed in the file system. - packages ? [] -*/ - -, # `init' should be a store path, the closure of which is added to - # the image, just like `packages'. However, in addition, a symlink - # `/init' to `init' will be created. - init ? null + # in `packages' are also placed in the Nix store of the CD. This is + # a list of attribute sets {source, target} where `source' if a + # store path whose closure will be copied, and `target' is a symlink + # to `source' that will be added to the CD. + storeContents ? [] # Whether this should be an El-Torito bootable CD. , bootable ? false @@ -34,11 +30,18 @@ stdenv.mkDerivation { name = "iso9660-image"; builder = ./make-iso9660-image.sh; buildInputs = [cdrtools]; - inherit isoName init bootable bootImage; - sources = map ({source, target}: source) contents; - targets = map ({source, target}: target) contents; + inherit isoName bootable bootImage; - # For obtaining the closure of `init'. - exportReferencesGraph = ["init-closure" init]; + # !!! should use XML. + sources = map (x: x.source) contents; + targets = map (x: x.target) contents; + + # !!! should use XML. + objects = map (x: x.object) storeContents; + symlinks = map (x: x.symlink) storeContents; + + # For obtaining the closure of `storeContents'. + exportReferencesGraph = + map (x: [("closure-" + baseNameOf x.symlink) x.object]) storeContents; pathsFromGraph = ./paths-from-graph.sh; } diff --git a/helpers/make-iso9660-image.sh b/helpers/make-iso9660-image.sh index 9a8bef7416d2..1fa04aef7b21 100644 --- a/helpers/make-iso9660-image.sh +++ b/helpers/make-iso9660-image.sh @@ -1,26 +1,46 @@ source $stdenv/setup +sources_=($sources) +targets_=($targets) + +objects=($objects) +symlinks=($symlinks) + + if test -n "$bootable"; then bootFlags="-b $bootImage -c boot.cat -no-emul-boot -boot-load-size 4" fi + graftList= -sources_=($sources) -targets_=($targets) for ((i = 0; i < ${#targets_[@]}; i++)); do graftList="$graftList ${targets_[$i]}=$(readlink -f ${sources_[$i]})" done -storePaths=$($SHELL $pathsFromGraph ./init-closure) -for i in $storePaths; do - graftList="$graftList ${i:1}=$i" +for ((n = 0; n < ${#objects[*]}; n++)); do + object=${objects[$n]} + symlink=${symlinks[$n]} + + # Get the paths in the closure of `object'. + closure=closure-$(basename $symlink) + if ! test -e $closure; then + echo 'Your Nix installation is too old! Upgrade to nix-0.11pre7038 or newer.' + exit 1 + fi + storePaths=$($SHELL $pathsFromGraph $closure) + + for i in $storePaths; do + graftList="$graftList ${i:1}=$i" + done + + if test "$symlink" != "none"; then + mkdir -p $(dirname ./$symlink) + ln -s $object ./$symlink + graftList="$graftList $symlink=./$symlink" + fi done -if test -n "$init"; then - ln -s $init init - graftList="$graftList init=init" -fi # !!! -f is a quick hack. ensureDir $out/iso diff --git a/system/system.nix b/system/system.nix index 13ecce79c873..b63e48ce201b 100644 --- a/system/system.nix +++ b/system/system.nix @@ -92,7 +92,10 @@ rec { symlink = "/init"; } ] ++ (if config.get ["boot" "initrd" "enableSplashScreen"] then [ - { object = pkgs.splashutils; + { object = pkgs.runCommand "splashutils" {} " + ensureDir $out/bin + cp ${pkgs.splashutils}/bin/splash_helper $out/bin + "; suffix = "/bin/splash_helper"; symlink = "/sbin/splash_helper"; } diff --git a/upstart-jobs/nscd.conf b/upstart-jobs/nscd.conf index 786f5fdd8ac9..6d0dcacf9778 100644 --- a/upstart-jobs/nscd.conf +++ b/upstart-jobs/nscd.conf @@ -1,4 +1,5 @@ server-user nscd +threads 1 paranoia no debug-level 0 @@ -7,7 +8,7 @@ positive-time-to-live passwd 600 negative-time-to-live passwd 20 suggested-size passwd 211 check-files passwd yes -persistent passwd yes +persistent passwd no shared passwd yes enable-cache group yes @@ -15,7 +16,7 @@ positive-time-to-live group 3600 negative-time-to-live group 60 suggested-size group 211 check-files group yes -persistent group yes +persistent group no shared group yes enable-cache hosts yes