db: store compressed database file

automatically decompress before using
This commit is contained in:
Michael Roitzsch
2020-11-24 14:29:44 +01:00
parent 91f62823cd
commit caa1b1dce3
2 changed files with 13 additions and 3 deletions

2
.gitignore vendored
View File

@@ -1 +1 @@
/internals-*.db
/internals-*.db.lz

View File

@@ -1,19 +1,29 @@
MY_INTERNALS = $(HOME)/Library/Mobile\ Documents/com~apple~TextEdit/Documents/Apple\ Internals.rtf
DB = internals-$(shell sw_vers -productVersion).db
DB := $(if $(DB),$(DB:.lz=),internals-$(shell sw_vers -productVersion).db)
DB_TARGETS = db_files
.PHONY: all $(DB_TARGETS)
.INTERMEDIATE: $(DB)
all: internals.txt $(DB)
all: internals.txt $(DB).lz
ifneq ($(wildcard $(MY_INTERNALS)),)
internals.txt: $(MY_INTERNALS)
textutil -cat txt "$<" -output $@
endif
ifneq ($(wildcard $(DB).lz),)
$(DB): $(DB).lz
compression_tool -decode -i $< -o $@
else
$(DB):
@$(MAKE) --silent --jobs=1 $(DB_TARGETS) | sqlite3 -bail $@
$(DB).lz: $(DB)
compression_tool -encode -i $< -o $@
tmutil addexclusion $@
endif
# MARK: - data extraction helpers