use make-disk-image instead of sd-image

This commit is contained in:
Robert Cambridge 2024-11-18 13:46:54 +01:00
parent aaec735faf
commit fb248c0047
17 changed files with 570 additions and 229 deletions

View file

@ -0,0 +1,8 @@
{ pkgs }:
pkgs.substituteAll {
src = ./atomic-copy-clobber.sh;
isExecutable = true;
path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep];
inherit (pkgs) bash;
}

View file

@ -0,0 +1,18 @@
#! @bash@/bin/sh -e
# copy+paste of copyToKernelsDir https://github.com/NixOS/nixpkgs/blob/904ecf0b4e055dc465f5ae6574be2af8cc25dec3/nixos/modules/system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.sh#L53
# but without the check which skips the copy if the destination exists
shopt -s nullglob
export PATH=/empty
for i in @path@; do PATH=$PATH:$i/bin; done
src=$(readlink -f "$1")
dst="$2"
# Create $dst atomically to prevent partially copied files
# if this script is ever interrupted.
dstTmp=$dst.tmp.$$
cp -r $src $dstTmp
mv $dstTmp $dst

View file

@ -0,0 +1,8 @@
{ pkgs }:
pkgs.substituteAll {
src = ./atomic-copy-safe.sh;
isExecutable = true;
path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep];
inherit (pkgs) bash;
}

View file

@ -0,0 +1,20 @@
#! @bash@/bin/sh -e
# copy+paste of copyToKernelsDir https://github.com/NixOS/nixpkgs/blob/904ecf0b4e055dc465f5ae6574be2af8cc25dec3/nixos/modules/system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.sh#L53
shopt -s nullglob
export PATH=/empty
for i in @path@; do PATH=$PATH:$i/bin; done
src=$(readlink -f "$1")
dst="$2"
# Don't copy the file if $dst already exists.
# Also create $dst atomically to prevent partially copied files
# if this script is ever interrupted.
if ! test -e $dst; then
dstTmp=$dst.tmp.$$
cp -r $src $dstTmp
mv $dstTmp $dst
fi