mirror of
https://github.com/nix-community/raspberry-pi-nix.git
synced 2025-11-23 10:49:37 +01:00
use make-disk-image instead of sd-image
This commit is contained in:
parent
aaec735faf
commit
fb248c0047
17 changed files with 570 additions and 229 deletions
8
atomic-copy/atomic-copy-clobber.nix
Normal file
8
atomic-copy/atomic-copy-clobber.nix
Normal 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;
|
||||
}
|
||||
18
atomic-copy/atomic-copy-clobber.sh
Normal file
18
atomic-copy/atomic-copy-clobber.sh
Normal 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
|
||||
8
atomic-copy/atomic-copy-safe.nix
Normal file
8
atomic-copy/atomic-copy-safe.nix
Normal 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;
|
||||
}
|
||||
20
atomic-copy/atomic-copy-safe.sh
Normal file
20
atomic-copy/atomic-copy-safe.sh
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue