maps-database will now update itself same as ncep-database

This commit is contained in:
mjames-upc 2016-03-21 13:12:49 -06:00
parent 27742c8403
commit b8053833f1

View file

@ -42,9 +42,7 @@ if [ $? -ne 0 ]; then
fi fi
# Copy the sql that is needed to create the maps database. # Copy the sql that is needed to create the maps database.
PATH_TO_DDL="build.edex/opt/db/ddl" cp -r %{_baseline_workspace}/build.edex/opt/db/ddl/maps/* \
PATH_TO_MAPS_DDL="${PATH_TO_DDL}/maps"
cp -r %{_baseline_workspace}/${PATH_TO_MAPS_DDL}/* \
${RPM_BUILD_ROOT}/awips2/database/sqlScripts/share/sql/maps ${RPM_BUILD_ROOT}/awips2/database/sqlScripts/share/sql/maps
PATH_TO_STATIC_DDL="%{_awipscm_share}/awips2-static/maps/db" PATH_TO_STATIC_DDL="%{_awipscm_share}/awips2-static/maps/db"
@ -130,17 +128,11 @@ else
fi fi
# Is there a maps database? # Is there a maps database?
MAPS_DB_EXISTS="false"
MAPS_DB=`${PSQL} -U awips -l | grep maps | awk '{print $1}'` MAPS_DB=`${PSQL} -U awips -l | grep maps | awk '{print $1}'`
if [ "${MAPS_DB}" = "maps" ]; then
MAPS_DB_EXISTS="true"
# We Have a Maps Database, There Is Nothing To Do.
fi
if [ "${MAPS_DB_EXISTS}" = "false" ]; then
# Create the maps directory; remove any existing directories. # Create the maps directory; remove any existing directories.
if [ -d /awips2/data/maps ]; then if [ -d /awips2/data/maps ]; then
su - ${DB_OWNER} -c "rm -rf /awips2/data/maps" su - ${DB_OWNER} -c "rm -rf /awips2/data/maps" # seems like this is what we want to do...
fi fi
su - ${DB_OWNER} -c "mkdir -p /awips2/data/maps" su - ${DB_OWNER} -c "mkdir -p /awips2/data/maps"
@ -185,7 +177,6 @@ if [ "${MAPS_DB_EXISTS}" = "false" ]; then
su - ${DB_OWNER} -c \ su - ${DB_OWNER} -c \
"${PG_RESTORE} -d maps -U awips -p 5432 -n public -t geometry_columns -a ${DB_ARCHIVE}" \ "${PG_RESTORE} -d maps -U awips -p 5432 -n public -t geometry_columns -a ${DB_ARCHIVE}" \
>> ${SQL_LOG} 2>&1 >> ${SQL_LOG} 2>&1
fi
# stop PostgreSQL if we started it. # stop PostgreSQL if we started it.
if [ "${I_STARTED_POSTGRESQL}" = "YES" ]; then if [ "${I_STARTED_POSTGRESQL}" = "YES" ]; then