mirror of
https://github.com/mroi/apple-internals.git
synced 2026-02-12 17:12:44 +00:00
check: existence of mentioned files
first check also sets up checks infrastructure
This commit is contained in:
18
Makefile
18
Makefile
@@ -1,11 +1,12 @@
|
||||
MY_INTERNALS = $(HOME)/Library/Mobile\ Documents/com~apple~TextEdit/Documents/Apple\ Internals.rtf
|
||||
DB := $(if $(DB),$(DB:.lz=),internals-$(shell sw_vers -productVersion).db)
|
||||
DB_TARGETS = db_files
|
||||
CHECK_TARGETS = check_files
|
||||
|
||||
.PHONY: all $(DB_TARGETS)
|
||||
.PHONY: all check $(DB_TARGETS) $(CHECK_TARGETS)
|
||||
.INTERMEDIATE: $(DB)
|
||||
|
||||
all: internals.txt $(DB).lz
|
||||
all: $(DB).lz check
|
||||
|
||||
ifneq ($(wildcard $(MY_INTERNALS)),)
|
||||
internals.txt: $(MY_INTERNALS)
|
||||
@@ -24,6 +25,10 @@ $(DB).lz: $(DB)
|
||||
tmutil addexclusion $@
|
||||
endif
|
||||
|
||||
check: internals.txt
|
||||
@LANG=en sort --ignore-case $< | diff -uw $< -
|
||||
@$(MAKE) --silent --jobs=1 $(CHECK_TARGETS)
|
||||
|
||||
|
||||
# MARK: - data extraction helpers
|
||||
|
||||
@@ -63,3 +68,12 @@ db_files::
|
||||
|
||||
$(DB_TARGETS)::
|
||||
echo 'COMMIT TRANSACTION;'
|
||||
|
||||
|
||||
# MARK: - check targets for internals.txt
|
||||
|
||||
check_files: internals.txt $(DB)
|
||||
printf '\033[1mchecking files...\033[m\n' >&2
|
||||
grep -ow '~\?/[^,;]*' $< | sed -E 's/ \(.*\)$$//;s/^\/(etc|var)\//\/private&/' | \
|
||||
sed "s/'/''/g;s|.*|SELECT count(*), '&' FROM files WHERE path GLOB '&';|" | \
|
||||
sqlite3 $(DB) | sed -n "/^0|/{s/^0|//;p;}"
|
||||
|
||||
Reference in New Issue
Block a user