From 7553160928363df2ad8c71e9e35233e5e8f873b4 Mon Sep 17 00:00:00 2001
From: Andrey Gordeev <dreyou@gmail.com>
Date: Wed, 30 Jan 2013 12:25:05 +0400
Subject: [PATCH] CentOS 6.3 changes

---
 Makefile                                           |    9 +-
 backend/manager/conf/ca/encryptpasswd.sh           |    4 +-
 .../manager/conf/kerberos/engine-manage-domains    |   65 +++-
 .../dbscripts/upgrade/pre_upgrade/0000_config.sql  |    9 +-
 .../engine-config/src/main/resources/engine-config |   47 ++-
 ext/apache-mime4j-core-0.7.2.jar                   |  Bin 0 -> 95536 bytes
 ext/apache-mime4j-dom-0.7.2.jar                    |  Bin 0 -> 304810 bytes
 ext/apache-mime4j-storage-0.7.2.jar                |  Bin 0 -> 30113 bytes
 ext/commons-jxpath-1.3.jar                         |  Bin 0 -> 299994 bytes
 ext/commons-logging-1.0.4.jar                      |  Bin 0 -> 38015 bytes
 ext/istack-commons-runtime-2.4.jar                 |  Bin 0 -> 21029 bytes
 ext/jtype-0.1.2.jar                                |  Bin 0 -> 32530 bytes
 packaging/fedora/engine-service.systemv            |   26 ++
 packaging/fedora/setup/basedefs.py                 |    2 +-
 packaging/fedora/spec/ovirt-engine.spec.in         |  405 ++++++++++++--------
 pom.xml                                            |    1 +
 16 files changed, 375 insertions(+), 193 deletions(-)
 create mode 100644 ext/apache-mime4j-core-0.7.2.jar
 create mode 100644 ext/apache-mime4j-dom-0.7.2.jar
 create mode 100644 ext/apache-mime4j-storage-0.7.2.jar
 create mode 100644 ext/commons-jxpath-1.3.jar
 create mode 100644 ext/commons-logging-1.0.4.jar
 create mode 100644 ext/istack-commons-runtime-2.4.jar
 create mode 100644 ext/jtype-0.1.2.jar
 create mode 100644 packaging/fedora/engine-service.systemv

diff --git a/Makefile b/Makefile
index d294944..013a8dd 100644
--- a/Makefile
+++ b/Makefile
@@ -408,7 +408,14 @@ install_misc:
 	install -m 644 backend/manager/conf/engine.conf.defaults $(DESTDIR)$(DATA_DIR)/conf
 	install -m 755 packaging/resources/ovirtlogrot.sh ${DESTDIR}$(DATA_DIR)/scripts/
 	install -m 755 packaging/resources/ovirt-cron ${DESTDIR}$(SYSCONF_DIR)/cron.daily/
-
+	#Copy additional jars
+	install -m 644 ext/commons-jxpath-1.3.jar ${DESTDIR}$(DATA_DIR)/engine.ear/lib/
+	install -m 644 ext/commons-logging-1.0.4.jar ${DESTDIR}$(DATA_DIR)/engine.ear/lib/
+	install -m 644 ext/jtype-0.1.2.jar ${DESTDIR}$(DATA_DIR)/engine.ear/lib/
+	install -m 644 ext/apache-mime4j-core-0.7.2.jar ${DESTDIR}$(DATA_DIR)/engine.ear/lib/
+	install -m 644 ext/apache-mime4j-dom-0.7.2.jar ${DESTDIR}$(DATA_DIR)/engine.ear/lib/
+	install -m 644 ext/apache-mime4j-storage-0.7.2.jar ${DESTDIR}$(DATA_DIR)/engine.ear/lib/
+	install -m 644 ext/istack-commons-runtime-2.4.jar ${DESTDIR}$(DATA_DIR)/engine.ear/lib/
 	# USB filter:
 	install -m 644 frontend/usbfilter.txt $(DESTDIR)$(PKG_SYSCONF_DIR)
 
diff --git a/backend/manager/conf/ca/encryptpasswd.sh b/backend/manager/conf/ca/encryptpasswd.sh
index 29db117..ece2cd6 100644
--- a/backend/manager/conf/ca/encryptpasswd.sh
+++ b/backend/manager/conf/ca/encryptpasswd.sh
@@ -26,6 +26,7 @@ if [[ "x${JAVA_HOME}" != "x" ]] ;then
     JAVA_BIN=$JAVA_HOME/bin/java
 fi
 
+EAR_LIB=/usr/share/ovirt-engine/engine.ear/lib
 
 pushd  $JBOSS_HOME
 #if [ -e "common/lib/jbosssx.jar" ]; then
@@ -37,7 +38,8 @@ pushd  $JBOSS_HOME
 #        exit 1
 #fi
 
-$JAVA_BIN -cp `build-classpath jboss-logging picketbox/picketbox` org.picketbox.datasource.security.SecureIdentityLoginModule "$1"
+#$JAVA_BIN -cp `build-classpath jboss-logging picketbox/picketbox` org.picketbox.datasource.security.SecureIdentityLoginModule "$1"
+$JAVA_BIN -cp $EAR_LIB/picketbox-4.0.7.Final.jar:$EAR_LIB/jboss-logging-3.1.0.GA.jar org.picketbox.datasource.security.SecureIdentityLoginModule $1
 
 popd
 
diff --git a/backend/manager/conf/kerberos/engine-manage-domains b/backend/manager/conf/kerberos/engine-manage-domains
index 402ec2e..8c2088c 100755
--- a/backend/manager/conf/kerberos/engine-manage-domains
+++ b/backend/manager/conf/kerberos/engine-manage-domains
@@ -91,27 +91,52 @@ if [ "$1" == "--help" -o "$1" == "-h" ]; then
         exit 0
 fi
 
