From a9234b5c073a62faa002e61f16a601cf190df40a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 27 Nov 2006 19:49:05 +0000 Subject: [PATCH] * Moving stuff around. svn path=/nixu/trunk/; revision=7155 --- test/README | 19 -- test/boot-environment.nix | 259 ------------------- test/boot-stage-1-init.sh | 147 ----------- test/boot-stage-1.nix | 43 --- test/boot-stage-2-init.sh | 168 ------------ test/boot-stage-2.nix | 27 -- test/grub-menu-builder.sh | 52 ---- test/helpers/unpack-theme.nix | 7 - test/helpers/unpack-theme.sh | 18 -- test/installer.nix | 17 -- test/installer.sh | 132 ---------- test/isolinux.cfg | 6 - test/make-devices.sh | 53 ---- test/make-initrd.nix | 31 --- test/make-initrd.sh | 42 --- test/make-iso9660-image.nix | 44 ---- test/make-iso9660-image.sh | 31 --- test/modules-closure.nix | 13 - test/modules-closure.sh | 37 --- test/options.nix | 97 ------- test/paths-from-graph.sh | 10 - test/rescue-cd.nix | 101 -------- test/splash-themes.nix | 58 ----- test/system-configuration.nix | 55 ---- test/system-configuration.sh | 31 --- test/upgrade.sh | 4 - test/upstart-jobs/ctrl-alt-delete.nix | 12 - test/upstart-jobs/dhclient.nix | 43 --- test/upstart-jobs/gather.nix | 19 -- test/upstart-jobs/halt.nix | 41 --- test/upstart-jobs/hardware-scan.nix | 23 -- test/upstart-jobs/maintenance-shell.nix | 19 -- test/upstart-jobs/make-job.nix | 7 - test/upstart-jobs/mingetty.nix | 10 - test/upstart-jobs/network-interfaces.nix | 36 --- test/upstart-jobs/sshd.nix | 32 --- test/upstart-jobs/syslogd.nix | 10 - test/upstart-jobs/tty-backgrounds-combine.sh | 37 --- test/upstart-jobs/tty-backgrounds.nix | 52 ---- 39 files changed, 1843 deletions(-) delete mode 100644 test/README delete mode 100644 test/boot-environment.nix delete mode 100644 test/boot-stage-1-init.sh delete mode 100644 test/boot-stage-1.nix delete mode 100644 test/boot-stage-2-init.sh delete mode 100644 test/boot-stage-2.nix delete mode 100644 test/grub-menu-builder.sh delete mode 100644 test/helpers/unpack-theme.nix delete mode 100644 test/helpers/unpack-theme.sh delete mode 100644 test/installer.nix delete mode 100644 test/installer.sh delete mode 100644 test/isolinux.cfg delete mode 100644 test/make-devices.sh delete mode 100644 test/make-initrd.nix delete mode 100644 test/make-initrd.sh delete mode 100644 test/make-iso9660-image.nix delete mode 100644 test/make-iso9660-image.sh delete mode 100644 test/modules-closure.nix delete mode 100644 test/modules-closure.sh delete mode 100644 test/options.nix delete mode 100644 test/paths-from-graph.sh delete mode 100644 test/rescue-cd.nix delete mode 100644 test/splash-themes.nix delete mode 100644 test/system-configuration.nix delete mode 100644 test/system-configuration.sh delete mode 100755 test/upgrade.sh delete mode 100644 test/upstart-jobs/ctrl-alt-delete.nix delete mode 100644 test/upstart-jobs/dhclient.nix delete mode 100644 test/upstart-jobs/gather.nix delete mode 100644 test/upstart-jobs/halt.nix delete mode 100644 test/upstart-jobs/hardware-scan.nix delete mode 100644 test/upstart-jobs/maintenance-shell.nix delete mode 100644 test/upstart-jobs/make-job.nix delete mode 100644 test/upstart-jobs/mingetty.nix delete mode 100644 test/upstart-jobs/network-interfaces.nix delete mode 100644 test/upstart-jobs/sshd.nix delete mode 100644 test/upstart-jobs/syslogd.nix delete mode 100644 test/upstart-jobs/tty-backgrounds-combine.sh delete mode 100644 test/upstart-jobs/tty-backgrounds.nix diff --git a/test/README b/test/README deleted file mode 100644 index e2f76b08301b..000000000000 --- a/test/README +++ /dev/null @@ -1,19 +0,0 @@ -To get a Stage 1 shell: - -Add "debug1" to the kernel command line. - - -Switching to maintenance mode: - -$ shutdown now - -To get out of maintenance mode: - -$ initctl emit startup - - -Updating the current system configuration: - -$ nix-env -p /nix/var/nix/profiles/system -f system-configuration.nix -i -A systemConfiguration -$ /nix/var/nix/profiles/system/bin/switch-to-configuration - diff --git a/test/boot-environment.nix b/test/boot-environment.nix deleted file mode 100644 index 78086e99cfc5..000000000000 --- a/test/boot-environment.nix +++ /dev/null @@ -1,259 +0,0 @@ -{ system ? __currentSystem -, autoDetectRootDevice ? false -, rootDevice ? "" -, rootLabel ? "" -, stage2Init -, readOnlyRoot -}: - -rec { - - pkgs = import ./pkgs/top-level/all-packages.nix {inherit system;}; - - pkgsDiet = import ./pkgs/top-level/all-packages.nix { - inherit system; - bootStdenv = pkgs.useDietLibC pkgs.stdenv; - }; - - pkgsStatic = import ./pkgs/top-level/all-packages.nix { - inherit system; - bootStdenv = pkgs.makeStaticBinaries pkgs.stdenv; - }; - - stdenvLinuxStuff = import ./pkgs/stdenv/linux { - system = pkgs.stdenv.system; - allPackages = import ./pkgs/top-level/all-packages.nix; - }; - - nix = pkgs.nixUnstable; # we need the exportReferencesGraph feature - - - # Splash configuration. - splashThemes = import ./splash-themes.nix { - inherit (pkgs) fetchurl; - }; - - - # Determine the set of modules that we need to mount the root FS. - modulesClosure = import ./modules-closure.nix { - inherit (pkgs) stdenv kernel module_init_tools; - rootModules = ["ide-cd" "ide-disk" "ide-generic"]; - }; - - - # Some additional utilities needed in stage 1, notably mount. We - # don't want to bring in all of util-linux, so we just copy what we - # need. - extraUtils = pkgs.stdenv.mkDerivation { - name = "extra-utils"; - builder = builtins.toFile "builder.sh" " - source $stdenv/setup - ensureDir $out/bin - cp $utillinux/bin/mount $utillinux/bin/umount $utillinux/sbin/pivot_root $out/bin - cp -p $e2fsprogs/sbin/fsck* $e2fsprogs/sbin/e2fsck $out/bin - cp $splashutils/bin/splash_helper $out/bin - nuke-refs $out/bin/* - "; - buildInputs = [pkgs.nukeReferences]; - inherit (pkgsStatic) utillinux; - inherit (pkgs) splashutils; - e2fsprogs = pkgs.e2fsprogsDiet; - }; - - - # The init script of boot stage 1 (loading kernel modules for - # mounting the root FS). - bootStage1 = import ./boot-stage-1.nix { - inherit (pkgs) genericSubstituter; - inherit (pkgsDiet) module_init_tools; - inherit extraUtils; - inherit autoDetectRootDevice rootDevice rootLabel; - inherit stage2Init; - modules = modulesClosure; - shell = stdenvLinuxStuff.bootstrapTools.bash; - staticTools = stdenvLinuxStuff.staticTools; - }; - - - # The closure of the init script of boot stage 1 is what we put in - # the initial RAM disk. - initialRamdisk = import ./make-initrd.nix { - inherit (pkgs) stdenv cpio; - contents = [ - { object = bootStage1; - symlink = "/init"; - } - { object = extraUtils; - suffix = "/bin/splash_helper"; - symlink = "/sbin/splash_helper"; - } - { object = import ./helpers/unpack-theme.nix { - inherit (pkgs) stdenv; - theme = splashThemes.splashScreen; - }; - symlink = "/etc/splash"; - } - ]; - }; - - - # The installer. - nixosInstaller = import ./installer.nix { - inherit (pkgs) stdenv genericSubstituter; - inherit nix; - shell = pkgs.bash + "/bin/sh"; - }; - - - # The services (Upstart) configuration for the system. - upstartJobs = import ./upstart-jobs/gather.nix { - inherit (pkgs) stdenv; - - jobs = map makeJob [ - # Syslogd. - (import ./upstart-jobs/syslogd.nix { - inherit (pkgs) sysklogd; - }) - - # Hardware scan; loads modules for PCI devices. - (import ./upstart-jobs/hardware-scan.nix { - inherit (pkgs) kernel module_init_tools; - }) - - # Network interfaces. - (import ./upstart-jobs/network-interfaces.nix { - inherit (pkgs) nettools kernel module_init_tools; - }) - - # DHCP client. - (import ./upstart-jobs/dhclient.nix { - dhcp = pkgs.dhcpWrapper; - }) - - # SSH daemon. - (import ./upstart-jobs/sshd.nix { - inherit (pkgs) openssh; - }) - - # Transparent TTY backgrounds. - (import ./upstart-jobs/tty-backgrounds.nix { - inherit (pkgs) stdenv splashutils; - backgrounds = splashThemes.ttyBackgrounds; - }) - - # Handles the maintenance/stalled event (single-user shell). - (import ./upstart-jobs/maintenance-shell.nix { - inherit (pkgs) bash; - }) - - # Ctrl-alt-delete action. - (import ./upstart-jobs/ctrl-alt-delete.nix) - - ] - - # Handles the reboot/halt events. - ++ (map - (event: makeJob (import ./upstart-jobs/halt.nix { - inherit (pkgs) bash; - inherit event; - })) - ["reboot" "halt" "system-halt" "power-off"] - ) - - # The terminals on ttyX. - ++ (map - (ttyNumber: makeJob (import ./upstart-jobs/mingetty.nix { - mingetty = pkgs.mingettyWrapper; - inherit ttyNumber; - })) - [1 2 3 4 5 6] - ) - - # For the builtin logd job. - ++ [pkgs.upstart]; - }; - - - makeJob = import ./upstart-jobs/make-job.nix { - inherit (pkgs) stdenv; - }; - - - # The init script of boot stage 2, which is supposed to do - # everything else to bring up the system. - bootStage2 = import ./boot-stage-2.nix { - inherit (pkgs) genericSubstituter coreutils findutils - utillinux kernel udev upstart; - inherit upstartJobs; - shell = pkgs.bash + "/bin/sh"; - - # Additional stuff; add whatever you want here. - path = [ - pkgs.bash - pkgs.bzip2 - pkgs.cpio - pkgs.curl - pkgs.e2fsprogs - pkgs.gnugrep - pkgs.gnused - pkgs.gnutar - pkgs.grub - pkgs.gzip - pkgs.iputils - pkgs.less - pkgs.module_init_tools - pkgs.nano - pkgs.netcat - pkgs.nettools - pkgs.perl - pkgs.procps - pkgs.rsync - pkgs.shadowutils - pkgs.strace - pkgs.sysklogd -# pkgs.vim - nix - nixosInstaller - ]; - - inherit readOnlyRoot; - - hostName = config.get ["networking" "hostname"]; - }; - - - lib = import ./pkgs/lib; - - - config = rec { - - # The user configuration. - config = { - networking = { - hostname = "vindaloo"; - }; - }; - - # The option declarations, i.e., option names with defaults and - # documentation. - declarations = import ./options.nix; - - # Get the option named `name' from the user configuration, using - # its default value if it's not defined. - get = name: - let - sameName = lib.filter (opt: lib.eqLists opt.name name) declarations; - default = - if sameName == [] - then abort ("Undeclared option `" + printName name + "'.") - else if !builtins.head sameName ? default - then abort ("Option `" + printName name + "' has no default.") - else (builtins.head sameName).default; - in lib.getAttr name default config; - - printName = name: lib.concatStrings (lib.intersperse "." name); - - }; - - -} diff --git a/test/boot-stage-1-init.sh b/test/boot-stage-1-init.sh deleted file mode 100644 index d62bd1579750..000000000000 --- a/test/boot-stage-1-init.sh +++ /dev/null @@ -1,147 +0,0 @@ -#! @shell@ - -fail() { - # If starting stage 2 failed, start an interactive shell. - echo "Stage 2 failed, starting emergency shell..." - exec @shell@ -} - - -# Print a greeting. -echo -echo "<<< NixOS Stage 1 >>>" -echo - - -# Set the PATH. -export PATH=/empty -for i in @path@; do - PATH=$PATH:$i/bin - if test -e $i/sbin; then - PATH=$PATH:$i/sbin - fi -done - - -# Mount special file systems. -mkdir -p /etc # to shut up mount -touch /etc/fstab # idem -mkdir -p /proc -mount -t proc none /proc -mkdir -p /sys -mount -t sysfs none /sys - - -# Process the kernel command line. -stage2Init=@stage2Init@ -for o in $(cat /proc/cmdline); do - case $o in - init=*) - set -- $(IFS==; echo $o) - stage2Init=$2 - ;; - debugtrace) - # Show each command. - set -x - ;; - debug1) - fail - ;; - esac -done - - -# Create device nodes in /dev. -source @makeDevices@ - - -# Load some kernel modules. -export MODULE_DIR=@modules@/lib/modules/ -modprobe ide-generic -modprobe ide-disk -modprobe ide-cd - - -# Try to find and mount the root device. -mkdir /mnt -mkdir /mnt/root - -echo "mounting the root device..." - -if test -n "@autoDetectRootDevice@"; then - - # Look for the root device by label. - echo "probing for the NixOS installation CD..." - - for i in /sys/devices/*/*/media; do - if test "$(cat $i)" = "cdrom"; then - - # Hopefully `drivename' matches the device created in /dev. - devName=/dev/$(cat $(dirname $i)/drivename) - - echo " in $devName..." - - if mount -n -o ro -t iso9660 $devName /mnt/root; then - if test -e "/mnt/root/@rootLabel@"; then - found=1 - break - fi - umount /mnt/root - fi - - fi - done - - if test -z "$found"; then - echo "CD not found!" - fail - fi - -else - - # Hard-coded root device. - rootDevice="@rootDevice@" - - # Check the root device. - fsck -C -a "$rootDevice" - fsckResult=$? - - if test $(($fsckResult | 2)) = $fsckResult; then - echo "fsck finished, rebooting..." - sleep 3 - # reboot -f -d !!! don't have reboot yet - fail - fi - - if test $(($fsckResult | 4)) = $fsckResult; then - echo "$rootDevice has unrepaired errors, please fix them manually." - fail - fi - - if test $fsckResult -ge 8; then - echo "fsck on $rootDevice failed." - fail - fi - - # Mount read-writable. - mount -n -o rw "$rootDevice" /mnt/root || fail - -fi - - -# Start stage 2. -# !!! Note: we can't use pivot_root here (the kernel gods have -# decreed), but we could use run-init from klibc, which deletes all -# files in the initramfs, remounts the target root on /, and chroots. -cd /mnt/root -mount --move . / -umount /proc # cleanup -umount /sys - -echo "INIT = $stage2Init" - -if test -z "$stage2Init"; then fail; fi - -exec chroot . $stage2Init - -fail diff --git a/test/boot-stage-1.nix b/test/boot-stage-1.nix deleted file mode 100644 index ef1ebfc72255..000000000000 --- a/test/boot-stage-1.nix +++ /dev/null @@ -1,43 +0,0 @@ -# This Nix expression builds the script that performs the first stage -# of booting the system: it loads the modules necessary to mount the -# root file system, then calls /init in the root file system to start -# the second boot stage. The closure of the result of this expression -# is supposed to be put into an initial RAM disk (initrd). - -{ genericSubstituter, shell, staticTools -, module_init_tools, extraUtils, modules - -, # Whether to find root device automatically using its label. - autoDetectRootDevice - -, # If not scanning, the root must be specified explicitly. - rootDevice - - # If scanning, we need a disk label. -, rootLabel - -, # The path of the stage 2 init to call once we've mounted the root - # device. - stage2Init ? "/init" -}: - -assert !autoDetectRootDevice -> rootDevice != ""; -assert autoDetectRootDevice -> rootLabel != ""; - -genericSubstituter { - src = ./boot-stage-1-init.sh; - isExecutable = true; - inherit shell modules; - inherit autoDetectRootDevice rootDevice rootLabel; - path = [ - staticTools - module_init_tools - extraUtils - ]; - makeDevices = ./make-devices.sh; - - # We only want the path of the stage 2 init, we don't want it as a - # dependency (since then it the stage 2 init would end up in the - # initrd). - stage2Init = toString stage2Init; # !!! doesn't work -} diff --git a/test/boot-stage-2-init.sh b/test/boot-stage-2-init.sh deleted file mode 100644 index 57a6a20a71f6..000000000000 --- a/test/boot-stage-2-init.sh +++ /dev/null @@ -1,168 +0,0 @@ -#! @shell@ - -# !!! copied from stage 1; remove duplication - - -# Print a greeting. -echo -echo "<<< NixOS Stage 2 >>>" -echo - - -# Set the PATH. -export PATH=/empty -for i in @path@; do - PATH=$PATH:$i/bin - if test -e $i/sbin; then - PATH=$PATH:$i/sbin - fi -done - - -# Mount special file systems. - -needWritableDir() { - if test -n "@readOnlyRoot@"; then - mount -t tmpfs -o "mode=$2" none $1 $3 - else - mkdir -m $2 -p $1 - fi -} - -needWritableDir /etc 0755 -n # to shut up mount - -test -e /etc/fstab || touch /etc/fstab # idem - -mount -n -t proc none /proc -cat /proc/mounts > /etc/mtab - - -# Process the kernel command line. -for o in $(cat /proc/cmdline); do - case $o in - debugtrace) - # Show each command. - set -x - ;; - debug2) - echo "Debug shell called from @out@" - exec @shell@ - ;; - S|s|single) - # !!! argh, can't pass a startup event to Upstart yet. - exec @shell@ - ;; - esac -done - - -# More special file systems, initialise required directories. -mount -t sysfs none /sys -mount -t tmpfs -o "mode=0755" none /dev -needWritableDir /tmp 01777 -needWritableDir /var 0755 -needWritableDir /nix/var 0755 - -mkdir -m 0755 -p /nix/var/nix/db -mkdir -m 0755 -p /nix/var/nix/gcroots -mkdir -m 0755 -p /nix/var/nix/temproots - -mkdir -m 0755 -p /var/log - -ln -sf /nix/var/nix/profiles /nix/var/nix/gcroots/ - - -# Ensure that the module tools can find the kernel modules. -export MODULE_DIR=@kernel@/lib/modules/ - - -# Miscellaneous cleanup. -rm -rf /var/run -mkdir -m 0755 -p /var/run - -echo -n > /var/run/utmp # must exist -chmod 664 /var/run/utmp - - -# Start udev. -udevd --daemon - - -# Let udev create device nodes for all modules that have already been -# loaded into the kernel (or for which support is built into the -# kernel). -udevtrigger -udevsettle # wait for udev to finish - - -# Necessary configuration for syslogd. -echo "*.* /dev/tty10" > /etc/syslog.conf -echo "syslog 514/udp" > /etc/services # required, even if we don't use it - - -# login/su absolutely need this. -test -e /etc/login.defs || touch /etc/login.defs - - -# Enable a password-less root login. -if ! test -e /etc/passwd; then - echo "root::0:0:root:/:@shell@" > /etc/passwd -fi -if ! test -e /etc/group; then - echo "root:*:0" > /etc/group -fi - - -# We need "localhost" (!!! destructive hack for NIXOS-41). -echo "127.0.0.1 localhost" > /etc/hosts -echo "hosts: files dns" > /etc/nsswitch.conf - - -# Set up the Upstart jobs. -export UPSTART_CFG_DIR=/etc/event.d - -rm -f /etc/event.d -ln -sf @upstartJobs@/etc/event.d /etc/event.d - - -# Show a nice greeting on each terminal. -cat > /etc/issue <>> - - -EOF - - -# Additional path for the interactive shell. -for i in @extraPath@; do - PATH=$PATH:$i/bin - if test -e $i/sbin; then - PATH=$PATH:$i/sbin - fi -done - -cat > /etc/profile <" - exit 1 -fi - - -target=/boot/grub/menu.lst -tmp=$target.tmp - -cat > $tmp << GRUBEND -# Automatically generated. DO NOT EDIT THIS FILE! -default=0 -timeout=5 -GRUBEND - -addEntry() { - name="$1" - path="$2" - - cat >> $tmp << GRUBEND -title $name -GRUBEND - - #cat $path/menu.lst >> $tmp - - grep -v "title \|default=\|timeout=" < $path/menu.lst >> $tmp -} - - -if test -n "$tmp"; then - addEntry "NixOS - Default" $default -fi - - -# Add all generations of the system profile to the menu, in reverse -# (most recent to least recent) order. -for generation in $( - (cd /nix/var/nix/profiles && ls -d system-*-link) \ - | sed 's/system-\([0-9]\+\)-link/\1/' \ - | sort -n -r); do - echo $generation - link=/nix/var/nix/profiles/system-$generation-link - date=$(stat --printf="%y\n" $link | sed 's/\..*//') - addEntry "NixOS - Configuration $generation ($date)" $link - -done - - -cp $tmp $target diff --git a/test/helpers/unpack-theme.nix b/test/helpers/unpack-theme.nix deleted file mode 100644 index 69d2eebe530c..000000000000 --- a/test/helpers/unpack-theme.nix +++ /dev/null @@ -1,7 +0,0 @@ -{stdenv, theme}: - -stdenv.mkDerivation { - name = "theme"; - builder = ./unpack-theme.sh; - inherit theme; -} diff --git a/test/helpers/unpack-theme.sh b/test/helpers/unpack-theme.sh deleted file mode 100644 index 6eda7bcfbd48..000000000000 --- a/test/helpers/unpack-theme.sh +++ /dev/null @@ -1,18 +0,0 @@ -source $stdenv/setup - -ensureDir $out - -tar xvfj $theme -C $out - -themeName=$(cd $out && ls) - -for i in $out/$themeName/config/*.cfg; do - echo "converting $i" - # Rewrite /etc paths. Also, the file names - # config/bootsplash-.cfg should be .cfg. - sed "s^/etc/bootsplash/themes^$out^g" < $i > $out/$themeName/$(basename $i | sed 's^.*-^^') -done - -rm $out/$themeName/config/*.cfg - -ln -s $themeName $out/default diff --git a/test/installer.nix b/test/installer.nix deleted file mode 100644 index 44080b86a85e..000000000000 --- a/test/installer.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ stdenv, genericSubstituter, shell, nix -}: - -genericSubstituter { - src = ./installer.sh; - dir = "bin"; - isExecutable = true; - inherit shell nix; - - pathsFromGraph = ./paths-from-graph.sh; - - nixClosure = stdenv.mkDerivation { - name = "closure"; - exportReferencesGraph = ["refs" nix]; - builder = builtins.toFile "builder.sh" "source $stdenv/setup; cp refs $out"; - }; -} diff --git a/test/installer.sh b/test/installer.sh deleted file mode 100644 index 04c3c80c2129..000000000000 --- a/test/installer.sh +++ /dev/null @@ -1,132 +0,0 @@ -#! @shell@ - -# Syntax: installer.sh -# (e.g., installer.sh /dev/hda1 ./my-machine.nix) - -# - mount target device -# - make Nix store etc. -# - copy closure of rescue env to target device -# - register validity -# - start the "target" installer in a chroot to the target device -# * do a nix-pull -# * nix-env -p system-profile -i -# * run hook scripts provided by packages in the configuration? -# - install/update grub - -set -e - -targetDevice="$1" -nixExpr="$2" - -if test -z "$targetDevice" -o -z "$nixExpr"; then - echo "Syntax: installer.sh " - exit 1 -fi - -nixExpr=$(readlink -f "$nixExpr") - - -# Make sure that the target device isn't mounted. -umount "$targetDevice" 2> /dev/null || true - - -# Check it. -fsck -n "$targetDevice" - - -# Mount the target device. -mountPoint=/tmp/inst-mnt -mkdir -p $mountPoint -mount "$targetDevice" $mountPoint - -mkdir -m 0755 -p $mountPoint/dev $mountPoint/proc $mountPoint/sys $mountPoint/mnt -mount --rbind / $mountPoint/mnt -mount --bind /dev $mountPoint/dev -mount --bind /proc $mountPoint/proc -mount --bind /sys $mountPoint/sys - -cleanup() { - for i in $(grep -F "$mountPoint" /proc/mounts \ - | perl -e 'while (<>) { /^\S+\s+(\S+)\s+/; print "$1\n"; }' \ - | sort -r); - do - umount $i - done -} - -trap "cleanup" EXIT - -mkdir -m 01777 -p $mountPoint/tmp -mkdir -m 0755 -p $mountPoint/var - - -# Create the necessary Nix directories on the target device, if they -# don't already exist. -mkdir -m 0755 -p \ - $mountPoint/nix/store \ - $mountPoint/nix/var/nix/gcroots \ - $mountPoint/nix/var/nix/temproots \ - $mountPoint/nix/var/nix/manifests \ - $mountPoint/nix/var/nix/userpool \ - $mountPoint/nix/var/nix/profiles \ - $mountPoint/nix/var/nix/db \ - $mountPoint/nix/var/log/nix/drvs - - -# Get the store paths to copy from the references graph. -storePaths=$(@shell@ @pathsFromGraph@ @nixClosure@) - -# Copy Nix to the Nix store on the target device. -echo "copying Nix to $targetDevice...." -for i in $storePaths; do - echo " $i" - rsync -a $i $mountPoint/nix/store/ -done - - -# Register the paths in the Nix closure as valid. This is necessary -# to prevent them from being deleted the first time we install -# something. (I.e., Nix will see that, e.g., the glibc path is not -# valid, delete it to get it out of the way, but as a result nothing -# will work anymore.) -chroot $mountPoint @nix@/bin/nix-store --register-validity < @nixClosure@ - - -# Create the required /bin/sh symlink; otherwise lots of things -# (notably the system() function) won't work. -mkdir -m 0755 -p $mountPoint/bin -ln -sf $(type -tp sh) $mountPoint/bin/sh - - -# Enable networking in the chroot. -mkdir -m 0755 -p $mountPoint/etc -cp /etc/resolv.conf $mountPoint/etc/ - - -# Do a nix-pull to speed up building. -nixpkgsURL=http://nix.cs.uu.nl/dist/nix/nixpkgs-0.11pre6984 -chroot $mountPoint @nix@/bin/nix-pull $nixpkgsURL/MANIFEST - - -# Build the specified Nix expression in the target store and install -# it into the system configuration profile. - -#rm -rf $mountPoint/scratch -#mkdir $mountPoint/scratch -#curl $nixpkgsURL/nixexprs.tar.bz2 | tar xj -C $mountPoint/scratch -#nixpkgsName=$(cd $mountPoint/scratch && ls) - -chroot $mountPoint @nix@/bin/nix-env \ - -p /nix/var/nix/profiles/system \ - -f "/mnt/$nixExpr" -i -A systemConfiguration - - -# Grub needs a mtab. -echo "$targetDevice / somefs rw 0 0" > $mountPoint/etc/mtab - - -# Switch to the new system configuration. This will install Grub with -# a menu default pointing at the kernel/initrd/etc of the new -# configuration. -echo "finalising the installation..." -NIXOS_INSTALL_GRUB=1 chroot $mountPoint /nix/var/nix/profiles/system/bin/switch-to-configuration diff --git a/test/isolinux.cfg b/test/isolinux.cfg deleted file mode 100644 index ff19e84c0988..000000000000 --- a/test/isolinux.cfg +++ /dev/null @@ -1,6 +0,0 @@ -default linux -prompt 1 -timeout 60 -label linux - kernel vmlinuz - append initrd=initrd selinux=0 apm=on acpi=on diff --git a/test/make-devices.sh b/test/make-devices.sh deleted file mode 100644 index 1e9f9719ea45..000000000000 --- a/test/make-devices.sh +++ /dev/null @@ -1,53 +0,0 @@ -mknod -m 0600 /dev/ttyS0 c 4 64 -mknod -m 0600 /dev/ttyS1 c 4 65 -mknod -m 0600 /dev/ttyS2 c 4 66 -mknod -m 0600 /dev/ttyS3 c 4 67 - -# base UNIX devices -mknod -m 0600 /dev/mem c 1 1 -mknod -m 0666 /dev/null c 1 3 -mknod -m 0666 /dev/zero c 1 5 - -# tty -mknod -m 0600 /dev/tty c 5 0 -if ! test -e /dev/console; then - mknod -m 0600 /dev/console c 5 1 -fi -for i in $(seq 0 10); do - mknod -m 0600 /dev/tty$i c 4 $i -done - -mkdir -m 0755 /dev/pts -mknod -m 0666 /dev/ptmx c 5 2 - -# random - -mknod -m 0644 /dev/random c 1 8 -mknod -m 0644 /dev/urandom c 1 9 - -mknod -m 0660 /dev/hda b 3 0 -mknod -m 0660 /dev/hda1 b 3 1 -mknod -m 0660 /dev/hda2 b 3 2 -mknod -m 0660 /dev/hda3 b 3 3 - -mknod -m 0660 /dev/hdb b 3 64 -mknod -m 0660 /dev/hdb1 b 3 65 -mknod -m 0660 /dev/hdb2 b 3 66 -mknod -m 0660 /dev/hdb3 b 3 67 - -mknod -m 0660 /dev/hdc b 22 0 -mknod -m 0660 /dev/hdc1 b 22 1 -mknod -m 0660 /dev/hdc2 b 22 2 -mknod -m 0660 /dev/hdc3 b 22 3 - -mknod -m 0660 /dev/hdd b 22 64 -mknod -m 0660 /dev/hdd1 b 22 65 -mknod -m 0660 /dev/hdd2 b 22 66 -mknod -m 0660 /dev/hdd3 b 22 67 - -#mknod -m 0660 /dev/sda b 8 0 -#mknod -m 0660 /dev/sda1 b 8 1 -#mknod -m 0660 /dev/sda2 b 8 2 -#mknod -m 0660 /dev/sda3 b 8 3 - -mknod -m 0600 /dev/initctl p diff --git a/test/make-initrd.nix b/test/make-initrd.nix deleted file mode 100644 index a28c312564e2..000000000000 --- a/test/make-initrd.nix +++ /dev/null @@ -1,31 +0,0 @@ -# Create an initial ramdisk containing the closure of the specified -# file system objects. An initial ramdisk is used during the initial -# stages of booting a Linux system. It is loaded by the boot loader -# along with the kernel image. It's supposed to contain everything -# (such as kernel modules) necessary to allow us to mount the root -# file system. Once the root file system is mounted, the `real' boot -# script can be called. -# -# An initrd is really just a gzipped cpio archive. -# -# Symlinks are created for each top-level file system object. E.g., -# `contents = {object = ...; symlink = /init;}' is a typical -# argument. - -{stdenv, cpio, contents}: - -stdenv.mkDerivation { - name = "initrd"; - builder = ./make-initrd.sh; - buildInputs = [cpio]; - - # !!! should use XML. - objects = map (x: x.object) contents; - symlinks = map (x: x.symlink) contents; - suffices = map (x: if x ? suffix then x.suffix else "none") contents; - - # For obtaining the closure of `contents'. - exportReferencesGraph = - map (x: [("closure-" + baseNameOf x.symlink) x.object]) contents; - pathsFromGraph = ./paths-from-graph.sh; -} diff --git a/test/make-initrd.sh b/test/make-initrd.sh deleted file mode 100644 index 8d07300466b6..000000000000 --- a/test/make-initrd.sh +++ /dev/null @@ -1,42 +0,0 @@ -source $stdenv/setup - -set -o pipefail - -objects=($objects) -symlinks=($symlinks) -suffices=($suffices) - -mkdir root - -# Needed for splash_helper, which gets run before init. -mkdir root/dev -mkdir root/sys -mkdir root/proc - - -for ((n = 0; n < ${#objects[*]}; n++)); do - object=${objects[$n]} - symlink=${symlinks[$n]} - suffix=${suffices[$n]} - if test "$suffix" = none; then suffix=; fi - - # 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) - - # Paths in cpio archives *must* be relative, otherwise the kernel - # won't unpack 'em. - (cd root && cp -prd --parents $storePaths .) - - mkdir -p $(dirname root/$symlink) - ln -s $object$suffix root/$symlink -done - - -# Put the closure in a gzipped cpio archive. -ensureDir $out -(cd root && find * -print0 | cpio -ov -H newc --null | gzip -9 > $out/initrd) diff --git a/test/make-iso9660-image.nix b/test/make-iso9660-image.nix deleted file mode 100644 index e98de8ffcb44..000000000000 --- a/test/make-iso9660-image.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ stdenv, cdrtools - - # The file name of the resulting ISO image. -, isoName ? "cd.iso" - -, # The files and directories to be placed in the ISO file system. - # This is a list of attribute sets {source, target} where `source' - # is the file system object (regular file or directory) to be - # 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 - - # Whether this should be an El-Torito bootable CD. -, bootable ? false - - # The path (in the ISO file system) of the boot image. -, bootImage ? "" - -}: - -assert bootable -> bootImage != ""; - -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; - - # For obtaining the closure of `init'. - exportReferencesGraph = ["init-closure" init]; - pathsFromGraph = ./paths-from-graph.sh; -} diff --git a/test/make-iso9660-image.sh b/test/make-iso9660-image.sh deleted file mode 100644 index 9a8bef7416d2..000000000000 --- a/test/make-iso9660-image.sh +++ /dev/null @@ -1,31 +0,0 @@ -source $stdenv/setup - -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" -done - -if test -n "$init"; then - ln -s $init init - graftList="$graftList init=init" -fi - -# !!! -f is a quick hack. -ensureDir $out/iso -mkisofs -r -J -o $out/iso/$isoName $bootFlags \ - -graft-points $graftList - -ensureDir $out/nix-support -echo $system > $out/nix-support/system diff --git a/test/modules-closure.nix b/test/modules-closure.nix deleted file mode 100644 index 86015a8b182c..000000000000 --- a/test/modules-closure.nix +++ /dev/null @@ -1,13 +0,0 @@ -# Given a kernel build (with modules in $kernel/lib/modules/VERSION), -# produce a module tree in $out/lib/modules/VERSION that contains only -# the modules identified by `rootModules', plus their dependencies. -# Also generate an appropriate modules.dep. - -{stdenv, kernel, rootModules, module_init_tools}: - -stdenv.mkDerivation { - name = kernel.name + "-shrunk"; - builder = ./modules-closure.sh; - inherit kernel rootModules module_init_tools; - allowedReferences = ["out"]; -} diff --git a/test/modules-closure.sh b/test/modules-closure.sh deleted file mode 100644 index c5fcbba87f1a..000000000000 --- a/test/modules-closure.sh +++ /dev/null @@ -1,37 +0,0 @@ -source $stdenv/setup - -set -o pipefail - -PATH=$module_init_tools/sbin:$PATH - -version=$(cd $kernel/lib/modules && ls -d *) - -echo "kernel version is $version" - -export MODULE_DIR=$kernel/lib/modules/ - -# Determine the dependencies of each root module. -closure= -for module in $rootModules; do - echo "root module: $module" - deps=$(modprobe --set-version "$version" --show-depends "$module" \ - | sed 's/^insmod //') - for i in $deps; do echo $i; done - closure="$closure $deps" -done - -# Remove duplicates. -closure=$(for i in $closure; do echo $i; done | sort | uniq) - -echo "closure:" -ensureDir $out -for module in $closure; do - echo $module - target=$(echo $module | sed "s^$kernel^$out^") - mkdir -p $(dirname $target) - cp $module $target - grep "^$module" $kernel/lib/modules/$version/modules.dep \ - | sed "s^$kernel^$out^g" \ - >> $out/lib/modules/$version/modules.dep -done - diff --git a/test/options.nix b/test/options.nix deleted file mode 100644 index 4cd2f3a7343a..000000000000 --- a/test/options.nix +++ /dev/null @@ -1,97 +0,0 @@ -[ - - { - name = ["networking" "hostname"]; - default = "nixos"; - description = "The name of the machine."; - } - - { - name = ["networking" "useDHCP"]; - default = true; - description = " - Whether to use DHCP to obtain an IP adress and other - configuration for all network interfaces that are not manually - configured. - "; - } - - { - name = ["networking" "interfaces"]; - default = []; - example = [ - { interface = "eth0"; - ipAddress = "131.211.84.78"; - netmask = "255.255.255.128"; - gateway = "131.211.84.1"; - } - ]; - description = " - The configuration for each network interface. If - is true, then each interface - not listed here will be configured using DHCP. - "; - } - - { - name = ["filesystems" "mountPoints"]; - example = [ - { device = "/dev/hda2"; - mountPoint = "/"; - } - ]; - description = " - The file systems to be mounted by NixOS. It must include an - entry for the root directory (mountPoint = - \"/\"). This is the file system on which NixOS is (to - be) installed.. - "; - } - - { - name = ["services" "syslogd" "tty"]; - default = 10; - description = " - The tty device on which syslogd will print important log - messages. - "; - } - - { - name = ["services" "mingetty" "ttys"]; - default = [1 2 3 4 5 6]; - description = " - The list of tty (virtual console) devices on which to start a - login prompt. - "; - } - - { - name = ["services" "mingetty" "waitOnMounts"]; - default = false; - description = " - Whether the login prompts on the virtual consoles will be - started before or after all file systems have been mounted. By - default we don't wait, but if for example your /home is on a - separate partition, you may want to turn this on. - "; - } - - { - name = ["services" "sshd" "enable"]; - default = false; - description = " - Whether to enable the Secure Shell daemon, which allows secure - remote logins. - "; - } - - { - name = ["services" "sshd" "forwardX11"]; - default = false; - description = " - Whether to enable sshd to forward X11 connections. - "; - } - -] diff --git a/test/paths-from-graph.sh b/test/paths-from-graph.sh deleted file mode 100644 index 4a134cb3165f..000000000000 --- a/test/paths-from-graph.sh +++ /dev/null @@ -1,10 +0,0 @@ -graph="$1" - -while read storePath; do - echo $storePath - read deriver - read count - for ((i = 0; i < $count; i++)); do - read ref - done -done < $graph diff --git a/test/rescue-cd.nix b/test/rescue-cd.nix deleted file mode 100644 index 48040f6495cc..000000000000 --- a/test/rescue-cd.nix +++ /dev/null @@ -1,101 +0,0 @@ -let - - # The label used to identify the installation CD. - cdromLabel = "NIXOS"; - -in - - # Build boot scripts for the CD that find the CD-ROM automatically. - with import ./boot-environment.nix { - autoDetectRootDevice = true; - rootLabel = cdromLabel; - stage2Init = "/init"; - readOnlyRoot = true; - }; - - -rec { - - inherit nixosInstaller bootStage1 upstartJobs; # !!! debug - - - # Since the CD is read-only, the mount points must be on disk. - cdMountPoints = pkgs.stdenv.mkDerivation { - name = "mount-points"; - builder = builtins.toFile "builder.sh" " - source $stdenv/setup - ensureDir $out - cd $out - mkdir proc sys tmp etc dev var mnt nix nix/var - touch $out/${cdromLabel} - "; - }; - - - # We need a copy of the Nix expressions for Nixpkgs and NixOS on the - # CD. We put them in a tarball because accessing that many small - # files from a slow device like a CD-ROM takes too long. - makeTarball = tarName: input: pkgs.stdenv.mkDerivation { - name = "tarball"; - inherit tarName input; - builder = builtins.toFile "builder.sh" " - source $stdenv/setup - ensureDir $out - (cd $input && tar cvfj $out/$tarName . \\ - --exclude '*~' --exclude '.svn' \\ - --exclude 'pkgs' --exclude 'result') - "; - }; - - - # Put the current directory in the tarball. !!! This gives us a lot - # of crap (like .svn if this is a working copy). An "svn export" - # would be better, but that's impure. - nixosTarball = makeTarball "nixos.tar.bz2" ./.; - - - nixpkgsTarball = pkgs.fetchurl { - url = http://nix.cs.uu.nl/dist/nix/nixpkgs-0.11pre7087/nixpkgs-0.11pre7087.tar.bz2; - md5 = "c5840fcd049d75e00ad856ecbbef6857"; - }; - - - # Create an ISO image containing the isolinux boot loader, the - # kernel, the initrd produced above, and the closure of the stage 2 - # init. - rescueCD = import ./make-iso9660-image.nix { - inherit (pkgs) stdenv cdrtools; - isoName = "nixos.iso"; - - contents = [ - { source = pkgs.syslinux + "/lib/syslinux/isolinux.bin"; - target = "isolinux/isolinux.bin"; - } - { source = ./isolinux.cfg; - target = "isolinux/isolinux.cfg"; - } - { source = pkgs.kernel + "/vmlinuz"; - target = "isolinux/vmlinuz"; - } - { source = initialRamdisk + "/initrd"; - target = "isolinux/initrd"; - } - { source = cdMountPoints; - target = "/"; - } - { source = nixosTarball + "/" + nixosTarball.tarName; - target = "/" + nixosTarball.tarName; - } - { source = nixpkgsTarball; - target = "/nixpkgs.tar.bz2"; - } - ]; - - init = bootStage2; - - bootable = true; - bootImage = "isolinux/isolinux.bin"; - }; - - -} diff --git a/test/splash-themes.nix b/test/splash-themes.nix deleted file mode 100644 index 25be6168b375..000000000000 --- a/test/splash-themes.nix +++ /dev/null @@ -1,58 +0,0 @@ -{fetchurl}: - -rec { - - # Some themes. - - themeBabyTux = fetchurl { - url = http://www.bootsplash.de/files/themes/Theme-BabyTux.tar.bz2; - md5 = "a6d89d1c1cff3b6a08e2f526f2eab4e0"; - }; - - themeFrozenBubble = fetchurl { - url = http://www.bootsplash.de/files/themes/Theme-FrozenBubble.tar.bz2; - md5 = "da49f04988ab04b7e0de117b0d25061a"; - }; - - themePativo = fetchurl { # Yeah! - url = http://www.bootsplash.de/files/themes/Theme-Pativo.tar.bz2; - md5 = "9e13beaaadf88d43a5293e7ab757d569"; - }; - - themeGNU = fetchurl { - url = http://www.bootsplash.de/files/themes/Theme-GNU.tar.bz2; - md5 = "61969309d23c631e57b0a311102ef034"; - }; - - - # The splash screen. - - splashScreen = themeBabyTux; - - - # The themes to use for each tty. For each tty except the first - # entry in the list, you can omit `theme' to get the same theme as - # the first one. If a tty does not appear, it doesn't get a - # theme (i.e., it will keep a black background). - - ttyBackgrounds = [ - { tty = 1; - theme = themeBabyTux; - } - { tty = 2; - } - { tty = 3; - theme = themeGNU; - } - { tty = 4; - theme = themeGNU; - } - { tty = 5; - theme = themePativo; - } - { tty = 10; # logging console - theme = themeGNU; - } - ]; - -} diff --git a/test/system-configuration.nix b/test/system-configuration.nix deleted file mode 100644 index 640f17f907ef..000000000000 --- a/test/system-configuration.nix +++ /dev/null @@ -1,55 +0,0 @@ -let - - # The root device. - rootDevice = "/dev/hda1"; - - # The device on which GRUB should be installed (leave empty if you - # don't want GRUB to be installed). - grubDevice = "/dev/hda"; - - # Build boot scripts. - bootEnv = import ./boot-environment.nix { - autoDetectRootDevice = false; - inherit rootDevice; - stage2Init = ""; # Passed on the command line via Grub. - readOnlyRoot = false; - }; - - # Extra kernel command line arguments. - extraKernelParams = [ - "selinux=0" - "apm=on" - "acpi=on" - "vga=0x317" - "console=tty1" - "splash=verbose" - ]; - -in - -with bootEnv; - -rec { - - - systemConfiguration = pkgs.stdenv.mkDerivation { - name = "system-configuration"; - builder = ./system-configuration.sh; - inherit (pkgs) grub coreutils gnused gnugrep diffutils; - inherit grubDevice; - inherit bootStage2; - inherit grubMenuBuilder; - kernel = pkgs.kernel + "/vmlinuz"; - initrd = initialRamdisk + "/initrd"; - inherit extraKernelParams; - }; - - - grubMenuBuilder = pkgs.genericSubstituter { - src = ./grub-menu-builder.sh; - isExecutable = true; - inherit (pkgs) bash; - }; - - -} diff --git a/test/system-configuration.sh b/test/system-configuration.sh deleted file mode 100644 index fa2e7def257b..000000000000 --- a/test/system-configuration.sh +++ /dev/null @@ -1,31 +0,0 @@ -source $stdenv/setup - -ensureDir $out - -ln -s $kernel $out/kernel -ln -s $grub $out/grub -ln -s $bootStage2 $out/init -ln -s $initrd $out/initrd -echo "$extraKernelParams" > $out/kernel-params - -cat > $out/menu.lst << GRUBEND -kernel $kernel init=$bootStage2 $extraKernelParams -initrd $initrd -GRUBEND - -ensureDir $out/bin - -cat > $out/bin/switch-to-configuration <>>\" - echo \"\" - - # Do an initial sync just in case. - sync || true - - # Unmount file systems. - umount -n -a || true - - # Remount / read-only - mount -n -o remount,ro /dontcare / || true - - # Final sync. - sync || true - - # Right now all events above power off the system. - if test ${event} = reboot; then - exec reboot -f - else - exec halt -f -p - fi -end script - "; - -} diff --git a/test/upstart-jobs/hardware-scan.nix b/test/upstart-jobs/hardware-scan.nix deleted file mode 100644 index 3ffd8f9223f5..000000000000 --- a/test/upstart-jobs/hardware-scan.nix +++ /dev/null @@ -1,23 +0,0 @@ -# !!! Don't like it that I have to pass the kernel here. -{kernel, module_init_tools}: - -{ - name = "hardware-scan"; - - job = " -start on startup - -script - export MODULE_DIR=${kernel}/lib/modules/ - - # Try to load modules for all PCI devices. - for i in /sys/bus/pci/devices/*/modalias; do - echo \"Trying to load a module for $(basename $(dirname $i))...\" - ${module_init_tools}/sbin/modprobe $(cat $i) || true - echo \"\" - done -end script - - "; - -} diff --git a/test/upstart-jobs/maintenance-shell.nix b/test/upstart-jobs/maintenance-shell.nix deleted file mode 100644 index 9e2acdaa0f5f..000000000000 --- a/test/upstart-jobs/maintenance-shell.nix +++ /dev/null @@ -1,19 +0,0 @@ -{bash}: - -{ - name = "maintenance-shell"; - - job = " -start on maintenance -start on stalled - -script - exec < /dev/tty1 > /dev/tty1 2>&1 - echo \"\" - echo \"<<< MAINTENANCE SHELL >>>\" - echo \"\" - exec ${bash}/bin/sh -end script - "; - -} diff --git a/test/upstart-jobs/make-job.nix b/test/upstart-jobs/make-job.nix deleted file mode 100644 index 3995a8f21aa0..000000000000 --- a/test/upstart-jobs/make-job.nix +++ /dev/null @@ -1,7 +0,0 @@ -{stdenv}: job: - -stdenv.mkDerivation { - inherit (job) name job; - builder = builtins.toFile "builder.sh" - "source $stdenv/setup; ensureDir $out/etc/event.d; echo \"$job\" > $out/etc/event.d/$name"; -} diff --git a/test/upstart-jobs/mingetty.nix b/test/upstart-jobs/mingetty.nix deleted file mode 100644 index cdce937535c2..000000000000 --- a/test/upstart-jobs/mingetty.nix +++ /dev/null @@ -1,10 +0,0 @@ -{mingetty, ttyNumber}: - -{ - name = "tty" + toString ttyNumber; - job = " - start on startup - stop on shutdown - respawn ${mingetty}/sbin/mingetty --noclear tty${toString ttyNumber} - "; -} diff --git a/test/upstart-jobs/network-interfaces.nix b/test/upstart-jobs/network-interfaces.nix deleted file mode 100644 index d85c7e020018..000000000000 --- a/test/upstart-jobs/network-interfaces.nix +++ /dev/null @@ -1,36 +0,0 @@ -# !!! Don't like it that I have to pass the kernel here. -{nettools, kernel, module_init_tools}: - -{ - name = "network-interfaces"; - - job = " -start on hardware-scan -stop on shutdown - -start script - export MODULE_DIR=${kernel}/lib/modules/ - - ${module_init_tools}/sbin/modprobe af_packet - - for i in $(cd /sys/class/net && ls -d *); do - echo \"Bringing up network device $i...\" - ${nettools}/sbin/ifconfig $i up || true - done - -end script - -# Hack: Upstart doesn't yet support what we want: a service that -# doesn't have a running process associated with it. -respawn sleep 10000 - -stop script - for i in $(cd /sys/class/net && ls -d *); do - echo \"Taking down network device $i...\" - ${nettools}/sbin/ifconfig $i down || true - done -end script - - "; - -} diff --git a/test/upstart-jobs/sshd.nix b/test/upstart-jobs/sshd.nix deleted file mode 100644 index 466c7616f556..000000000000 --- a/test/upstart-jobs/sshd.nix +++ /dev/null @@ -1,32 +0,0 @@ -{openssh}: - -{ - name = "sshd"; - - job = " -description \"SSH server\" - -start on network-interfaces/started -stop on network-interfaces/stop - -start script - mkdir -m 0555 -p /var/empty - - mkdir -m 0755 -p /etc/ssh - - echo 'X11Forwarding yes' > /etc/ssh/sshd_config - - if ! test -f /etc/ssh/ssh_host_dsa_key; then - ${openssh}/bin/ssh-keygen -t dsa -b 1024 -f /etc/ssh/ssh_host_dsa_key -N '' - fi - - if ! grep -q '^sshd:' /etc/passwd; then - echo 'sshd:x:74:74:SSH privilege separation user:/var/empty:/noshell' >> /etc/passwd - fi - -end script - -respawn ${openssh}/sbin/sshd -D -h /etc/ssh/ssh_host_dsa_key -f /etc/ssh/sshd_config - "; - -} diff --git a/test/upstart-jobs/syslogd.nix b/test/upstart-jobs/syslogd.nix deleted file mode 100644 index 8f326b0d6cf4..000000000000 --- a/test/upstart-jobs/syslogd.nix +++ /dev/null @@ -1,10 +0,0 @@ -{sysklogd}: - -{ - name = "syslogd"; - job = " - start on startup - stop on shutdown - respawn ${sysklogd}/sbin/syslogd -n - "; -} diff --git a/test/upstart-jobs/tty-backgrounds-combine.sh b/test/upstart-jobs/tty-backgrounds-combine.sh deleted file mode 100644 index 894952d69404..000000000000 --- a/test/upstart-jobs/tty-backgrounds-combine.sh +++ /dev/null @@ -1,37 +0,0 @@ -source $stdenv/setup - -ttys=($ttys) -themes=($themes) - -ensureDir $out - -default= - -for ((n = 0; n < ${#ttys[*]}; n++)); do - tty=${ttys[$n]} - theme=${themes[$n]} - - if test "$theme" = "default"; then - if test -z "$default"; then - echo "No default theme!" - exit 1 - fi - theme=$default - fi - - if test -z "$default"; then default=$theme; fi - - echo "TTY $tty -> $theme" - - themeName=$(cd $theme && ls | grep -v default) - - ln -sf $theme/$themeName $out/$themeName - - if test -e $out/$tty; then - echo "Multiple themes defined for the same TTY!" - exit 1 - fi - - ln -sf $themeName $out/$tty - -done diff --git a/test/upstart-jobs/tty-backgrounds.nix b/test/upstart-jobs/tty-backgrounds.nix deleted file mode 100644 index abe6f52305ab..000000000000 --- a/test/upstart-jobs/tty-backgrounds.nix +++ /dev/null @@ -1,52 +0,0 @@ -{stdenv, splashutils, backgrounds}: - -rec { - name = "tty-backgrounds"; - - unpackTheme = theme: import ../helpers/unpack-theme.nix { - inherit stdenv theme; - }; - - themesUnpacked = stdenv.mkDerivation { - name = "splash-themes"; - builder = ./tty-backgrounds-combine.sh; - # !!! Should use XML here. - ttys = map (x: x.tty) backgrounds; - themes = map (x: if x ? theme then (unpackTheme x.theme) else "default") backgrounds; - }; - - job = " -start on hardware-scan - -start script - - rm -f /etc/splash - ln -s ${themesUnpacked} /etc/splash - - # Critical: tell the kernel where to find splash_helper. It calls - # this program every time we switch between consoles. - echo ${splashutils}/bin/splash_helper > /proc/sys/kernel/fbsplash - - # Set the theme for each console, as determined by - # tty-backgrounds-combine.sh above. - for tty in ${toString (map (x: x.tty) backgrounds)}; do - theme=$(readlink ${themesUnpacked}/$tty) - ${splashutils}/bin/splash_util --tty $tty -c setcfg -t $theme || true - ${splashutils}/bin/splash_util --tty $tty -c setpic -t $theme || true - ${splashutils}/bin/splash_util --tty $tty -c on || true - done - -end script - -respawn sleep 10000 # !!! Hack - -stop script - # Disable the theme on each console. - for tty in ${toString (map (x: x.tty) backgrounds)}; do - ${splashutils}/bin/splash_util --tty $tty -c off || true - done -end script - - "; - -}