27 |
27 |
|
28 |
28 |
#####
|
29 |
29 |
|
30 |
|
ifneq ($(filter _with_db_%,$(MAKECMDGOALS)),)
|
31 |
|
include util/vegbien_dest
|
32 |
|
endif
|
33 |
|
|
34 |
30 |
with_db = $(MAKE) _with_db_$@
|
35 |
31 |
|
36 |
32 |
#####
|
... | ... | |
63 |
59 |
asPostgresAdmin = sudo -u postgres
|
64 |
60 |
psqlAsAdmin = $(asPostgresAdmin) psql $(psqlOpts)
|
65 |
61 |
psqlAsDbUser = ./util/psql_vegbien $(psqlOpts)
|
|
62 |
bienPassword = $(shell cat util/bien_password)
|
66 |
63 |
|
67 |
64 |
postgres_user: _not_file
|
68 |
65 |
$(with_db)
|
... | ... | |
70 |
67 |
_with_db_postgres_user: _not_file
|
71 |
68 |
@echo $(emph)"At sudo password prompt, enter *your* password"$(end_emph)
|
72 |
69 |
@sudo -v
|
73 |
|
@echo $(emph)"At \"Enter password for new role:\", enter $(out_password)"$(end_emph)
|
|
70 |
@echo $(emph)"At \"Enter password for new role:\", enter $(bienPassword)"$(end_emph)
|
74 |
71 |
-$($@_cmd)
|
75 |
72 |
# ignore errors about user existing
|
76 |
73 |
_with_db_postgres_user_cmd = $(asPostgresAdmin) createuser --no-superuser \
|
77 |
|
--no-createdb --no-createrole --pwprompt "$(out_user)"
|
|
74 |
--no-createdb --no-createrole --pwprompt "bien"
|
78 |
75 |
|
79 |
76 |
rm_postgres_user: _not_file
|
80 |
77 |
echo "DROP USER IF EXISTS bien;"|$(psqlAsAdmin)
|
... | ... | |
103 |
100 |
$(with_db)
|
104 |
101 |
# sub-make will include vegbien_dest
|
105 |
102 |
_with_db_mysql-Linux: _not_file
|
106 |
|
@echo $(emph)"At prompt for MySQL root password, enter $(out_password)"$(end_emph)
|
|
103 |
@echo $(emph)"At prompt for MySQL root password, enter $(bienPassword)"$(end_emph)
|
107 |
104 |
@$(wait)
|
108 |
105 |
-sudo apt-get install mysql-server mysql-client python-mysqldb
|
109 |
106 |
|
... | ... | |
126 |
123 |
|
127 |
124 |
mysql-: _not_file # other OSes
|
128 |
125 |
|
129 |
|
mysqlAsAdmin = mysql --user=root --password='$(out_password)'
|
|
126 |
mysqlAsAdmin = mysql --user=root --password='$(bienPassword)'
|
130 |
127 |
|
131 |
128 |
mysql_user: _not_file
|
132 |
129 |
$(with_db)
|
... | ... | |
134 |
131 |
_with_db_mysql_user: _not_file
|
135 |
132 |
-$($@_cmd)
|
136 |
133 |
# ignore errors about user existing
|
137 |
|
_with_db_mysql_user_cmd = echo "CREATE USER '$(out_user)'@'$(out_host)' \
|
138 |
|
IDENTIFIED BY '$(out_password)';"|$(mysqlAsAdmin)
|
|
134 |
_with_db_mysql_user_cmd = echo "CREATE USER 'bien'@'localhost' \
|
|
135 |
IDENTIFIED BY '$(bienPassword)';"|$(mysqlAsAdmin)
|
139 |
136 |
|
140 |
137 |
rm_mysql_user: _not_file
|
141 |
138 |
$(with_db)
|
Changed vegbien_dest and users of it to use separate bien_password file