+#CP=\
+#$CONF_DIR:`\
+#build-classpath \
+#apache-commons-codec \
+#apache-commons-collections \
+#apache-commons-configuration \
+#apache-commons-jxpath \
+#apache-commons-lang \
+#apache-commons-logging \
+#log4j \
+#ovirt-engine/common \
+#ovirt-engine/compat \
+#ovirt-engine/engineencryptutils \
+#ovirt-engine/engine-tools-common \
+#ovirt-engine/utils \
+#postgresql-jdbc \
+#springframework/spring-beans \
+#springframework/spring-core \
+#springframework/spring-tx \
+#spring-ldap/spring-ldap-core \
+#`
+
+ENGINE_LIB=/usr/share/java/ovirt-engine
+EAR_LIB=/usr/share/ovirt-engine/engine.ear/lib
+
 CP=\
-$CONF_DIR:`\
-build-classpath \
-apache-commons-codec \
-apache-commons-collections \
-apache-commons-configuration \
-apache-commons-jxpath \
-apache-commons-lang \
-apache-commons-logging \
-log4j \
-ovirt-engine/common \
-ovirt-engine/compat \
-ovirt-engine/engineencryptutils \
-ovirt-engine/engine-tools-common \
-ovirt-engine/utils \
-postgresql-jdbc \
-springframework/spring-beans \
-springframework/spring-core \
-springframework/spring-tx \
-spring-ldap/spring-ldap-core \
-`
+$CONF_DIR:\
+$EAR_LIB/commons-codec-1.4.jar:\
+$EAR_LIB/commons-collections-3.1.jar:\
+$EAR_LIB/commons-configuration-1.6.jar:\
+$EAR_LIB/commons-jxpath-1.3.jar:\
+$EAR_LIB/commons-lang-2.6.jar:\
+$EAR_LIB/commons-logging-1.0.4.jar:\
+$EAR_LIB/log4j-1.2.16.jar:\
+$EAR_LIB/postgresql-jdbc.jar:\
+$EAR_LIB/spring-beans-3.1.1.RELEASE.jar:\
+$EAR_LIB/spring-core-3.1.1.RELEASE.jar:\
+$EAR_LIB/spring-tx-3.1.1.RELEASE.jar:\
+$EAR_LIB/spring-ldap-core-1.3.1.RELEASE.jar:\
+$ENGINE_LIB/compat.jar:\
+$ENGINE_LIB/common.jar:\
+$ENGINE_LIB/engine-config.jar:\
+$ENGINE_LIB/engineencryptutils.jar:\
+$ENGINE_LIB/engine-tools-common.jar:\
+$ENGINE_LIB/utils.jar
+
 
 for f in $(echo $CP|sed 's/:/ /g')
 do
diff --git a/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql b/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
index 147212d..48b36ab 100644
--- a/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
+++ b/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
@@ -86,8 +86,10 @@ select fn_db_add_config_value('DocsURL','docs','general');
 --Handling NetBIOS Domain Name
 select fn_db_add_config_value('DomainName','example.com','general');
 select fn_db_add_config_value('EmulatedMachine','rhel6.0.0','3.0');
-select fn_db_add_config_value('EmulatedMachine','pc-0.14','3.1');
-select fn_db_add_config_value('EmulatedMachine','pc-0.14','3.2');
+--select fn_db_add_config_value('EmulatedMachine','pc-0.14','3.1');
+--select fn_db_add_config_value('EmulatedMachine','pc-0.14','3.2');
+select fn_db_add_config_value('EmulatedMachine','pc','3.1');
+select fn_db_add_config_value('EmulatedMachine','pc','3.2');
 -- Host time drift
 select fn_db_add_config_value('EnableHostTimeDrift','false','general');
 --Handling Enable Spice Root Certification Validation
