forked from mff-uk/odcs
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #495 from UnifiedViews/feature/deb_packaging
Debian packaging moved to core repo
- Loading branch information
Showing
108 changed files
with
11,871 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
Packages | ||
======== | ||
|
||
Provides source for creating UnifiedViews packages for various Linux distributions. | ||
|
||
How to install with dependency | ||
|
||
~~~bash | ||
echo "deb http://packages.comsode.eu/debian wheezy main" > /etc/apt/sources.list.d/odn.list | ||
wget -O - http://packages.comsode.eu/key/odn.gpg.key | apt-key add - | ||
apt-get update | ||
~~~ | ||
|
||
|
||
To install unifiedview using postgresql | ||
~~~bash | ||
apt-get install unifiedviews-pgsql | ||
~~~ | ||
|
||
To install unifiedview using mysql | ||
~~~bash | ||
apt-get install unifiedviews-mysql | ||
~~~ | ||
|
||
|
||
|
||
How to create .deb packages for Debian: | ||
|
||
go to where pom.xml is placed and run | ||
~~~bash | ||
mvn package | ||
~~~ | ||
|
||
that creates files .deb in target/ | ||
![Debian dependency graph](debian_dependencyGraph.png) | ||
|
||
The known issues: | ||
- be aware of the possible problem - https://github.com/UnifiedViews/Core/issues/258 | ||
- to add backup configuration before an update installation of packages | ||
- to clean database schema during a purge phase | ||
- to change location from /etc/unifiedviews to /etc/default/unifiedviews | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>eu.unifiedviews</groupId> | ||
<artifactId>uv-core</artifactId> | ||
<version>2.2.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<groupId>eu.unifiedviews.packages</groupId> | ||
<artifactId>unifiedviews-packages</artifactId> | ||
<name>unifiedviews-packages</name> | ||
<packaging>pom</packaging> | ||
<description /> | ||
|
||
<modules> | ||
<module>unifiedviews-mysql</module> | ||
<module>unifiedviews-pgsql</module> | ||
<module>unifiedviews-backend</module> | ||
<module>unifiedviews-backend-mysql</module> | ||
<module>unifiedviews-backend-pgsql</module> | ||
<module>unifiedviews-backend-shared</module> | ||
<module>unifiedviews-webapp</module> | ||
<module>unifiedviews-webapp-mysql</module> | ||
<module>unifiedviews-webapp-pgsql</module> | ||
<module>unifiedviews-webapp-shared</module> | ||
</modules> | ||
|
||
<properties> | ||
<debian-package-version>2.1.2~</debian-package-version> | ||
<debian-package-name>${project.build.directory}/${project.artifactId}-${debian-package-version}_all.deb</debian-package-name> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>external.atlassian.jgitflow</groupId> | ||
<artifactId>jgitflow-maven-plugin</artifactId> | ||
<version>1.0-m4.3</version> | ||
<configuration> | ||
<flowInitContext> | ||
<!-- masterBranchName>odn/master</masterBranchName> | ||
<developBranchName>odn/develop</developBranchName> | ||
<featureBranchPrefix>feature-</featureBranchPrefix --> | ||
<releaseBranchPrefix>release/UV_v</releaseBranchPrefix> | ||
<!-- hotfixBranchPrefix>hotfix-</hotfixBranchPrefix --> | ||
<versionTagPrefix>UV_v</versionTagPrefix> | ||
</flowInitContext> | ||
<allowSnapshots>true</allowSnapshots> | ||
<noDeploy>true</noDeploy> | ||
<!-- see goals wiki page for configuration options --> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>eu.unifiedviews.packages</groupId> | ||
<artifactId>unifiedviews-packages</artifactId> | ||
<version>2.2.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<groupId>eu.unifiedviews.packages</groupId> | ||
<artifactId>unifiedviews-backend-mysql</artifactId> | ||
<name>unifiedviews-backend-mysql</name> | ||
|
||
<description /> | ||
|
||
<dependencies> | ||
<dependency> | ||
<!-- commons-app project --> | ||
<groupId>eu.unifiedviews</groupId> | ||
<artifactId>backend</artifactId> | ||
<version>2.1.2</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<repositories> | ||
<repository> | ||
<id>maven.eea.sk</id> | ||
<name>maven.eea.sk-public</name> | ||
<url>http://maven.eea.sk/artifactory/public/</url> | ||
</repository> | ||
</repositories> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>jdeb</artifactId> | ||
<groupId>org.vafer</groupId> | ||
<version>1.4</version> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>jdeb</goal> | ||
</goals> | ||
<configuration> | ||
<deb>${debian-package-name}</deb> | ||
<dataSet> | ||
<!-- unifiedviews-backend configuration for mysql --> | ||
<data> | ||
<src>${basedir}/src/deb/etc/unifiedviews/backend-config.properties</src> | ||
<type>file</type> | ||
<mapper> | ||
<type>perm</type> | ||
<prefix>/etc/unifiedviews</prefix> | ||
</mapper> | ||
</data> | ||
<!-- mysql db scripts--> | ||
<data> | ||
<src>${basedir}/src/deb/usr/share/unifiedviews/mysql</src> | ||
<type>directory</type> | ||
<mapper> | ||
<type>perm</type> | ||
<prefix>/usr/share/unifiedviews/mysql</prefix> | ||
</mapper> | ||
</data> | ||
</dataSet> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/etc/unifiedviews/backend-config.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
set -e | ||
. /usr/share/debconf/confmodule | ||
|
||
db_input low backend/mysql_root || true | ||
db_go | ||
db_input low backend/mysql_db_user || true | ||
db_go | ||
db_input low backend/mysql_db_password || true | ||
db_go | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Package: unifiedviews-backend-mysql | ||
Version: [[debian-package-version]] | ||
Section: java | ||
Priority: extra | ||
Architecture: all | ||
Maintainer: jmc@eea.sk | ||
Depends: unifiedviews-backend-shared (>> 2.1), unifiedviews-backend-shared (<< 2.2), mysql-server, debconf (>= 0.5) | ||
Conflicts: unifiedviews-backend-pgsql | ||
Description: The mysql database and settings for unifiedviews's backend. |
193 changes: 193 additions & 0 deletions
193
debian/unifiedviews-backend-mysql/src/deb/control/postinst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
#!/bin/sh | ||
# postinst script for #PACKAGE# | ||
# | ||
# see: dh_installdeb(1) | ||
|
||
set -e | ||
|
||
# summary of how this script can be called: | ||
# * <postinst> `configure' <most-recently-configured-version> | ||
# * <old-postinst> `abort-upgrade' <new version> | ||
# * <conflictor's-postinst> `abort-remove' `in-favour' <package> | ||
# <new-version> | ||
# * <postinst> `abort-remove' | ||
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour' | ||
# <failed-install-package> <version> `removing' | ||
# <conflicting-package> <version> | ||
# for details, see http://www.debian.org/doc/debian-policy/ or | ||
# the debian-policy package | ||
|
||
. /usr/share/debconf/confmodule | ||
|
||
db_creadentials(){ | ||
echo " >>> db_creadentials" | ||
db_get backend/mysql_root | ||
ROOT_PW=$RET | ||
|
||
db_get backend/mysql_db_user | ||
DBA_USER=$RET | ||
|
||
db_get backend/mysql_db_password | ||
DBA_PASS=$RET | ||
echo " <<< db_creadentials" | ||
} | ||
|
||
set_java() { | ||
echo " >>> set_java" | ||
|
||
JAVA_VERSION=`java -version 2>&1 | grep "java version" | awk '{print $3}' | tr -d \" | awk '{split($0, array, ".")} END{print array[2]}'` | ||
echo -n "check java version" | ||
if [ ! $JAVA_VERSION -eq 7 ]; then | ||
JAVA_NAME=`update-java-alternatives -l | grep 7 | cut -d' ' -f1` | ||
if [ -n $JAVA_NAME ] ; then | ||
/usr/sbin/update-java-alternatives --jre-headless --set $JAVA_NAME | ||
echo " - Java version is set to 1.7" | ||
else | ||
echo " ERROR: java 7 is not installed" | ||
fi | ||
|
||
else | ||
echo " - ok" | ||
fi | ||
echo " <<< set_java" | ||
} | ||
|
||
|
||
db_up() { | ||
echo " >>> db_up" | ||
|
||
#Check if mysql is started | ||
service mysql status > /dev/null || service mysql start >/dev/null 2>&1 | ||
|
||
echo -n "INFO: Waiting for mysql to be up..." | ||
|
||
CPT=0 | ||
TIMEOUT=60 | ||
while [ 1 ] | ||
do | ||
mysql --password=$ROOT_PW -e ' SELECT "isRunning" '>/dev/null 2>&1 | ||
if [ $? -eq 0 ]; then | ||
break | ||
fi | ||
|
||
echo -n "." | ||
sleep 1 | ||
CPT=$((${CPT}+1)) | ||
if [ ${CPT} -eq ${TIMEOUT} ] | ||
then | ||
echo -e "\nERROR: Connection to Mysql has not been established before timeout. Exiting" | ||
exit 1 | ||
fi | ||
done | ||
|
||
echo " Done" | ||
echo " <<< db_up" | ||
} | ||
|
||
|
||
db_configure() { | ||
echo " >>> db_configure" | ||
DB_NAME=unifiedviews | ||
# if database unifiedviews is not exist | ||
if ! mysql -u $DBA_USER --password=$DBA_PASS -e 'use '$DB_NAME''; then | ||
echo "create database if not exists $DB_NAME;" | mysql --password=$ROOT_PW | ||
echo "created database: $DB_NAME" | ||
# create a user if not exists | ||
echo "create user '${DBA_USER}' identified by '${DBA_PASS}';" | mysql --password=$ROOT_PW || true | ||
echo "created user: $DBA_USER" | ||
cd /usr/share/unifiedviews/mysql | ||
mysql -u $DBA_USER --password=$DBA_PASS $DB_NAME < \ | ||
/usr/share/unifiedviews/mysql/schema.sql | ||
mysql -u $DBA_USER --password=$DBA_PASS $DB_NAME < \ | ||
/usr/share/unifiedviews/mysql/data.sql | ||
fi | ||
|
||
version=`mysql -u $DBA_USER --password=$DBA_PASS -s -N -e "select value from properties WHERE properties.key='UV.Core.version' " $DB_NAME` | ||
if [ "$version" = "001.004.000" ] | ||
then | ||
# set db schema version | ||
mysql -u $DBA_USER --password=$DBA_PASS $DB_NAME < \ | ||
/usr/share/unifiedviews/mysql/1.5.0-update.sql | ||
fi | ||
|
||
version=`mysql -u $DBA_USER --password=$DBA_PASS -s -N -e "select value from properties WHERE properties.key='UV.Core.version' " $DB_NAME` | ||
if [ "$version" = "001.005.000" ] | ||
then | ||
# set db schema version | ||
mysql -u $DBA_USER --password=$DBA_PASS $DB_NAME < \ | ||
/usr/share/unifiedviews/mysql/1.5.5-update.sql | ||
fi | ||
|
||
version=`mysql -u $DBA_USER --password=$DBA_PASS -s -N -e "select value from properties WHERE properties.key='UV.Core.version' " $DB_NAME` | ||
if [ "$version" = "001.005.005" ] | ||
then | ||
# set db schema version | ||
mysql -u $DBA_USER --password=$DBA_PASS $DB_NAME < \ | ||
/usr/share/unifiedviews/mysql/1.6.0-update.sql | ||
fi | ||
|
||
version=`mysql -u $DBA_USER --password=$DBA_PASS -s -N -e "select value from properties WHERE properties.key='UV.Core.version' " $DB_NAME` | ||
if [ "$version" = "001.006.000" ] | ||
then | ||
# set db schema version | ||
mysql -u $DBA_USER --password=$DBA_PASS $DB_NAME < \ | ||
/usr/share/unifiedviews/mysql/2.0.0-update.sql | ||
fi | ||
|
||
version=`mysql -u $DBA_USER --password=$DBA_PASS -s -N -e "select value from properties WHERE properties.key='UV.Core.version' " $DB_NAME` | ||
if [ "$version" = "002.000.000" ] | ||
then | ||
# set db schema version | ||
mysql -u $DBA_USER --password=$DBA_PASS $DB_NAME < \ | ||
/usr/share/unifiedviews/mysql/2.1.0-update.sql | ||
fi | ||
|
||
# set permissions for user uv | ||
echo "grant all on $DB_NAME.* to '$DBA_USER' identified by '$DBA_PASS';" | mysql --password=$ROOT_PW || true | ||
echo "granted all on $DB_NAME for user: $DBA_USER" | ||
|
||
# update backend config | ||
sed --in-place \ | ||
-e "s/database.sql.hostname = .*/database.sql.hostname = $address_host/" \ | ||
-e "s/database.sql.port = .*/database.sql.port = 3306/" \ | ||
-e "s/database.sql.user = .*/database.sql.user = $DBA_USER/" \ | ||
-e "s/database.sql.password = .*/database.sql.password = $DBA_PASS/" \ | ||
/etc/unifiedviews/backend-config.properties | ||
|
||
echo " <<< db_configure" | ||
} | ||
|
||
fix_perms() { | ||
chown unifiedviews:unifiedviews /etc/unifiedviews/backend-config.properties | ||
chown -R unifiedviews:unifiedviews /usr/share/unifiedviews/mysql | ||
} | ||
|
||
case "$1" in | ||
configure) | ||
db_creadentials | ||
fix_perms | ||
db_up | ||
set_java | ||
db_configure | ||
db_stop | ||
|
||
|
||
;; | ||
|
||
abort-upgrade|abort-remove|abort-deconfigure) | ||
;; | ||
|
||
*) | ||
echo "postinst called with unknown argument \`$1'" >&2 | ||
exit 1 | ||
|
||
;; | ||
esac | ||
|
||
|
||
# dh_installdeb will replace this with shell code automatically | ||
# generated by other debhelper scripts. | ||
|
||
#DEBHELPER# | ||
|
||
exit 0 |
Oops, something went wrong.