3 # ---------------------------------------------------------------------------
4 # Store command line args for later use
5 # args: {db-host} {db-port} {db-name} {db-user} {db-password}
6 # ---------------------------------------------------------------------------
12 export PGHOST PGPORT PGDATABASE PGUSER PGPASSWORD
14 # ---------------------------------------------------------------------------
15 # Lookup the database version from the PostgreSQL server.
16 # ---------------------------------------------------------------------------
17 DB_VERSION=`psql -qtc 'show server_version;' | xargs | cut -c1,3`
18 if [ -z "$DB_VERSION" ] || [ `echo $DB_VERSION | grep -c '[^0-9]'` != 0 ]; then
20 ********************************************************************************
21 * Could not determine the version of PostgreSQL you have installed. Our best *
24 * which didn't make any sense. For assistance, please email *
25 * open-ils-general@list.georgialibraries.org or join #OpenILS-Evergreen on the *
26 * freenode IRC network. *
27 ********************************************************************************
32 # ---------------------------------------------------------------------------
33 # Validate fts-config file is available for specified DB_VERSION.
34 # ---------------------------------------------------------------------------
35 if [ -e "000.english.pg$DB_VERSION.fts-config.sql" ]; then
36 fts_config_file="000.english.pg$DB_VERSION.fts-config.sql"
38 # -------------------------------------------------------------------------
39 # Attempt to auto-detect the latest available config file.
40 # -------------------------------------------------------------------------
42 for i in $(seq 80 99 | sort -rn); do
43 if [ -e "000.english.pg$i.fts-config.sql" ]; then
48 if [ -z "$last_ver" ]; then
50 ********************************************************************************
51 * Cannot locate any configuration files for full text search config. This *
52 * may indicate a problem with your copy of the source files. We attempted to *
53 * find files like 000.english.pg83.fts-config.sql in this directory: *
55 * but were unsuccessful. Aborting. *
56 ********************************************************************************
61 a=$DB_VERSION # preserves the text alignment below, in a cheap fashion
62 b=$last_ver # assuming of course two character DB_VERSION and last_ver
64 ********************************************************************************
65 * There is no configuration for full text search config, for the database *
66 * version you have installed ($a). If you're not really sure why, you should *
67 * proabably press 'Control-C' now, and abort. To continue using the latest *
68 * available version ($b), press enter. For assistance, please email *
69 * open-ils-general@list.georgialibraries.org or join #OpenILS-Evergreen on the *
70 * freenode IRC network. *
71 ********************************************************************************
74 fts_config_file="000.english.pg$last_ver.fts-config.sql"
77 # ---------------------------------------------------------------------------
78 # This describes the order in which the SQL files will be eval'd by psql.
79 # ---------------------------------------------------------------------------
83 001.schema.offline.sql
84 002.functions.aggregate.sql
85 002.functions.config.sql
88 006.schema.permissions.sql
90 011.schema.authority.sql
91 012.schema.vandelay.sql
92 020.schema.functions.sql
93 030.schema.metabib.sql
95 070.schema.container.sql
102 300.schema.staged_search.sql
104 500.view.cross-schema.sql
108 900.audit-functions.sql
110 950.data.seed-values.sql
111 951.data.MODS-xsl.sql
112 952.data.MODS3-xsl.sql
113 953.data.MODS32-xsl.sql
119 # ---------------------------------------------------------------------------
120 # Import files via psql, warn user on error, suggest abort.
121 # ---------------------------------------------------------------------------
122 for sql_file in $ordered_file_list; do
123 # It would be wise to turn this on only if confidence is high that errors in
124 # scripts will result in terminal failures. Currently, there are a couple
125 # that seem benign. --asjoyner
126 # export ON_ERROR_STOP=1
128 export PGHOST PGPORT PGDATABASE PGUSER PGPASSWORD
132 ********************************************************************************
133 * There was an error with a database configuration file: *
135 * It is very likely that your installation will be unsuccessful because of *
136 * this error. Press Control-C to abort, or press enter to charge ahead. *
137 ********************************************************************************