@@ -569,7 +571,8 @@ select fn_db_update_default_config_value('AdUserPassword','example.com:SamplePas
 -- Increase AsyncTaskZombieTaskLifeInMinutes to 50 hours if it's the default 5 hours.
 select fn_db_update_default_config_value('AsyncTaskZombieTaskLifeInMinutes','300','3000','general',false);
 select fn_db_update_default_config_value('DomainName','example.com','','general',false);
-select fn_db_update_default_config_value('EmulatedMachine','rhel6.0.0', 'pc-0.14','3.0',false);
+--select fn_db_update_default_config_value('EmulatedMachine','rhel6.0.0', 'pc-0.14','3.0',false);
+select fn_db_update_default_config_value('EmulatedMachine','rhel6.0.0', 'pc','3.0',false);
 select fn_db_update_default_config_value('LDAPSecurityAuthentication','GSSAPI','default:GSSAPI','general',false);
 select fn_db_update_default_config_value('LDAPSecurityAuthentication','SIMPLE','default:SIMPLE','general',false);
 select fn_db_update_default_config_value('VdsLocalDisksCriticallyLowFreeSpace','100','500','general',false);
diff --git a/backend/manager/tools/engine-config/src/main/resources/engine-config b/backend/manager/tools/engine-config/src/main/resources/engine-config
index 857e75d..c4fc6e0 100755
--- a/backend/manager/tools/engine-config/src/main/resources/engine-config
+++ b/backend/manager/tools/engine-config/src/main/resources/engine-config
@@ -89,21 +89,38 @@ if [ "$1" == "--help" -o "$1" == "-h" ]; then
         exit 0
 fi
 
-CP=`\
-build-classpath \
-apache-commons-codec \
-apache-commons-collections \
-apache-commons-configuration \
-apache-commons-jxpath \
-apache-commons-lang \
-apache-commons-logging \
-log4j \
-ovirt-engine/compat \
-ovirt-engine/engine-config \
-ovirt-engine/engineencryptutils \
-ovirt-engine/engine-tools-common \
-postgresql-jdbc \
-`
+#CP=`\
+#build-classpath \
+#apache-commons-codec \
+#apache-commons-collections \
+#apache-commons-configuration \
+#apache-commons-jxpath \
+#apache-commons-lang \
+#apache-commons-logging \
+#log4j \
+#ovirt-engine/compat \
+#ovirt-engine/engine-config \
+#ovirt-engine/engineencryptutils \
+#ovirt-engine/engine-tools-common \
+#postgresql-jdbc \
+#`
+
+ENGINE_LIB=/usr/share/java/ovirt-engine
+EAR_LIB=/usr/share/ovirt-engine/engine.ear/lib
+
+CP=\
+$EAR_LIB/commons-codec-1.4.jar:\
+$EAR_LIB/commons-collections-3.1.jar:\
+$EAR_LIB/commons-configuration-1.6.jar:\
+$EAR_LIB/commons-jxpath-1.3.jar:\
+$EAR_LIB/commons-lang-2.6.jar:\
+$EAR_LIB/commons-logging-1.0.4.jar:\
+$EAR_LIB/log4j-1.2.16.jar:\
+$EAR_LIB/postgresql-jdbc.jar:\
+$ENGINE_LIB/compat.jar:\
+$ENGINE_LIB/engine-config.jar:\
+$ENGINE_LIB/engineencryptutils.jar:\
+$ENGINE_LIB/engine-tools-common.jar
 
 # Verify all classpath elements available
 for f in $(echo $CP|sed 's/:/ /g')
diff --git a/ext/apache-mime4j-core-0.7.2.jar b/ext/apache-mime4j-core-0.7.2.jar
new file mode 100644
index 0000000000000000000000000000000000000000..b5c225b5dbd496889342baf249c332f0944f7eee
GIT binary patch
diff --git a/ext/apache-mime4j-dom-0.7.2.jar b/ext/apache-mime4j-dom-0.7.2.jar
new file mode 100644
index 0000000000000000000000000000000000000000..0cdd3ce33c0aecd2daf86cd613e045f90a3cbb30
GIT binary patch
diff --git a/ext/apache-mime4j-storage-0.7.2.jar b/ext/apache-mime4j-storage-0.7.2.jar
new file mode 100644
index 0000000000000000000000000000000000000000..ee86b9ca09b8757cb79bd660043d22de2928717d
GIT binary patch
diff --git a/ext/commons-jxpath-1.3.jar b/ext/commons-jxpath-1.3.jar
new file mode 100644
index 0000000000000000000000000000000000000000..e344a1e66d83ce608928a1e5e01dacfbc6270ab0
GIT binary patch
diff --git a/ext/commons-logging-1.0.4.jar b/ext/commons-logging-1.0.4.jar
new file mode 100644
index 0000000000000000000000000000000000000000..b73a80fab641131e6fbe3ae833549efb3c540d17
GIT binary patch
diff --git a/ext/istack-commons-runtime-2.4.jar b/ext/istack-commons-runtime-2.4.jar
new file mode 100644
index 0000000000000000000000000000000000000000..b0a99a8b7667e0dfce5c56bdf00b90a83d0546ab
GIT binary patch
diff --git a/ext/jtype-0.1.2.jar b/ext/jtype-0.1.2.jar
new file mode 100644
index 0000000000000000000000000000000000000000..b0d40ab8d002dd5adafac890dd96430ff1fca770
GIT binary patch
diff --git a/packaging/fedora/engine-service.systemv b/packaging/fedora/engine-service.systemv
new file mode 100644
index 0000000..592cb48
--- /dev/null
+++ b/packaging/fedora/engine-service.systemv
@@ -0,0 +1,26 @@
+#!/bin/bash
+#
+# Start/stop oVirt Engine
+#
+# chkconfig: - 65 34
+# description: oVirt Engine
+# pidfile: /var/run/ovirt-engine.pid
+
+# Load the sysconfig file into the environment:
+if [ -f /etc/sysconfig/ovirt-engine ]
+then
+  . /etc/sysconfig/ovirt-engine
+fi
+
+# Export the variables potentially used in the sysconfig
+# configuration file:
+export ENGINE_USER
+export ENGINE_GROUP
+export ENGINE_MIN_HEAP
+export ENGINE_MAX_HEAP
+export ENGINE_DEBUG_ADDRESS
+export ENGINE_VERBOSE_GC
+
+# The service script takes care of the rest:
+#exec /usr/share/ovirt-engine/service/engine-service.py $*
+exec /usr/bin/engine-service $*
diff --git a/packaging/fedora/setup/basedefs.py b/packaging/fedora/setup/basedefs.py
index b985f55..8d1a703 100644
--- a/packaging/fedora/setup/basedefs.py
+++ b/packaging/fedora/setup/basedefs.py
@@ -19,7 +19,7 @@ ENGINE_USER_NAME="ovirt"
 ENGINE_GROUP_NAME="ovirt"
 HTTPD_SERVICE_NAME="httpd"
 HTTP_PORT_POLICY="http_port_t"
-NFS_SERVICE_NAME="nfs-server"
+NFS_SERVICE_NAME="nfs"
 NOTIFIER_SERVICE_NAME = "engine-notifierd"
 ETL_SERVICE_NAME = "ovirt-engine-dwhd"
 FREEIPA_RPM = "freeipa-server"
diff --git a/packaging/fedora/spec/ovirt-engine.spec.in b/packaging/fedora/spec/ovirt-engine.spec.in
index a7dde21..dd0b1f4 100644
--- a/packaging/fedora/spec/ovirt-engine.spec.in
+++ b/packaging/fedora/spec/ovirt-engine.spec.in
@@ -100,43 +100,43 @@ Source0: http://ovirt.org/releases/stable/src/%{name}-%{version}.tar.gz
 BuildArch: noarch
 
 # Build time requirements:
-BuildRequires: apache-commons-beanutils
-BuildRequires: apache-commons-codec
-BuildRequires: apache-commons-collections
-BuildRequires: apache-commons-configuration
-BuildRequires: apache-commons-jxpath
-BuildRequires: apache-commons-lang
-BuildRequires: apache-commons-logging
-BuildRequires: apache-commons-compress
-BuildRequires: apache-mina
-BuildRequires: apache-sshd
+#BuildRequires: apache-commons-beanutils
+#BuildRequires: apache-commons-codec
+#BuildRequires: apache-commons-collections
+#BuildRequires: apache-commons-configuration
+#BuildRequires: apache-commons-jxpath
+#BuildRequires: apache-commons-lang
+#BuildRequires: apache-commons-logging
+#BuildRequires: apache-commons-compress
+#BuildRequires: apache-mina
+#BuildRequires: apache-sshd
 BuildRequires: bea-stax-api
 BuildRequires: dos2unix
-BuildRequires: jackson
-BuildRequires: hibernate-commons-annotations
-BuildRequires: hibernate-jpa-2.0-api
-BuildRequires: hibernate-validator
-BuildRequires: jakarta-commons-httpclient
+#BuildRequires: jackson
+#BuildRequires: hibernate-commons-annotations
+#BuildRequires: hibernate-jpa-2.0-api
+#BuildRequires: hibernate-validator
+#BuildRequires: jakarta-commons-httpclient
 BuildRequires: java-devel
 BuildRequires: javamail
 BuildRequires: javassist
-BuildRequires: jboss-annotations-1.1-api
-BuildRequires: jboss-ejb-3.1-api
-BuildRequires: jboss-logging
-BuildRequires: jboss-interceptors-1.1-api
-BuildRequires: jboss-servlet-3.0-api
-BuildRequires: jpackage-utils
-BuildRequires: jsch
-BuildRequires: log4j
+#BuildRequires: jboss-annotations-1.1-api
+#BuildRequires: jboss-ejb-3.1-api
+#BuildRequires: jboss-logging
+#BuildRequires: jboss-interceptors-1.1-api
+#BuildRequires: jboss-servlet-3.0-api
+#BuildRequires: jpackage-utils
+#BuildRequires: jsch
+#BuildRequires: log4j
 BuildRequires: make
-BuildRequires: maven
+#BuildRequires: maven
 BuildRequires: postgresql-jdbc
-BuildRequires: quartz
-BuildRequires: resteasy
-BuildRequires: springframework-instrument
-BuildRequires: springframework-jdbc
-BuildRequires: spring-ldap
-BuildRequires: xmlrpc3-client
+#BuildRequires: quartz
+#BuildRequires: resteasy
+#BuildRequires: springframework-instrument
+#BuildRequires: springframework-jdbc
+#BuildRequires: spring-ldap
+#BuildRequires: xmlrpc3-client
 BuildRequires: unzip
 BuildRequires: ovirt-host-deploy-java
 
@@ -145,17 +145,18 @@ BuildRequires: ovirt-host-deploy-java
 Requires: bea-stax-api
 Requires: bind-utils
 Requires: cracklib-python
-Requires: geronimo-validation
-Requires: hibernate-commons-annotations
-Requires: hibernate-jpa-2.0-api
-Requires: hibernate-validator
+#Requires: geronimo-validation
+#Requires: hibernate-commons-annotations
+#Requires: hibernate-jpa-2.0-api
+#Requires: hibernate-validator
 Requires: httpd
+Requires: apr
 Requires: java-1.7.0-openjdk >= 1:1.7.0.9-2.3.3.2
-Requires: jakarta-commons-httpclient
+#Requires: jakarta-commons-httpclient
 Requires: java
-Requires: jboss-interceptors-1.1-api
-Requires: jboss-logging
-Requires: jpackage-utils
+#Requires: jboss-interceptors-1.1-api
+#Requires: jboss-logging
+#Requires: jpackage-utils
 Requires: log4j
 Requires: mod_ssl
 Requires: ntp
@@ -173,7 +174,10 @@ Requires: ovirt-engine-cli
 Requires: postgresql-server >= 8.4.7
 
 # Require JBoss AS 7:
-Requires: jboss-as >= 7.1.1-9.3
+#Requires: jboss-as >= 7.1.1-9.3
+#Replacing with JbossAS 7.1.1 binary rpm
+Requires: ovirt-engine-jbossas711
+
 
 # We can't require exactly the same version and release of the
 # setup package because it needs to be updated independely as part
@@ -210,39 +214,39 @@ virtualization infrastructure for Servers and Desktops.
 Summary: Engine core of %{product_name_short}
 Group: Virtualization/Management
 Requires: %{name} = %{version}-%{release}
-Requires: apache-commons-beanutils
-Requires: apache-commons-codec
-Requires: apache-commons-collections
-Requires: apache-commons-lang
-Requires: apache-commons-compress
-Requires: apache-mina
-Requires: apache-sshd
+#Requires: apache-commons-beanutils
+#Requires: apache-commons-codec
+#Requires: apache-commons-collections
+#Requires: apache-commons-lang
+#Requires: apache-commons-compress
+#Requires: apache-mina
+#Requires: apache-sshd
 Requires: bea-stax-api
-Requires: dom4j
-Requires: geronimo-validation
-Requires: jackson
-Requires: jakarta-commons-httpclient
+#Requires: dom4j
+#Requires: geronimo-validation
+#Requires: jackson
+#Requires: jakarta-commons-httpclient
 Requires: java
 Requires: javassist
-Requires: jboss-interceptors-1.1-api
-Requires: jsch
+#Requires: jboss-interceptors-1.1-api
+#Requires: jsch
 Requires: objectweb-asm
 Requires: openssh
 Requires: openssl
-Requires: picketbox
-Requires: quartz
-Requires: slf4j
-Requires: springframework
-Requires: springframework-aop
-Requires: springframework-beans
-Requires: springframework-context
-Requires: springframework-instrument
-Requires: springframework-jdbc
-Requires: springframework-tx
-Requires: spring-ldap
-Requires: ws-commons-util
-Requires: xmlrpc3-client
-Requires: xmlrpc3-common
+#Requires: picketbox
+#Requires: quartz
+#Requires: slf4j
+#Requires: springframework
+#Requires: springframework-aop
+#Requires: springframework-beans
+#Requires: springframework-context
+#Requires: springframework-instrument
+#Requires: springframework-jdbc
+#Requires: springframework-tx
+#Requires: spring-ldap
+#Requires: ws-commons-util
+#Requires: xmlrpc3-client
+#Requires: xmlrpc3-common
 
 
 %description backend
@@ -302,13 +306,13 @@ The web administration interface to %{product_name_short}
 Summary: Common libraries for  %{product_name_short} Tools
 Group: Virtualization/Management
 Requires: %{name} = %{version}-%{release}
-Requires: apache-commons-collections
-Requires: apache-commons-logging
-Requires: apache-commons-lang
-Requires: apache-commons-codec
-Requires: apache-commons-configuration
-Requires: apache-commons-jxpath
-Requires: log4j
+#Requires: apache-commons-collections
+#Requires: apache-commons-logging
+#Requires: apache-commons-lang
+#Requires: apache-commons-codec
+#Requires: apache-commons-configuration
+#Requires: apache-commons-jxpath
+#Requires: log4j
 
 %description tools-common
 The common libraries used by %{product_name_short} Tools
@@ -405,95 +409,95 @@ done
 %endif
 
 # Remove the jar files that are not needed:
-while read lib_path
-do
-  rm -rf %{buildroot}%{engine_ear}/lib/${lib_path}*.jar
-done <<'.'
-activation
-antlr
-aopalliance
-c3p0
-ejb3-persistence
-jaxb-api
-jaxb-impl
-jboss-interceptors-api_1.1_spec
-stax-api
-xml-apis
-.
+#while read lib_path
+#do
+#  rm -rf %{buildroot}%{engine_ear}/lib/${lib_path}*.jar
+#done <<'.'
+#activation
+#antlr
+#aopalliance
+#c3p0
+#ejb3-persistence
+#jaxb-api
+#jaxb-impl
+#jboss-interceptors-api_1.1_spec
+#stax-api
+#xml-apis
+#.
 
 # Attention!
 # spring-asm *IS* required on rhel-6
-rm -rf %{buildroot}%{engine_ear}/lib/spring-asm*.jar
+#rm -rf %{buildroot}%{engine_ear}/lib/spring-asm*.jar
 
 # Then for the system jar files (using build-classpath):
-while read jar_name lib_path
-do
-  rm -rf %{buildroot}%{engine_ear}/lib/${lib_path}*.jar
-  ln -s `build-classpath ${jar_name}` %{buildroot}%{engine_ear}/lib/${lib_path}.jar
-done <<'.'
-apache-mina/mina-core mina-core
-apache-sshd/sshd-core sshd-core
-commons-beanutils commons-beanutils
-commons-codec commons-codec
-commons-collections commons-collections
-commons-httpclient commons-httpclient
-commons-lang commons-lang
-commons-compress commons-compress
-dom4j dom4j
-geronimo-validation validation-api
-hibernate/hibernate-commons-annotations hibernate-commons-annotations
-hibernate-validator hibernate-validator
-jsch jsch
-objectweb-asm/asm-all asm-all
-quartz quartz
-slf4j/api slf4j-api
-springframework/spring-aop spring-aop
-springframework/spring-beans spring-beans
-springframework/spring-context spring-context
-springframework/spring-core spring-core
-springframework/spring-expression spring-expression
-springframework/spring-instrument spring-instrument
-springframework/spring-jdbc spring-jdbc
-springframework/spring-tx spring-tx
-spring-ldap/spring-ldap-core spring-ldap-core
-ws-commons-util ws-commons-util
-xmlrpc3-client xmlrpc-client
-xmlrpc3-common xmlrpc-common
-otopi/otopi otopi
-ovirt-host-deploy/ovirt-host-deploy ovirt-host-deploy
-.
+#while read jar_name lib_path
+#do
+#  rm -rf %{buildroot}%{engine_ear}/lib/${lib_path}*.jar
+#  ln -s `build-classpath ${jar_name}` %{buildroot}%{engine_ear}/lib/${lib_path}.jar
+#done <<'.'
+#apache-mina/mina-core mina-core
+#apache-sshd/sshd-core sshd-core
+#commons-beanutils commons-beanutils
+#commons-codec commons-codec
+#commons-collections commons-collections
+#commons-httpclient commons-httpclient
+#commons-lang commons-lang
+#commons-compress commons-compress
+#dom4j dom4j
+#geronimo-validation validation-api
+#hibernate/hibernate-commons-annotations hibernate-commons-annotations
+#hibernate-validator hibernate-validator
+#jsch jsch
+#objectweb-asm/asm-all asm-all
+#quartz quartz
+#slf4j/api slf4j-api
+#springframework/spring-aop spring-aop
+#springframework/spring-beans spring-beans
+#springframework/spring-context spring-context
+#springframework/spring-core spring-core
+#springframework/spring-expression spring-expression
+#springframework/spring-instrument spring-instrument
+#springframework/spring-jdbc spring-jdbc
+#springframework/spring-tx spring-tx
+#spring-ldap/spring-ldap-core spring-ldap-core
+#ws-commons-util ws-commons-util
+#xmlrpc3-client xmlrpc-client
+#xmlrpc3-common xmlrpc-common
+#otopi/otopi otopi
+#ovirt-host-deploy/ovirt-host-deploy ovirt-host-deploy
+#.
 
 # Replace jar files in the RESTAPI web application with links to ther
 # actual locations, first for jar files from this package, as for these
 # can't use build-classpath:
-while read jar_name lib_path
-do
-  rm -rf %{buildroot}%{restapi_war}/WEB-INF/lib/${lib_path}*.jar
-  ln -s %{engine_java}/${jar_name}.jar %{buildroot}%{restapi_war}/WEB-INF/lib/${lib_path}.jar
-done <<'.'
-interface-common-jaxrs interface-common-jaxrs
-restapi-definition restapi-definition
-restapi-jaxrs restapi-jaxrs
-restapi-types restapi-types
-.
+#while read jar_name lib_path
+#do
+#  rm -rf %{buildroot}%{restapi_war}/WEB-INF/lib/${lib_path}*.jar
+#  ln -s %{engine_java}/${jar_name}.jar %{buildroot}%{restapi_war}/WEB-INF/lib/${lib_path}.jar
+#done <<'.'
+#interface-common-jaxrs interface-common-jaxrs
+#restapi-definition restapi-definition
+#restapi-jaxrs restapi-jaxrs
+#restapi-types restapi-types
+#.
 
 # Remove the jar files that are not needed:
-while read lib_path
-do
-  rm -rf %{buildroot}%{restapi_war}/WEB-INF/lib/${lib_path}*.jar
-done <<'.'
-commons-codec
-log4j
-.
+#while read lib_path
+#do
+#  rm -rf %{buildroot}%{restapi_war}/WEB-INF/lib/${lib_path}*.jar
+#done <<'.'
+#commons-codec
+#log4j
+#.
 
 # Then for the system jar files (using build-classpath):
-while read jar_name lib_path
-do
-  rm -rf %{buildroot}%{restapi_war}/WEB-INF/lib/${lib_path}*.jar
-  ln -s `build-classpath ${jar_name}` %{buildroot}%{restapi_war}/WEB-INF/lib/${lib_path}.jar
-done <<'.'
-snakeyaml snakeyaml
-.
+#while read jar_name lib_path
+#do
+#  rm -rf %{buildroot}%{restapi_war}/WEB-INF/lib/${lib_path}*.jar
+#  ln -s `build-classpath ${jar_name}` %{buildroot}%{restapi_war}/WEB-INF/lib/${lib_path}.jar
+#done <<'.'
+#snakeyaml snakeyaml
+#.
 
 # Copy the module definitions:
 install -dm 755 %{buildroot}%{engine_jboss_modules}
@@ -502,8 +506,9 @@ find %{buildroot}%{engine_jboss_modules} -type d -exec chmod 755 {} \;
 find %{buildroot}%{engine_jboss_modules} -type f -exec chmod 644 {} \;
 
 # Install the systemd files:
-install -dm 755 %{buildroot}%{_unitdir}
-install -m 644 packaging/fedora/engine-service.systemd %{buildroot}%{_unitdir}/%{engine_name}.service
+#install -dm 755 %{buildroot}%{_unitdir}
+#install -m 644 packaging/fedora/engine-service.systemd %{buildroot}%{_unitdir}/%{engine_name}.service
+install -m 755 packaging/fedora/engine-service.systemv %{buildroot}%{_initrddir}/%{engine_name}
 install -dm 755 %{buildroot}%{_sysconfdir}/tmpfiles.d
 install -m 644 packaging/resources/ovirt-tmpfilesd %{buildroot}%{_sysconfdir}/tmpfiles.d/ovirt-engine.conf
 
@@ -548,6 +553,92 @@ fi
 %pre setup
 %create_vdsm_user
 
+%post
+#Add link to engine_pki from engine config dir
+ln -f -s %{engine_pki} %{_sysconfdir}/%{engine_name}/ca
+
+#Add jars to ear from JbossAs
+ln -f -s  /usr/share/jboss-as/modules/org/apache/commons/configuration/main/commons-configuration-1.6.jar %{engine_ear}/lib/commons-configuration-1.6.jar
+ln -f -s  /usr/share/jboss-as/modules/org/apache/log4j/main/log4j-1.2.16.jar %{engine_ear}/lib/log4j-1.2.16.jar
+ln -f -s  /usr/share/jboss-as/modules/org/jboss/logging/main/jboss-logging-3.1.0.GA.jar %{engine_ear}/lib/jboss-logging-3.1.0.GA.jar
+ln -f -s  /usr/share/jboss-as/modules/org/picketbox/main/picketbox-4.0.7.Final.jar %{engine_ear}/lib/picketbox-4.0.7.Final.jar
+ln -f -s  /usr/share/java/postgresql-jdbc.jar %{engine_ear}/lib/postgresql-jdbc.jar
+
+#Make links in ovirt-engine modules
+mkdir -p %{engine_jboss_modules}/com/sun/xml/bind/main
+ln -f -s %{engine_ear}/lib/jaxb-impl-2.1.3.jar %{engine_data}/modules/com/sun/xml/bind/main/jaxb-impl.jar
+ln -f -s /usr/share/jboss-as/modules/com/sun/xml/bind/main/jaxb-xjc-2.2.4.jar %{engine_data}/modules/com/sun/xml/bind/main/jaxb-xjc.jar
+ln -f -s %{engine_ear}/lib/istack-commons-runtime-2.4.jar %{engine_jboss_modules}/com/sun/xml/bind/main/istack-commons-runtime.jar
+
+mkdir -p %{engine_data}/modules/javax/ws/rs/api/main
+ln -f -s /usr/share/jboss-as/modules/javax/ws/rs/api/main/jboss-jaxrs-api_1.1_spec-1.0.0.Final.jar %{engine_data}/modules/javax/ws/rs/api/main/jaxrs-api.jar
+
+mkdir -p %{engine_data}/modules/org/apache/commons/codec/main
+ln -f -s /usr/share/jboss-as/modules/org/apache/commons/codec/main/commons-codec-1.4.jar %{engine_data}/modules/org/apache/commons/codec/main/commons-codec.jar
+
+#!!mkdir %{engine_data}/modules/org/apache/httpcomponents/main
+#!!ln -f -s /usr/share/jboss-as/modules/org/apache/httpcomponents/main/httpclient-4.1.2.jar %{engine_data}/modules/org/apache/httpcomponents/main/httpclient.jar
+#!!ln -f -s /usr/share/jboss-as/modules/org/apache/httpcomponents/main/httpcore-4.1.4.jar %{engine_data}/modules/org/apache/httpcomponents/main/httpcore.jar
+#!!ln -f -s /usr/share/jboss-as/modules/org/apache/httpcomponents/main/httpmime-4.1.2.jar %{engine_data}/modules/org/apache/httpcomponents/main/httpmime.jar
+
+#!!mkdir %{engine_data}/modules/org/codehaus/jackson/jackson-core-asl/main
+#!!ln -f -s /usr/share/jboss-as/modules/org/codehaus/jackson/jackson-core-asl/main/jackson-core-asl-1.9.2.jar %{engine_data}/modules/org/codehaus/jackson/jackson-core-asl/main/jackson-core-asl.jar
+
+#!!mkdir %{engine_data}/modules/org/codehaus/jackson/jackson-jaxrs/main
+#!!ln -f -s /usr/share/jboss-as/modules/org/codehaus/jackson/jackson-jaxrs/main/jackson-jaxrs-1.9.2.jar %{engine_data}/modules/org/codehaus/jackson/jackson-jaxrs/main/jackson-jaxrs.jar
+
+mkdir -p %{engine_data}/modules/org/codehaus/jackson/jackson-mapper-asl/main
+ln -f -s /usr/share/jboss-as/modules/org/codehaus/jackson/jackson-mapper-asl/main/jackson-mapper-asl-1.9.2.jar %{engine_data}/modules/org/codehaus/jackson/jackson-mapper-asl/main/jackson-mapper-asl.jar
+
+#!!mkdir %{engine_data}/modules/org/codehaus/jackson/jackson-xc/main
+#!!ln -f -s /usr/share/jboss-as/modules/org/codehaus/jackson/jackson-xc/main/jackson-xc-1.9.2.jar %{engine_data}/modules/org/codehaus/jackson/jackson-xc/main/jackson-xc.jar
+mkdir -p %{engine_data}/modules/org/hibernate/validator/main
+ln -f -s /usr/share/jboss-as/modules/org/hibernate/validator/main/hibernate-validator-4.2.0.Final.jar %{engine_data}/modules/org/hibernate/validator/main/hibernate-validator.jar
+
+mkdir -p %{engine_data}/modules/org/hibernate/validator/main
+ln -f -s %{engine_ear}/lib/jtype-0.1.2.jar %{engine_data}/modules/org/hibernate/validator/main/jtype.jar
+mkdir -p %{engine_data}/modules/org/jboss/resteasy/resteasy-atom-provider/main
+ln -f -s /usr/share/jboss-as/modules/org/jboss/resteasy/resteasy-atom-provider/main/resteasy-atom-provider-2.3.2.Final.jar %{engine_data}/modules/org/jboss/resteasy/resteasy-atom-provider/main/resteasy-atom-provider.jar
+
+mkdir -p %{engine_data}/modules/org/jboss/resteasy/resteasy-cdi/main
+ln -f -s /usr/share/jboss-as/modules/org/jboss/resteasy/resteasy-cdi/main/resteasy-cdi-2.3.2.Final.jar %{engine_data}/modules/org/jboss/resteasy/resteasy-cdi/main/resteasy-cdi.jar
+
+mkdir -p %{engine_data}/modules/org/jboss/resteasy/resteasy-jackson-provider/main
+ln -f -s /usr/share/jboss-as/modules/org/jboss/resteasy/resteasy-jackson-provider/main/resteasy-jackson-provider-2.3.2.Final.jar %{engine_data}/modules/org/jboss/resteasy/resteasy-jackson-provider/main/resteasy-jackson-provider.jar
+
+mkdir -p %{engine_data}/modules/org/jboss/resteasy/resteasy-jaxb-provider/main
+ln -f -s /usr/share/jboss-as/modules/org/jboss/resteasy/resteasy-jaxb-provider/main/resteasy-jaxb-provider-2.3.2.Final.jar %{engine_data}/modules/org/jboss/resteasy/resteasy-jaxb-provider/main/resteasy-jaxb-provider.jar
+
+mkdir -p %{engine_data}/modules/org/jboss/resteasy/resteasy-jaxrs/main
+ln -f -s /usr/share/jboss-as/modules/org/jboss/resteasy/resteasy-jaxrs/main/async-http-servlet-3.0-2.3.2.Final.jar %{engine_data}/modules/org/jboss/resteasy/resteasy-jaxrs/main/async-http-servlet-3.0.jar
+
+mkdir -p %{engine_data}/modules/org/jboss/resteasy/resteasy-jaxrs/main
+ln -f -s /usr/share/jboss-as/modules/org/jboss/resteasy/resteasy-jaxrs/main/resteasy-jaxrs-2.3.2.Final.jar %{engine_data}/modules/org/jboss/resteasy/resteasy-jaxrs/main/resteasy-jaxrs.jar
+
+mkdir -p %{engine_data}/modules/org/jboss/resteasy/resteasy-jettison-provider/main
+ln -f -s /usr/share/jboss-as/modules/org/jboss/resteasy/resteasy-jettison-provider/main/resteasy-jettison-provider-2.3.2.Final.jar %{engine_data}/modules/org/jboss/resteasy/resteasy-jettison-provider/main/resteasy-jettison-provider.jar
+
+mkdir -p %{engine_data}/modules/org/jboss/resteasy/resteasy-jsapi/main
+ln -f -s /usr/share/jboss-as/modules/org/jboss/resteasy/resteasy-jsapi/main/resteasy-jsapi-2.3.2.Final.jar %{engine_data}/modules/org/jboss/resteasy/resteasy-jsapi/main/resteasy-jsapi.jar
+mkdir -p %{engine_data}/modules/org/jboss/resteasy/resteasy-multipart-provider/main
+ln -f -s /usr/share/jboss-as/modules/org/jboss/resteasy/resteasy-multipart-provider/main/resteasy-multipart-provider-2.3.2.Final.jar %{engine_data}/modules/org/jboss/resteasy/resteasy-multipart-provider/main/resteasy-multipart-provider.jar
+
+mkdir -p %{engine_data}/modules/org/jboss/resteasy/resteasy-yaml-provider/main
+ln -f -s /usr/share/jboss-as/modules/org/jboss/resteasy/resteasy-yaml-provider/main/resteasy-yaml-provider-2.3.2.Final.jar %{engine_data}/modules/org/jboss/resteasy/resteasy-yaml-provider/main/resteasy-yaml-provider.jar
+
+mkdir -p %{engine_data}/modules/org/scannotation/scannotation/main
+ln -f -s /usr/share/jboss-as/modules/org/scannotation/scannotation/main/scannotation-1.0.2.jar %{engine_data}/modules/org/scannotation/scannotation/main/scannotation.jar
+
+mkdir -p %{engine_jboss_modules}/org/apache/james/mime4j/main
+ln -f -s %{engine_ear}/lib/apache-mime4j-core-0.7.2.jar %{engine_jboss_modules}/org/apache/james/mime4j/main/core.jar
+ln -f -s %{engine_ear}/lib/apache-mime4j-dom-0.7.2.jar %{engine_jboss_modules}/org/apache/james/mime4j/main/dom.jar
+ln -f -s %{engine_ear}/lib/apache-mime4j-storage-0.7.2.jar %{engine_jboss_modules}/org/apache/james/mime4j/main/storage.jar
+
+mkdir -p  %{engine_jboss_modules}/org/yaml/snakeyaml/main
+ln -f -s /usr/share/jboss-as/modules/org/yaml/snakeyaml/main/snakeyaml-1.8.jar  %{engine_jboss_modules}/org/yaml/snakeyaml/main/snakeyaml.jar
+
+mkdir -p %{engine_jboss_modules}/org/codehaus/jettison/main
+ln -f -s /usr/share/jboss-as-7.1.1.Final/modules/org/codehaus/jettison/main/jettison-1.3.1.jar %{engine_jboss_modules}/org/codehaus/jettison/main/jettison.jar
 
 %files
 
@@ -579,7 +670,8 @@ fi
 %dir %{_sysconfdir}/sysconfig/%{engine_name}.d
 %{engine_data}/service
 %{_bindir}/engine-service
-%{_unitdir}/%{engine_name}.service
+#%{_unitdir}/%{engine_name}.service
+%{_initrddir}/%{engine_name}
 
 # Jar files used by all the components:
 %dir %{engine_java}
@@ -601,6 +693,15 @@ fi
 %{_mavenpomdir}/JPP.%{name}-utils.pom
 %endif
 
+# Additional jars
+%{engine_ear}/lib/commons-jxpath-1.3.jar
+%{engine_ear}/lib/commons-logging-1.0.4.jar
+%{engine_ear}/lib/jtype-0.1.2.jar
+%{engine_ear}/lib/apache-mime4j-core-0.7.2.jar
+%{engine_ear}/lib/apache-mime4j-dom-0.7.2.jar
+%{engine_ear}/lib/apache-mime4j-storage-0.7.2.jar
+%{engine_ear}/lib/istack-commons-runtime-2.4.jar
+
 # Documentation:
 %doc LICENSE
 
diff --git a/pom.xml b/pom.xml
index 90b1056..7d2ab0d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -366,6 +366,7 @@
               <include>**/*.java</include>
               <include>**/*.properties</include>
             </includes>
+            <encoding>UTF-8</encoding>
           </configuration>
         </plugin>
         <plugin>
-- 
1.7.1

