Add a transitional package
Add a transitional package to help migrating the existing database. FEA: ItEr75S03CommunityMaterial
This commit is contained in:
parent
86e8c1b8fb
commit
215e0e9e82
5 changed files with 123 additions and 3 deletions
11
debian/control
vendored
11
debian/control
vendored
|
|
@ -22,3 +22,14 @@ Description: Web application for project planning, monitoring and control.
|
||||||
interact to carry out the work inside a company. Besides, it makes possible
|
interact to carry out the work inside a company. Besides, it makes possible
|
||||||
the communication with other company tools providing a wide set of web
|
the communication with other company tools providing a wide set of web
|
||||||
services to import and export data.
|
services to import and export data.
|
||||||
|
|
||||||
|
Package: navalplan
|
||||||
|
Architecture: all
|
||||||
|
Depends: ${misc:Depends}, libreplan (>= 1.2.0-1)
|
||||||
|
Description: Web application for project management (transitional package)
|
||||||
|
LibrePlan is a planning tool for users based on some concepts: company and
|
||||||
|
multi-project overview, criteria assignments, tasks tagging, resources
|
||||||
|
management, resource allocation (specific and generic), company load control,
|
||||||
|
external integration, etc.
|
||||||
|
.
|
||||||
|
This package can be safely deleted after Libreplan is successfully installed.
|
||||||
|
|
|
||||||
2
debian/libreplan.install
vendored
2
debian/libreplan.install
vendored
|
|
@ -3,4 +3,4 @@ debian/tmp/etc/tomcat6/policy.d/51libreplan.policy
|
||||||
debian/tmp/usr/share/dbconfig-common/data/libreplan/install/pgsql
|
debian/tmp/usr/share/dbconfig-common/data/libreplan/install/pgsql
|
||||||
debian/tmp/usr/share/dbconfig-common/data/libreplan/upgrade/pgsql/1.0.0
|
debian/tmp/usr/share/dbconfig-common/data/libreplan/upgrade/pgsql/1.0.0
|
||||||
debian/tmp/usr/share/dbconfig-common/data/libreplan/upgrade/pgsql/1.1.0
|
debian/tmp/usr/share/dbconfig-common/data/libreplan/upgrade/pgsql/1.1.0
|
||||||
debian/tmp/usr/share/tomcat6/lib/postgresql-jdbc3.jar
|
debian/tmp/usr/share/dbconfig-common/data/libreplan/upgrade/pgsql/1.2.0
|
||||||
|
|
|
||||||
3
debian/libreplan.postinst
vendored
3
debian/libreplan.postinst
vendored
|
|
@ -68,6 +68,9 @@ then
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! -L /usr/share/tomcat6/lib/postgresql-jdbc3.jar ] ; then
|
||||||
|
ln -sf /usr/share/java/postgresql-jdbc3.jar /usr/share/tomcat6/lib/
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -x /etc/init.d/tomcat6 ] ; then
|
if [ -x /etc/init.d/tomcat6 ] ; then
|
||||||
if [ -x "$(which invoke-rc.d 2> /dev/null)" ] ; then
|
if [ -x "$(which invoke-rc.d 2> /dev/null)" ] ; then
|
||||||
|
|
|
||||||
106
debian/navalplan.preinst
vendored
Executable file
106
debian/navalplan.preinst
vendored
Executable file
|
|
@ -0,0 +1,106 @@
|
||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
base_dbconfig_data_dir="/usr/share/dbconfig-common/data"
|
||||||
|
|
||||||
|
install_upgrade_to() {
|
||||||
|
upgrade_file="$base_dbconfig_data_dir/libreplan/upgrade/pgsql/$1"
|
||||||
|
echo "Applying SQL statements to upgrade to version $1..."
|
||||||
|
psql -U $navalplan_user -h $database_host \
|
||||||
|
$navalplan_db < $upgrade_file > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
execute_sql_as_admin() {
|
||||||
|
sql=$1
|
||||||
|
su - -s /bin/sh $navalplan_admin_user -c "psql -c \"$sql\"" > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ $1 = upgrade && -r /etc/dbconfig-common/libreplan.conf
|
||||||
|
&& -r /etc/dbconfig-common/navalplan.conf ]]
|
||||||
|
then
|
||||||
|
old_version=$2
|
||||||
|
|
||||||
|
. /etc/dbconfig-common/libreplan.conf
|
||||||
|
libreplan_user=${dbc_dbuser}
|
||||||
|
libreplan_passwd=${dbc_dbpass}
|
||||||
|
libreplan_db=${dbc_dbname}
|
||||||
|
|
||||||
|
. /etc/dbconfig-common/navalplan.conf
|
||||||
|
navalplan_user=${dbc_dbuser}
|
||||||
|
navalplan_passwd=${dbc_dbpass}
|
||||||
|
navalplan_db=${dbc_dbname}
|
||||||
|
navalplan_admin_user=${dbc_dbadmin}
|
||||||
|
|
||||||
|
if [ -z "${dbc_dbhost}" ] ; then
|
||||||
|
database_host='localhost'
|
||||||
|
else
|
||||||
|
database_host=${dbc_dbhost}
|
||||||
|
fi
|
||||||
|
|
||||||
|
export PGPASSFILE=`mktemp`
|
||||||
|
|
||||||
|
# Stop tomcat to flush active connections.
|
||||||
|
if [ -x /etc/init.d/tomcat6 ] ; then
|
||||||
|
if [ -x "$(which invoke-rc.d 2> /dev/null)" ] ; then
|
||||||
|
invoke-rc.d tomcat6 stop
|
||||||
|
else
|
||||||
|
/etc/init.d/tomcat6 stop
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Dropping newly created empty database...";
|
||||||
|
execute_sql_as_admin "DROP DATABASE $libreplan_db;"
|
||||||
|
|
||||||
|
echo "Trying to apply upgrades to old database..."
|
||||||
|
|
||||||
|
echo "*:*:*:*:$navalplan_passwd" > $PGPASSFILE
|
||||||
|
|
||||||
|
dpkg --compare-versions $old_version "<<" "1.0.0-1"
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
install_upgrade_to "1.0.0"
|
||||||
|
fi
|
||||||
|
dpkg --compare-versions $old_version "<<" "1.1.0-1"
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
install_upgrade_to "1.1.0"
|
||||||
|
fi
|
||||||
|
dpkg --compare-versions $old_version "<<" "1.2.0-1"
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
install_upgrade_to "1.2.0"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Rename old database (navalplan -> libreplan)
|
||||||
|
echo "Renaming old database..."
|
||||||
|
execute_sql_as_admin "ALTER DATABASE $navalplan_db RENAME TO $libreplan_db;"
|
||||||
|
|
||||||
|
# Grant permissions to libreplan user
|
||||||
|
echo "Fixing permissions..."
|
||||||
|
execute_sql_as_admin "GRANT ALL PRIVILEGES ON DATABASE $libreplan_db TO $libreplan_user;"
|
||||||
|
execute_sql_as_admin "ALTER DATABASE $libreplan_db OWNER TO $libreplan_user;"
|
||||||
|
|
||||||
|
su - -s /bin/sh $navalplan_admin_user -c \
|
||||||
|
"psql $libreplan_db -c \"GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA
|
||||||
|
public TO $libreplan_user;\"" > /dev/null
|
||||||
|
|
||||||
|
rm $PGPASSFILE
|
||||||
|
|
||||||
|
# Remove old deployment directory as it's no longer necessary.
|
||||||
|
if [ -d /var/lib/tomcat6/webapps/navalplan/ ] ; then
|
||||||
|
rm -rf /var/lib/tomcat6/webapps/navalplan/
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make sure the driver is there, as it might be removed when
|
||||||
|
# uninstalling older versions of the package.
|
||||||
|
if [ ! -L /usr/share/tomcat6/lib/postgresql-jdbc3.jar ] ; then
|
||||||
|
ln -sf /usr/share/java/postgresql-jdbc3.jar /usr/share/tomcat6/lib/
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Start tomcat again
|
||||||
|
if [ -x /etc/init.d/tomcat6 ] ; then
|
||||||
|
if [ -x "$(which invoke-rc.d 2> /dev/null)" ] ; then
|
||||||
|
invoke-rc.d tomcat6 start
|
||||||
|
else
|
||||||
|
/etc/init.d/tomcat6 start
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
#DEBHELPER#
|
||||||
4
debian/rules
vendored
4
debian/rules
vendored
|
|
@ -89,8 +89,8 @@ install:
|
||||||
$(call CMD,cp $(CURDIR)/debian/51libreplan.policy \
|
$(call CMD,cp $(CURDIR)/debian/51libreplan.policy \
|
||||||
$(CURDIR)/debian/tmp/etc/tomcat6/policy.d/)
|
$(CURDIR)/debian/tmp/etc/tomcat6/policy.d/)
|
||||||
# Link Java PostgreSQL library
|
# Link Java PostgreSQL library
|
||||||
$(call CMD,mkdir -p $(CURDIR)/debian/tmp/usr/share/tomcat6/lib)
|
#$(call CMD,mkdir -p $(CURDIR)/debian/tmp/usr/share/tomcat6/lib)
|
||||||
$(call CMD,ln -sf /usr/share/java/postgresql-jdbc3.jar $(CURDIR)/debian/tmp/usr/share/tomcat6/lib)
|
#$(call CMD,ln -sf /usr/share/java/postgresql-jdbc3.jar $(CURDIR)/debian/tmp/usr/share/tomcat6/lib)
|
||||||
$(call CMD,dh_install)
|
$(call CMD,dh_install)
|
||||||
|
|
||||||
binary-indep: build install
|
binary-indep: build install
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue