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 | |
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.
-rw-r--r-- | Makefile | 37 | ||||
m--------- | fsmgr | 0 | ||||
m--------- | import-grub-bootx64-efi | 0 | ||||
-rw-r--r-- | partitions/Makefile | 33 | ||||
-rw-r--r-- | partitions/part5.conf | 2 | ||||
-rw-r--r-- | partitions/part6.conf | 2 | ||||
-rw-r--r-- | partitions/part7.conf | 2 | ||||
-rw-r--r-- | partitions/part8.conf | 2 | ||||
-rwxr-xr-x | src/partvi | 4 |
9 files changed, 42 insertions, 40 deletions
@@ -91,7 +91,7 @@ SUDO_MAKE = sudo MAKEFLAGS="$$MAKEFLAGS" $(MAKE) | |||
91 | 91 | ||
92 | .PHONY: install-configuration install-bootserver install-boot-server start-bootserver | 92 | .PHONY: install-configuration install-bootserver install-boot-server start-bootserver |
93 | install-boot-server: install-bootserver | 93 | install-boot-server: install-bootserver |
94 | install-bootserver: | rootfs/samizdat.btrfs | 94 | install-bootserver: | $(rootfs) |
95 | exit 1; sudo initrd.sh | 95 | exit 1; sudo initrd.sh |
96 | $(SUDO_MAKE) instdir=/ real-install-bootserver start-bootserver | 96 | $(SUDO_MAKE) instdir=/ real-install-bootserver start-bootserver |
97 | 97 | ||
@@ -138,30 +138,24 @@ update-submodules: | |||
138 | install-submodules: cmd=install | 138 | install-submodules: cmd=install |
139 | install-submodules: update-submodules $(INSTALL_SUBMODULES) | 139 | install-submodules: update-submodules $(INSTALL_SUBMODULES) |
140 | 140 | ||
141 | GOLD = | 141 | rootfs = rootfs/_filesystem/samizdat.seed.btrfs |
142 | ifdef GOLD | ||
143 | rootfs = samizdat-gold.seed.btrfs | ||
144 | patchfs = | ||
145 | else | ||
146 | rootfs = samizdat.seed.btrfs | ||
147 | patchfs = $(patsubst %.seed.btrfs,%.patch.btrfs,$(rootfs)) | 142 | patchfs = $(patsubst %.seed.btrfs,%.patch.btrfs,$(rootfs)) |
148 | endif | 143 | rootfs_verity = $(addsuffix .verity,$(rootfs) $(patchfs)) |
149 | rootfs_verity = $(addprefix rootfs/,$(addsuffix .verity,$(rootfs) $(patchfs))) | ||
150 | 144 | ||
151 | .PHONY: rootfs rootfs-deps | 145 | .PHONY: rootfs rootfs-deps |
152 | rootfs-deps: | 146 | rootfs-deps: |
153 | [ -e install-submodules-stamp ] || make install-submodules-stamp | 147 | [ -e install-submodules-stamp ] || make install-submodules-stamp |
154 | [ -e install-stamp ] || $(SUDO_MAKE) install-stamp | 148 | [ -e install-stamp ] || $(SUDO_MAKE) install-stamp |
155 | 149 | ||
156 | btrfs_images = $(addprefix rootfs/, $(rootfs) $(patchfs)) | 150 | btrfs_images = $(rootfs) $(patchfs) |
157 | rootfs-clean: | 151 | rootfs-clean: |
158 | make -C rootfs clean all | 152 | make -C rootfs clean all |
159 | 153 | ||
160 | rootfs: rootfs-deps $(btrfs_images) $(rootfs_verity) | 154 | rootfs: rootfs-deps $(btrfs_images) $(rootfs_verity) |
161 | sudo mkdir -p /srv/nbd | 155 | sudo mkdir -p /srv/nbd |
162 | sudo ln -sf "$$PWD"/rootfs/$(rootfs) /srv/nbd/samizdat.btrfs | 156 | sudo ln -sf "$$PWD"/$(rootfs) /srv/nbd/samizdat.btrfs |
163 | ifneq (,$(patchfs)) | 157 | ifneq (,$(patchfs)) |
164 | sudo ln -sf "$$PWD"/rootfs/$(patchfs) /srv/nbd/samizdat.patch.btrfs | 158 | sudo ln -sf "$$PWD"/$(patchfs) /srv/nbd/samizdat.patch.btrfs |
165 | endif | 159 | endif |
166 | 160 | ||
167 | FORCE: | 161 | FORCE: |
@@ -170,12 +164,12 @@ $(btrfs_images): FORCE | |||
170 | 164 | ||
171 | boot: rootfs | 165 | boot: rootfs |
172 | sudo ./src/mkinitramfs-samizdat | 166 | sudo ./src/mkinitramfs-samizdat |
173 | sudo ROOTFS=rootfs/$(rootfs) ./src/parted-usb.sh | 167 | sudo ROOTFS=$(rootfs) ./src/parted-usb.sh |
174 | 168 | ||
175 | fastboot: rootfs | 169 | fastboot: rootfs |
176 | sudo qemu.sh | 170 | sudo qemu.sh |
177 | 171 | ||
178 | samizdat.netinst.iso: | rootfs/samizdat.btrfs | 172 | samizdat.netinst.iso: | $(rootfs) |
179 | exit 1; sudo initrd.sh | 173 | exit 1; sudo initrd.sh |
180 | sudo xorriso-usb.sh $(reuse_child) --bootloader --out $@ | 174 | sudo xorriso-usb.sh $(reuse_child) --bootloader --out $@ |
181 | 175 | ||
@@ -207,7 +201,7 @@ verity_root_hash = $(shell sed -ne 's/^Root hash:[ \t]*//p' $<) | |||
207 | 201 | ||
208 | root_hash = $(shell sed -ne 's/^Root hash: *//p' < $<.log) | 202 | root_hash = $(shell sed -ne 's/^Root hash: *//p' < $<.log) |
209 | 203 | ||
210 | veritymount: rootfs/samizdat.seed.btrfs.verity.log | 204 | veritymount: $(rootfs).verity.log |
211 | @sudo veritysetup remove samizverity >/dev/null 2>&1 || true | 205 | @sudo veritysetup remove samizverity >/dev/null 2>&1 || true |
212 | sudo veritysetup create samizverity $(basename $(basename $<)) \ | 206 | sudo veritysetup create samizverity $(basename $(basename $<)) \ |
213 | $(basename $<) \ | 207 | $(basename $<) \ |
@@ -227,8 +221,7 @@ apt = $(shell which apt || which apt-get) | |||
227 | apt-get-update-stamp: | 221 | apt-get-update-stamp: |
228 | @if $(stale); then set -x; sudo $(apt) update && touch $@; fi | 222 | @if $(stale); then set -x; sudo $(apt) update && touch $@; fi |
229 | 223 | ||
230 | rootfs/seed.iso: $(addprefix rootfs/samizdat.seed.btrf, s \ | 224 | rootfs/seed.iso: $(rootfs) $(if $(VERITY),$(addprefix $(rootfs),.verity .verity.log)) |
231 | $(if $(VERITY), s.verity s.verity.log)) | ||
232 | rm -f $@~tmp | 225 | rm -f $@~tmp |
233 | touch $@~tmp | 226 | touch $@~tmp |
234 | fallocate -n -l 10G $@~tmp | 227 | fallocate -n -l 10G $@~tmp |
@@ -287,9 +280,11 @@ upgrade-key: upgrade key | |||
287 | 280 | ||
288 | .PHONY: usb key emu testinitrdkey testinitrd total-destroy persist | 281 | .PHONY: usb key emu testinitrdkey testinitrd total-destroy persist |
289 | 282 | ||
290 | persist: | partitions/persist.img | 283 | PERSIST_FILE = partitions/_liveboot/persist.img |
291 | partitions/persist.img: | 284 | |
292 | make -C partitions $(notdir $@) | 285 | persist: | $(PERSIST_FILE) |
286 | $(PERSIST_FILE): | ||
287 | $(MAKE) -C partitions $(patsubst partitions/%,%,$@) | ||
293 | 288 | ||
294 | usb emu efi: initrd rootfs | 289 | usb emu efi: initrd rootfs |
295 | key keymu emu-key: initrd | 290 | key keymu emu-key: initrd |
@@ -297,7 +292,7 @@ cleanmu: rootfs-clean total-destroy emu | |||
297 | mu: up cleanmu | 292 | mu: up cleanmu |
298 | 293 | ||
299 | usb emu key keymu emu-key total-destroy efi: | 294 | usb emu key keymu emu-key total-destroy efi: |
300 | make -C partitions clean $@ | 295 | $(MAKE) -C partitions clean $@ |
301 | 296 | ||
302 | testinitrdkey: keymu | 297 | testinitrdkey: keymu |
303 | testinitrd: emu | 298 | testinitrd: emu |
diff --git a/fsmgr b/fsmgr | |||
Subproject 041fde012385cd83876573edd97e30d25f4fb89 | Subproject 60f8cbcdd073854e6ea804b3129010dffbf0cde | ||
diff --git a/import-grub-bootx64-efi b/import-grub-bootx64-efi | |||
Subproject 1dcb9429626603052fe4d307d7deb29c7182f1d | Subproject 2d4e384597040b63b8bc34b8db32a9c4e0f39af | ||
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) |
diff --git a/partitions/part5.conf b/partitions/part5.conf index 08e4196..25d1fdb 100644 --- a/partitions/part5.conf +++ b/partitions/part5.conf | |||
@@ -1,3 +1,3 @@ | |||
1 | name=samizdat-root-seed | 1 | name=samizdat-root-seed |
2 | type=dm-verity-data | 2 | type=dm-verity-data |
3 | data_path=../rootfs/samizdat.seed.btrfs | 3 | data_path=../rootfs/_filesystem/samizdat.seed.btrfs |
diff --git a/partitions/part6.conf b/partitions/part6.conf index 0075c91..d3f7515 100644 --- a/partitions/part6.conf +++ b/partitions/part6.conf | |||
@@ -1,3 +1,3 @@ | |||
1 | name=samizdat-root-seed-verity | 1 | name=samizdat-root-seed-verity |
2 | type=dm-verity-hashes | 2 | type=dm-verity-hashes |
3 | data_path=../rootfs/samizdat.seed.btrfs | 3 | data_path=../rootfs/_filesystem/samizdat.seed.btrfs |
diff --git a/partitions/part7.conf b/partitions/part7.conf index 7a77685..aaeee4e 100644 --- a/partitions/part7.conf +++ b/partitions/part7.conf | |||
@@ -1,3 +1,3 @@ | |||
1 | name=samizdat-rootfs | 1 | name=samizdat-rootfs |
2 | type=dm-verity-data | 2 | type=dm-verity-data |
3 | data_path=../rootfs/samizdat.patch.btrfs | 3 | data_path=../rootfs/_filesystem/samizdat.patch.btrfs |
diff --git a/partitions/part8.conf b/partitions/part8.conf index 8298fd3..9dc22fe 100644 --- a/partitions/part8.conf +++ b/partitions/part8.conf | |||
@@ -1,3 +1,3 @@ | |||
1 | name=samizdat-root-patch-verity | 1 | name=samizdat-root-patch-verity |
2 | type=dm-verity-hashes | 2 | type=dm-verity-hashes |
3 | data_path=../rootfs/samizdat.patch.btrfs | 3 | data_path=../rootfs/_filesystem/samizdat.patch.btrfs |
@@ -330,9 +330,9 @@ mkdir -p "$builddir" | |||
330 | 330 | ||
331 | if [ "$SKIP_ROOTFS_COPY" ] | 331 | if [ "$SKIP_ROOTFS_COPY" ] |
332 | then | 332 | then |
333 | target=key.img | 333 | target=$builddir/key.img |
334 | else | 334 | else |
335 | target=whole.img | 335 | target=$builddir/whole.img |
336 | fi | 336 | fi |
337 | 337 | ||
338 | 338 | ||