Project

General

Profile

« Previous | Next » 

Revision 228

scripts/Makefile includes vegbien_dest.sh directly

View differences:

Makefile
3 3
psqlOpts = --set ON_ERROR_STOP=1 --quiet
4 4
asAdmin = sudo -u postgres
5 5
psqlAdmin = $(asAdmin) psql $(psqlOpts)
6
dbConfig = . util/vegbien_dest.sh
7 6
psqlDbUser = ./util/psql_vegbien $(psqlOpts)
8 7

  
9
all: install
10 8

  
9
all: FORCE install
10

  
11 11
.SUFFIXES:
12 12

  
13 13
FORCE:
14 14
.PHONY: FORCE
15 15

  
16 16

  
17
install: user db
17
install: FORCE user db
18 18

  
19
uninstall: rm_db rm_user
19
uninstall: FORCE rm_db rm_user
20 20

  
21
reinstall: uninstall install
21
reinstall: FORCE uninstall install
22 22

  
23
reinstall_db: rm_db db
23
reinstall_db: FORCE rm_db db
24 24

  
25
empty_db:
25
empty_db: FORCE
26 26
	$(psqlDbUser) <../mappings/schemas/vegbien_empty.sql
27 27

  
28 28
user: FORCE
29
	$(MAKE) _$@
30

  
31
ifeq ($(MAKECMDGOALS),_user)
32
include util/vegbien_dest.sh
33
endif
34

  
35
_user: FORCE
29 36
	@echo "At prompt \"Password:\", enter *your* password for sudo"
30 37
	@sudo -v
31
	@($(dbConfig); echo "At prompt \"Enter password for new role:\", \
32
	enter $$out_password")
33
	-$(user_cmd)
38
	@echo "At prompt \"Enter password for new role:\", enter $(out_password)"
39
	-$(_user_cmd)
34 40
# ignore errors about existing user
35
user_cmd = ($(dbConfig); $(asAdmin) createuser --no-superuser --no-createdb \
36
--no-createrole --pwprompt "$$out_user")
41
_user_cmd = $(asAdmin) createuser --no-superuser --no-createdb --no-createrole \
42
--pwprompt "$(out_user)"
37 43

  
38 44
rm_user: FORCE
39 45
	echo "DROP USER bien;"|$(psqlAdmin)

Also available in: Unified diff