diff options
author | Andrew Cady <d@jerkface.net> | 2023-06-25 21:59:49 -0400 |
---|---|---|
committer | u <u@billy> | 2023-11-17 08:46:41 -0500 |
commit | a4a4f588d4c0aeb5e1d580196f02c54e75197683 (patch) | |
tree | b05e55aed06844ea229de8e0769ac8ef12026375 /partitions/Makefile | |
parent | 22c2dbf7a19f9e3013016c915bb798d1f60d76a2 (diff) |
Store large files in subvolumes
These files should never be mixed into the same directories as source
code, since source code should be backed up by filesystem snapshot, and
these should not.
This change includes file renames in this repository and in two of its
submodules.
Diffstat (limited to 'partitions/Makefile')
-rw-r--r-- | partitions/Makefile | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/partitions/Makefile b/partitions/Makefile index 1007a5c..91a60d9 100644 --- a/partitions/Makefile +++ b/partitions/Makefile | |||
@@ -1,29 +1,36 @@ | |||
1 | 1 | ||
2 | .PHONY: all clean | 2 | .PHONY: all clean |
3 | 3 | ||
4 | all: whole.img | 4 | whole = _build/whole.img |
5 | key = _build/key.img | ||
6 | |||
7 | all: $(whole) | ||
5 | 8 | ||
6 | stage0_efi_file = ../import-grub-bootx64-efi/3/BOOTX64.EFI | 9 | stage0_efi_file = ../import-grub-bootx64-efi/3/BOOTX64.EFI |
7 | $(stage0_efi_file): | 10 | $(stage0_efi_file): |
8 | make -C ../import-grub-bootx64-efi ver=3 | 11 | make -C ../import-grub-bootx64-efi ver=3 |
9 | 12 | ||
10 | whole.img: $(stage0_efi_file) | 13 | $(whole): $(stage0_efi_file) |
11 | partvi | 14 | partvi |
12 | 15 | ||
13 | key.img: $(stage0_efi_file) | 16 | $(key): $(stage0_efi_file) |
14 | partvi key | 17 | partvi key |
15 | 18 | ||
19 | _liveboot: | ||
20 | btrfs subvolume create $@ | ||
21 | |||
16 | PERSIST_SIZE=20G | 22 | PERSIST_SIZE=20G |
17 | persist.img: | 23 | PERSIST_FILE=_liveboot/persist.img |
24 | $(PERSIST_FILE): | _liveboot | ||
18 | [ ! -e $@ ] | 25 | [ ! -e $@ ] |
19 | fallocate -l "$(PERSIST_SIZE)" $@ | 26 | fallocate -l "$(PERSIST_SIZE)" $@ |
20 | truncate -s 0 $@ | 27 | truncate -s 0 $@ |
21 | truncate -s "$(PERSIST_SIZE)" $@ | 28 | truncate -s "$(PERSIST_SIZE)" $@ |
22 | 29 | ||
23 | persist := $(shell [ -e persist.img ] && printf %s '-drive file=persist.img,media=disk,driver=raw' || true) | 30 | optional_persist_disk != [ ! -e $(PERSIST_FILE) ] || printf %s '-drive file=$(PERSIST_FILE),media=disk,driver=raw' |
24 | 31 | ||
25 | .PHONY: usb emu key emu-key keymu | 32 | .PHONY: usb emu key emu-key keymu |
26 | usb: whole.img | 33 | usb: $(whole) |
27 | usb=$$(usb) && sudo dd status=progress if="$<" of="$$usb" | 34 | usb=$$(usb) && sudo dd status=progress if="$<" of="$$usb" |
28 | 35 | ||
29 | # QEMU_DISPLAY_OPTIONS = -nographic | 36 | # QEMU_DISPLAY_OPTIONS = -nographic |
@@ -34,16 +41,16 @@ QEMU_OPTIONS = $(QEMU_BIOS_OPTIONS) $(QEMU_DISPLAY_OPTIONS) | |||
34 | define emu | 41 | define emu |
35 | NO_AT_BRIDGE=1 qemu-system-x86_64 ${QEMU_OPTIONS} -m 800 -enable-kvm -boot c \ | 42 | NO_AT_BRIDGE=1 qemu-system-x86_64 ${QEMU_OPTIONS} -m 800 -enable-kvm -boot c \ |
36 | -drive file=$(1),media=disk,driver=raw \ | 43 | -drive file=$(1),media=disk,driver=raw \ |
37 | $(persist) | 44 | $(optional_persist_disk) |
38 | endef | 45 | endef |
39 | 46 | ||
40 | emu: whole.img | 47 | emu: $(whole) |
41 | $(call emu,$<) | 48 | $(call emu,$<) |
42 | 49 | ||
43 | emu-key keymu: key.img | 50 | emu-key keymu: $(key) |
44 | $(call emu,$<) | 51 | $(call emu,$<) |
45 | 52 | ||
46 | key: key.img | 53 | key: $(key) |
47 | usb=$$(usb) && \ | 54 | usb=$$(usb) && \ |
48 | sudo dd status=progress bs=1048576 if="$<" of="$$usb" && \ | 55 | sudo dd status=progress bs=1048576 if="$<" of="$$usb" && \ |
49 | sudo $(call emu,"$$usb") | 56 | sudo $(call emu,"$$usb") |
@@ -56,9 +63,9 @@ efi-ventoy: ventoy-efi-example.img | |||
56 | $(call emu,$<) | 63 | $(call emu,$<) |
57 | 64 | ||
58 | clean: | 65 | clean: |
59 | rm -rf _build whole.img key.img | 66 | rm -rf _build |
60 | 67 | ||
61 | .PHONY: total-destroy | 68 | .PHONY: total-destroy |
62 | total-destroy: clean | 69 | total-destroy: clean |
63 | rm -f persist.img | 70 | rm -f $(PERSIST_FILE) |
64 | $(MAKE) persist.img | 71 | $(MAKE) $(PERSIST_FILE) |