<commit_before>
IMAGE_SIZE=20M

SETUP_DEV_LABEL=bme-setup
DEBUG_DEV_LABEL=bme-debug

.PHONEY: all clean

all: setup-usb.img setup-usb.img.gz debug-usb.img debug-usb.img.gz

clean:
	rm -f setup-usb.img setup-usb.img.gz debug-usb.img debug-usb.img.gz
	# remove temporary files
	sudo rm -rf .su-img.tmp .su-root.tmp .su-fsroot.tmp
	sudo rm -rf .du-img.tmp .du-root.tmp .du-fsroot.tmp

setup-usb.img.gz: setup-usb.img
	gzip --keep setup-usb.img

debug-usb.img.gz: debug-usb.img
	gzip --keep debug-usb.img

setup-usb.img: setup.conf setup.sh system-reset.sh service/* config/* gpg/*
	sudo rm -rf .su-img.tmp .su-root.tmp .su-fsroot.tmp
	mkdir -p .su-root.tmp .su-fsroot.tmp

	cp -a setup.conf setup.sh system-reset.sh .su-root.tmp/
	cd service && make
	cp -a service/ .su-root.tmp/
	rm .su-root.tmp/service/Makefile
	cp -a config/  .su-root.tmp/
	rm .su-root.tmp/config/*.tmpl.conf
	[ -f .su-root.tmp/config/wpa_supplicant.conf ] || (echo "ERROR: wpa_supplicant.conf file is not found." >&2; exit 1)
	cp -a gpg/     .su-root.tmp/
	touch .su-root.tmp/host_passwd.list
	touch .su-root.tmp/host_secret.list

	cd .su-root.tmp && find -type f -exec sha256sum '{}' '+' |sort >../.su-sha256sum
	cd .su-root.tmp && mv ../.su-sha256sum sha256sum
	cd .su-root.tmp && gpg --output sha256sum.sig --sign sha256sum

	fallocate -l ${IMAGE_SIZE} .su-img.tmp
	# create a partition
	echo "g\nn\n1\n\n\nw" |fdisk .su-img.tmp
	sudo losetup --show -P /dev/loop4 .su-img.tmp
	sudo mkfs.fat /dev/loop4p1
	sudo fatlabel /dev/loop4p1 ${SETUP_DEV_LABEL}<commit_msg>suppress overwrite prompt<commit_after>
IMAGE_SIZE=20M

SETUP_DEV_LABEL=bme-setup
DEBUG_DEV_LABEL=bme-debug

.PHONEY: all clean

all: setup-usb.img setup-usb.img.gz debug-usb.img debug-usb.img.gz

clean:
	rm -f setup-usb.img setup-usb.img.gz debug-usb.img debug-usb.img.gz
	# remove temporary files
	sudo rm -rf .su-img.tmp .su-root.tmp .su-fsroot.tmp
	sudo rm -rf .du-img.tmp .du-root.tmp .du-fsroot.tmp

setup-usb.img.gz: setup-usb.img
	rm -f setup-usb.img.gz
	gzip --keep setup-usb.img

debug-usb.img.gz: debug-usb.img
	rm -f debug-usb.img.gz
	gzip --keep debug-usb.img

setup-usb.img: setup.conf setup.sh system-reset.sh service/* config/* gpg/*
	sudo rm -rf .su-img.tmp .su-root.tmp .su-fsroot.tmp
	mkdir -p .su-root.tmp .su-fsroot.tmp

	cp -a setup.conf setup.sh system-reset.sh .su-root.tmp/
	cd service && make
	cp -a service/ .su-root.tmp/
	rm .su-root.tmp/service/Makefile
	cp -a config/  .su-root.tmp/
	rm .su-root.tmp/config/*.tmpl.conf
	[ -f .su-root.tmp/config/wpa_supplicant.conf ] || (echo "ERROR: wpa_supplicant.conf file is not found." >&2; exit 1)
	cp -a gpg/     .su-root.tmp/
	touch .su-root.tmp/host_passwd.list
	touch .su-root.tmp/host_secret.list

	cd .su-root.tmp && find -type f -exec sha256sum '{}' '+' |sort >../.su-sha256sum
	cd .su-root.tmp && mv ../.su-sha256sum sha256sum
	cd .su-root.tmp && gpg --output sha256sum.sig --sign sha256sum

	fallocate -l ${IMAGE_SIZE} .su-img.tmp
	# create a partition
	echo "g\nn\n1\n\n\nw" |fdisk .su-img.tmp
	sudo losetup --show -P /dev/loop4 .su-img.tmp
	sudo mkfs.fat /dev/loop4p1
	sudo fatlabel /dev/loop4p1 ${SETUP_DEV_LABEL}
{'fraction_non_alphanumeric': 0.16432225063938619, 'fraction_numerical': 0.017902813299232736, 'mean_word_length': 2.8581997533908754, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2851728', 'n_tokens_mistral': 1395, 'n_tokens_neox': 1342, 'n_words': 301}