Skip to content
Snippets Groups Projects
Commit 904dc7ed authored by Piotr Gawron's avatar Piotr Gawron
Browse files

upgrade from version prior to 14 working (version without dbcommons-config)

parent 61409681
No related branches found
No related tags found
1 merge request!779Resolve "Debian package: use dbconfig-common"
...@@ -98,6 +98,7 @@ sed -i "s/__DB_SCRIPT_DIR__/$DB_SCRIPT_DIR/g" common.sh ...@@ -98,6 +98,7 @@ sed -i "s/__DB_SCRIPT_DIR__/$DB_SCRIPT_DIR/g" common.sh
sed -i "s/__MAX_DB_VERSION_FOR_MIGRTION__/$MAX_DB_VERSION_FOR_MIGRTION/g" common.sh sed -i "s/__MAX_DB_VERSION_FOR_MIGRTION__/$MAX_DB_VERSION_FOR_MIGRTION/g" common.sh
sed -i -e "1r common.sh" debian/config
sed -i -e "1r common.sh" debian/postinst sed -i -e "1r common.sh" debian/postinst
sed -i -e "1r common.sh" debian/postrm sed -i -e "1r common.sh" debian/postrm
sed -i -e "1r common.sh" debian/preinst sed -i -e "1r common.sh" debian/preinst
......
#!/bin/sh #!/bin/sh
log "Running config" $1 $2;
set -e set -e
. /usr/share/debconf/confmodule . /usr/share/debconf/confmodule
db_version 2.0 db_version 2.0
if [ ! -d "/etc/minerva/" ]
then
mkdir /etc/minerva/
fi
if [ -f /usr/share/dbconfig-common/dpkg/config.pgsql ]; then if [ -f /usr/share/dbconfig-common/dpkg/config.pgsql ]; then
. /usr/share/dbconfig-common/dpkg/config.pgsql . /usr/share/dbconfig-common/dpkg/config.pgsql
DB_HOST="localhost"
DB_PORT="5432"
DB_DATABASE_NAME="map_viewer"
DB_USERNAME="map_viewer"
DB_PASSWORD="123qweasdzxc"
if [ -f /etc/minerva/db.properties ]; then
DB_PROPERTIES_FILE="/etc/minerva/db.properties"
DB_HOST=`cat $DB_PROPERTIES_FILE |grep "uri" |cut -f3 -d"/" |cut -f1 -d":"`
DB_PORT=`cat $DB_PROPERTIES_FILE |grep "uri" |cut -f3 -d"/" |cut -f2 -d":"`
DB_DATABASE_NAME=`cat $DB_PROPERTIES_FILE |grep "uri" |cut -f4 -d"/"`
DB_USERNAME=`cat $DB_PROPERTIES_FILE |grep "username" |cut -f2 -d"="`
DB_PASSWORD=`cat $DB_PROPERTIES_FILE |grep "password" |cut -f2 -d"="`
fi
echo "dbserver=$DB_HOST" > /etc/minerva/old.sh
echo "dbport=$DB_PORT" >> /etc/minerva/old.sh
echo "dbname=$DB_DATABASE_NAME" >> /etc/minerva/old.sh
echo "dbuser=$DB_USERNAME" >> /etc/minerva/old.sh
echo "dbpass=$DB_PASSWORD" >> /etc/minerva/old.sh
dbc_first_version="14.0.0~alpha.0"
dbc_load_include="sh:/etc/minerva/old.sh"
dbc_go minerva $@ dbc_go minerva $@
fi fi
...@@ -39,6 +39,8 @@ case "$1" in ...@@ -39,6 +39,8 @@ case "$1" in
dbc_generate_include_owner="root:root" dbc_generate_include_owner="root:root"
dbc_generate_include_perms="0640" dbc_generate_include_perms="0640"
dbc_generate_include=sh:/etc/minerva/db.sh dbc_generate_include=sh:/etc/minerva/db.sh
dbc_first_version="14.0.0~alpha.0"
dbc_load_include="sh:/etc/minerva/old.sh"
# Need to start postgresql, so it doesn't fail on the installer # Need to start postgresql, so it doesn't fail on the installer
invoke-rc.d --force postgresql restart || true invoke-rc.d --force postgresql restart || true
...@@ -46,10 +48,11 @@ case "$1" in ...@@ -46,10 +48,11 @@ case "$1" in
# if there is a config file generated by db_config_common (on upgrade this file might not be generated) # if there is a config file generated by db_config_common (on upgrade this file might not be generated)
if [ -f /etc/minerva/db.sh ] if [ -f /etc/minerva/db.sh ]
then
. /etc/minerva/db.sh . /etc/minerva/db.sh
# when configuration was cancelled don't create config file # when configuration was cancelled don't create config file
if [ -z "$dbuser" ] if [ ! -z "$dbuser" ]
then then
if [ -z "$dbport" ] if [ -z "$dbport" ]
then then
...@@ -64,6 +67,7 @@ case "$1" in ...@@ -64,6 +67,7 @@ case "$1" in
fi fi
rm /etc/minerva/db.sh rm /etc/minerva/db.sh
fi fi
rm /etc/minerva/old.sh
#we have to restart tomcat, because application was started on the old database and it might crash during deployment #we have to restart tomcat, because application was started on the old database and it might crash during deployment
#for instance in the new war file there was init script that uses some new database features, but they are not #for instance in the new war file there was init script that uses some new database features, but they are not
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment