Project

General

Profile

« Previous | Next » 

Revision 5209

input.Makefile: Staging tables installation: uninstall: For the TNRS datasource, prompt the user before deleting the schema, since the data in it is not easily reconstructible from a flat file

View differences:

input.Makefile
47 47
emph := $(esc)'7m '
48 48
endEmph := ' '$(reset)
49 49

  
50
# User interaction
51

  
52
confirm = $(if $(shell read -p $(emph)"$(1)"$(endEmph)$$'$(if\
53
$(2),\n$(2))\nContinue? (y/n) ' REPLY; test "$$REPLY" = y && echo t),,\
54
$(error Aborting))
55

  
50 56
# Commands
51 57
MKDIR = mkdir -p
52 58
mkdir = $(MKDIR) $(@D)
......
172 178

  
173 179
install: _always schema $(allInstalls:%=%/install) ;
174 180

  
175
uninstall: _always rm_schema ;
181
uninstall: _always confirm_rm_schema rm_schema ;
176 182
# rm_schema will also drop all staging tables
177 183

  
178 184
reinstall: _always uninstall install ;
179 185

  
186
confirm_rm_schema: _always
187
	$(if $(filter TNRS,$(datasrc)),$(call confirm,WARNING: This will delete the\
188
TNRS cache!,To save it: make backups/TNRS.backup-remake))
189

  
180 190
schema: _always
181 191
	-echo 'CREATE SCHEMA "$(datasrc)";'|$(psqlAsBien)
182 192
# ignore errors if schema exists

Also available in: Unified diff