Project

General

Profile

« Previous | Next » 

Revision 227

Moved db user creation to scripts/Makefile. Removed now-unneeded admin scripts.

View differences:

scripts/admin/bien_user_create
1
#!/bin/sh
2
selfDir="$(dirname -- "$0")"
3

  
4
. "$selfDir/../util/vegbien_dest.sh"
5

  
6
echo "At prompt \"Password:\", enter *your* password for sudo" >&2
7
sudo -v
8

  
9
echo "At prompt \"Enter password for new role:\", enter $out_password" >&2
10
sudo -u postgres createuser --no-superuser --no-createdb --no-createrole \
11
--pwprompt "$@" "$out_user"
12 0

  
scripts/admin/vegbien_db_empty.sql
1
TRUNCATE address CASCADE;
2
TRUNCATE aux_role CASCADE;
3
TRUNCATE classcontributor CASCADE;
4
TRUNCATE collectiveobs CASCADE;
5
TRUNCATE commclass CASCADE;
6
TRUNCATE commconcept CASCADE;
7
TRUNCATE commcorrelation CASCADE;
8
TRUNCATE comminterpretation CASCADE;
9
TRUNCATE commlineage CASCADE;
10
TRUNCATE commname CASCADE;
11
TRUNCATE commstatus CASCADE;
12
TRUNCATE commusage CASCADE;
13
TRUNCATE coverindex CASCADE;
14
TRUNCATE covermethod CASCADE;
15
TRUNCATE dba_confidentialitystatus CASCADE;
16
TRUNCATE dba_cookie CASCADE;
17
TRUNCATE dba_cookielabels CASCADE;
18
TRUNCATE dba_datacache CASCADE;
19
TRUNCATE dba_datamodelversion CASCADE;
20
TRUNCATE dba_dbstatstime CASCADE;
21
TRUNCATE dba_fielddescription CASCADE;
22
TRUNCATE dba_fieldlist CASCADE;
23
TRUNCATE dba_onerow CASCADE;
24
TRUNCATE dba_preassignacccode CASCADE;
25
TRUNCATE dba_tabledescription CASCADE;
26
TRUNCATE dba_xmlcache CASCADE;
27
TRUNCATE definedvalue CASCADE;
28
TRUNCATE disturbanceobs CASCADE;
29
TRUNCATE embargo CASCADE;
30
TRUNCATE graphic CASCADE;
31
TRUNCATE individual CASCADE;
32
TRUNCATE keywords CASCADE;
33
TRUNCATE keywords_extra CASCADE;
34
TRUNCATE namedplace CASCADE;
35
TRUNCATE namedplacecorrelation CASCADE;
36
TRUNCATE note CASCADE;
37
TRUNCATE notelink CASCADE;
38
TRUNCATE observationcontributor CASCADE;
39
TRUNCATE observationsynonym CASCADE;
40
TRUNCATE party CASCADE;
41
TRUNCATE partymember CASCADE;
42
TRUNCATE place CASCADE;
43
TRUNCATE plantconcept CASCADE;
44
TRUNCATE plantcorrelation CASCADE;
45
TRUNCATE plantlineage CASCADE;
46
TRUNCATE plantname CASCADE;
47
TRUNCATE plantstatus CASCADE;
48
TRUNCATE plantusage CASCADE;
49
TRUNCATE plot CASCADE;
50
TRUNCATE plotevent CASCADE;
51
TRUNCATE project CASCADE;
52
TRUNCATE projectcontributor CASCADE;
53
TRUNCATE reference CASCADE;
54
TRUNCATE referencealtident CASCADE;
55
TRUNCATE referencecontributor CASCADE;
56
TRUNCATE referencejournal CASCADE;
57
TRUNCATE referenceparty CASCADE;
58
TRUNCATE revision CASCADE;
59
TRUNCATE soilobs CASCADE;
60
TRUNCATE soiltaxon CASCADE;
61
TRUNCATE stemcount CASCADE;
62
TRUNCATE stratummethod CASCADE;
63
TRUNCATE stratumtype CASCADE;
64
TRUNCATE taxonalt CASCADE;
65
TRUNCATE taxonbin CASCADE;
66
TRUNCATE taxondetermination CASCADE;
67
TRUNCATE taxonoccurrence CASCADE;
68
TRUNCATE telephone CASCADE;
69
TRUNCATE temptbl_std_commnames CASCADE;
70
TRUNCATE temptbl_std_plantnames CASCADE;
71
TRUNCATE usercertification CASCADE;
72
TRUNCATE userdataset CASCADE;
73
TRUNCATE userdatasetitem CASCADE;
74
TRUNCATE userdefined CASCADE;
75
TRUNCATE usernotify CASCADE;
76
TRUNCATE userpermission CASCADE;
77
TRUNCATE userpreference CASCADE;
78
TRUNCATE userquery CASCADE;
79
TRUNCATE userrecordowner CASCADE;
80
TRUNCATE userregionalexp CASCADE;
81
TRUNCATE usr CASCADE;
scripts/admin/vegbien_db_empty
1
#!/bin/sh
2
selfDir="$(dirname -- "$0")"
3

  
4
export PGOPTIONS='--client-min-messages=WARNING'
5

  
6
"$selfDir/../util/psql_vegbien" --quiet <"$0.sql"
7 0

  
scripts/Makefile
1 1
export PGOPTIONS = --client-min-messages=WARNING
2 2

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

  
7 9
all: install
......
24 26
	$(psqlDbUser) <../mappings/schemas/vegbien_empty.sql
25 27

  
26 28
user: FORCE
27
	-./admin/bien_user_create
29
	@echo "At prompt \"Password:\", enter *your* password for sudo"
30
	@sudo -v
31
	@($(dbConfig); echo "At prompt \"Enter password for new role:\", \
32
	enter $$out_password")
33
	-$(user_cmd)
28 34
# ignore errors about existing user
35
user_cmd = ($(dbConfig); $(asAdmin) createuser --no-superuser --no-createdb \
36
--no-createrole --pwprompt "$$out_user")
29 37

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

Also available in: Unified diff