commit
8e56ab02ce
2 changed files with 12 additions and 13 deletions
|
@ -16,7 +16,7 @@ in makeTest' {
|
||||||
nodes = {
|
nodes = {
|
||||||
node1 = { ... }: {
|
node1 = { ... }: {
|
||||||
virtualisation.vlans = [ ];
|
virtualisation.vlans = [ ];
|
||||||
virtualisation.memorySize = 4 * 1024;
|
virtualisation.memorySize = 2 * 1024 + 512;
|
||||||
virtualisation.diskSize = 4 * 1024;
|
virtualisation.diskSize = 4 * 1024;
|
||||||
virtualisation.useBootLoader = true;
|
virtualisation.useBootLoader = true;
|
||||||
virtualisation.useEFIBoot = true;
|
virtualisation.useEFIBoot = true;
|
||||||
|
@ -55,10 +55,8 @@ in makeTest' {
|
||||||
# Kexec node1 to the toplevel of node2 via the kexec-boot script
|
# Kexec node1 to the toplevel of node2 via the kexec-boot script
|
||||||
node1.succeed('touch /run/foo')
|
node1.succeed('touch /run/foo')
|
||||||
node1.fail('hello')
|
node1.fail('hello')
|
||||||
node1.succeed('mkdir -p /root/kexec')
|
node1.succeed('tar -xf ${nodes.node2.config.system.build.kexecTarball}/tarball/nixos-kexec-installer-${pkgs.system}.tar.xz -C /root')
|
||||||
node1.succeed('mkdir -p /root/kexec')
|
node1.execute('/root/kexec/run')
|
||||||
node1.succeed('tar -xf ${nodes.node2.config.system.build.kexecTarball}/tarball/nixos-kexec-installer-${pkgs.system}.tar.xz -C /root/kexec')
|
|
||||||
node1.execute('/root/kexec/kexec-boot')
|
|
||||||
# wait for machine to kexec
|
# wait for machine to kexec
|
||||||
node1.execute('sleep 9999', check_return=False)
|
node1.execute('sleep 9999', check_return=False)
|
||||||
node1.succeed('! test -e /run/foo')
|
node1.succeed('! test -e /run/foo')
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
# This is a variant of the upstream kexecScript that also allows embedding
|
# This is a variant of the upstream kexecScript that also allows embedding
|
||||||
# a ssh key.
|
# a ssh key.
|
||||||
system.build.kexecBoot = lib.mkForce (pkgs.writeScript "kexec-boot" ''
|
system.build.kexecRun = lib.mkForce (pkgs.writeScript "kexec-run" ''
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -ex
|
set -ex
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
INITRD_TMP=$(mktemp -d)
|
INITRD_TMP=$(mktemp -d)
|
||||||
cd "$INITRD_TMP"
|
cd "$INITRD_TMP"
|
||||||
pwd
|
pwd
|
||||||
mkdir initrd initrd/ssh
|
mkdir -p initrd/ssh
|
||||||
pushd initrd
|
pushd initrd
|
||||||
if [ -e /root/.ssh/authorized_keys ]; then
|
if [ -e /root/.ssh/authorized_keys ]; then
|
||||||
cat /root/.ssh/authorized_keys >> ssh/authorized_keys
|
cat /root/.ssh/authorized_keys >> ssh/authorized_keys
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
for p in /etc/ssh/ssh_host_*; do
|
for p in /etc/ssh/ssh_host_*; do
|
||||||
cp -a "$p" ssh
|
cp -a "$p" ssh
|
||||||
done
|
done
|
||||||
find -type f | cpio -o -H newc | gzip -9 > ../extra.gz
|
find | cpio -o -H newc | gzip -9 > ../extra.gz
|
||||||
popd
|
popd
|
||||||
cat "''${SCRIPT_DIR}/initrd.gz" extra.gz > final.gz
|
cat "''${SCRIPT_DIR}/initrd.gz" extra.gz > final.gz
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@
|
||||||
rm -r "$INITRD_TMP"
|
rm -r "$INITRD_TMP"
|
||||||
|
|
||||||
# Disconnect our background kexec from the terminal
|
# Disconnect our background kexec from the terminal
|
||||||
|
echo "machine will boot into nixos in in 6s..."
|
||||||
if [[ -e /dev/kmsg ]]; then
|
if [[ -e /dev/kmsg ]]; then
|
||||||
# this makes logging visible in `dmesg`, or the system consol or tools like journald
|
# this makes logging visible in `dmesg`, or the system consol or tools like journald
|
||||||
exec > /dev/kmsg 2>&1
|
exec > /dev/kmsg 2>&1
|
||||||
|
@ -55,19 +56,19 @@
|
||||||
fileName = "nixos-kexec-installer-${pkgs.stdenv.hostPlatform.system}";
|
fileName = "nixos-kexec-installer-${pkgs.stdenv.hostPlatform.system}";
|
||||||
contents = [
|
contents = [
|
||||||
{
|
{
|
||||||
target = "/initrd.gz";
|
target = "/kexec/initrd.gz";
|
||||||
source = "${config.system.build.netbootRamdisk}/initrd";
|
source = "${config.system.build.netbootRamdisk}/initrd";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
target = "/bzImage";
|
target = "/kexec/bzImage";
|
||||||
source = "${config.system.build.kernel}/${config.system.boot.loader.kernelFile}";
|
source = "${config.system.build.kernel}/${config.system.boot.loader.kernelFile}";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
target = "/kexec-boot";
|
target = "/kexec/run";
|
||||||
source = config.system.build.kexecBoot;
|
source = config.system.build.kexecRun;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
target = "/kexec";
|
target = "/kexec/kexec";
|
||||||
source = "${pkgs.pkgsStatic.kexec-tools}/bin/kexec";
|
source = "${pkgs.pkgsStatic.kexec-tools}/bin/kexec";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue