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 # ---------------------------------------------------------------------------
82 001.schema.offline.sql
85 006.schema.permissions.sql
87 011.schema.authority.sql
88 020.schema.functions.sql
89 030.schema.metabib.sql
91 070.schema.container.sql
95 300.schema.staged_search.sql
97 500.view.cross-schema.sql
100 900.audit-functions.sql
106 # ---------------------------------------------------------------------------
107 # Import files via psql, warn user on error, suggest abort.
108 # ---------------------------------------------------------------------------
109 for sql_file in $ordered_file_list; do
110 # It would be wise to turn this on only if confidence is high that errors in
111 # scripts will result in terminal failures. Currently, there are a couple
112 # that seem benign. --asjoyner
113 # export ON_ERROR_STOP=1
115 export PGHOST PGPORT PGDATABASE PGUSER PGPASSWORD
119 ********************************************************************************
120 * There was an error with a database configuration file: *
122 * It is very likely that your installation will be unsuccessful because of *
123 * this error. Press Control-C to abort, or press enter to charge ahead. *
124 ********************************************************************************