Juan Hernandez has uploaded a new change for review. Change subject: packaging, tools: Use JVM selected during setup (#834436) ......................................................................
packaging, tools: Use JVM selected during setup (#834436) https://bugzilla.redhat.com/834436 This patch moves the scripts of the tools and the notifier to the /usr/share/ovirt-engine/bin directory and adds there a prolog that is included by all these scripts. This prolog contains the functions that load the configuration generated by the setup tool so that the scripts will use the JVM selected during installation. Change-Id: I501e5e5cca615f5bfffef225d9ebb3204f16b7c5 Signed-off-by: Juan Hernandez <[email protected]> --- M Makefile M backend/manager/conf/kerberos/engine-manage-domains M backend/manager/tools/engine-config/src/main/resources/engine-config M backend/manager/tools/engine-notifier/engine-notifier-resources/src/main/resources/engine-notifierd M backend/manager/tools/engine-notifier/engine-notifier-resources/src/main/resources/notifier.sh A backend/manager/tools/engine-tools-common/src/main/shell/engine-prolog.sh M packaging/fedora/spec/ovirt-engine.spec.in 7 files changed, 50 insertions(+), 44 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/56/7556/1 diff --git a/Makefile b/Makefile index 678cb9c..fae9679 100644 --- a/Makefile +++ b/Makefile @@ -197,10 +197,9 @@ create_dirs: @echo "*** Creating Directories" @install -dm 755 $(DESTDIR)$(BIN_DIR) + @install -dm 755 $(DESTDIR)$(DATA_DIR)/bin @install -dm 755 $(DESTDIR)$(DATA_DIR)/conf @install -dm 755 $(DESTDIR)$(DATA_DIR)/db-backups - @install -dm 755 $(DESTDIR)$(DATA_DIR)/engine-config - @install -dm 755 $(DESTDIR)$(DATA_DIR)/engine-manage-domains @install -dm 755 $(DESTDIR)$(DATA_DIR)/ovirt-isos @install -dm 755 $(DESTDIR)$(DATA_DIR)/scripts/plugins @install -dm 755 $(DESTDIR)$(PYTHON_DIR)/sos/plugins @@ -310,16 +309,16 @@ install -m 644 backend/manager/tools/engine-config/src/main/resources/log4j.xml $(DESTDIR)$(PKG_SYSCONF_DIR)/engine-config/ # Main program for the configuration tool: - install -m 750 backend/manager/tools/engine-config/src/main/resources/engine-config $(DESTDIR)$(DATA_DIR)/engine-config/ - ln -s $(DATA_DIR)/engine-config/engine-config $(DESTDIR)$(BIN_DIR)/engine-config + install -m 750 backend/manager/tools/engine-config/src/main/resources/engine-config $(DESTDIR)$(DATA_DIR)/bin/engine-config.sh + ln -s $(DATA_DIR)/bin/engine-config.sh $(DESTDIR)$(BIN_DIR)/engine-config # Configuration files for the domain management tool: install -m 644 backend/manager/modules/utils/src/main/resources/engine-manage-domains.conf $(DESTDIR)$(PKG_SYSCONF_DIR)/engine-manage-domains/ install -m 644 backend/manager/modules/utils/src/main/resources/engine-manage-domains/log4j.xml $(DESTDIR)$(PKG_SYSCONF_DIR)/engine-manage-domains/ # Main program for the domain management tool: - install -m 750 backend/manager/conf/kerberos/engine-manage-domains $(DESTDIR)$(DATA_DIR)/engine-manage-domains/ - ln -s $(DATA_DIR)/engine-manage-domains/engine-manage-domains $(DESTDIR)$(BIN_DIR)/engine-manage-domains + install -m 750 backend/manager/conf/kerberos/engine-manage-domains $(DESTDIR)$(DATA_DIR)/bin/engine-manage-domains.sh + ln -s $(DATA_DIR)/bin/engine-manage-domains.sh $(DESTDIR)$(BIN_DIR)/engine-manage-domains install_sysprep: @echo "*** Deploying sysperp" @@ -329,7 +328,6 @@ install_notification_service: @echo "*** Deploying notification service" - install -dm 755 $(DESTDIR)$(DATA_DIR)/notifier install -dm 755 $(DESTDIR)$(PKG_SYSCONF_DIR)/notifier # Configuration files: @@ -337,7 +335,7 @@ install -m 640 backend/manager/tools/engine-notifier/engine-notifier-resources/src/main/resources/notifier.conf $(DESTDIR)$(PKG_SYSCONF_DIR)/notifier/ # Main program: - install -m 755 backend/manager/tools/engine-notifier/engine-notifier-resources/src/main/resources/notifier.sh $(DESTDIR)$(DATA_DIR)/notifier/ + install -m 755 backend/manager/tools/engine-notifier/engine-notifier-resources/src/main/resources/notifier.sh $(DESTDIR)$(DATA_DIR)/bin/engine-notifier.sh install -m 755 backend/manager/tools/engine-notifier/engine-notifier-resources/src/main/resources/engine-notifierd $(DESTDIR)$(SYSCONF_DIR)/rc.d/init.d/ install_db_scripts: diff --git a/backend/manager/conf/kerberos/engine-manage-domains b/backend/manager/conf/kerberos/engine-manage-domains index 6b757a4..b1f2b07 100755 --- a/backend/manager/conf/kerberos/engine-manage-domains +++ b/backend/manager/conf/kerberos/engine-manage-domains @@ -6,15 +6,10 @@ # should be under the /etc directory. # -die () { - printf >&2 "$@\n" - exit 1 -} +# Load the prolog: +. $(dirname $(readlink -f $0))/engine-prolog.sh -# Import configurations -PUSHDIR=`readlink -f $0` -pushd `dirname $PUSHDIR` > /dev/null -CONF_DIR=/etc/ovirt-engine/engine-manage-domains +CONF_DIR=${ENGINE_ETC}/engine-manage-domains CONF_FILE=$CONF_DIR/engine-manage-domains.conf found=0 @@ -138,7 +133,7 @@ LDAPProviderTypes EOF -java -cp .:$CP org.ovirt.engine.core.utils.kerberos.ManageDomains "$@" -propertiesFile=$PROPERTIES_FILE +${JAVA_HOME}/bin/java -cp .:$CP org.ovirt.engine.core.utils.kerberos.ManageDomains "$@" -propertiesFile=$PROPERTIES_FILE RET_VAL=$? 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 6b65395..6341e28 100755 --- a/backend/manager/tools/engine-config/src/main/resources/engine-config +++ b/backend/manager/tools/engine-config/src/main/resources/engine-config @@ -6,10 +6,8 @@ # should be under the /etc directory. # -die () { - printf >&2 "$@" - exit 1 -} +# Load the prolog: +. $(dirname $(readlink -f $0))/engine-prolog.sh usage () { printf "engine-config: get/set/list configuration\n" @@ -46,12 +44,8 @@ return 0 } -# Import configurations -PUSHDIR=`readlink -f $0` -pushd `dirname $PUSHDIR` > /dev/null - # Support alternate configuration file -CONF_FILE=/etc/ovirt-engine/engine-config/engine-config.conf +CONF_FILE=${ENGINE_ETC}/engine-config/engine-config.conf found=0 for ((i=1; i<=$# && ! found; i++)) @@ -120,6 +114,4 @@ done # Run! -java -cp .:$CP -Dlog4j.configuration=file:/etc/ovirt-engine/engine-config/log4j.xml org.ovirt.engine.core.config.EngineConfig "$@" - -exit $? +exec ${JAVA_HOME}/bin/java -cp .:$CP -Dlog4j.configuration=file:${ENGINE_ETC}/engine-config/log4j.xml org.ovirt.engine.core.config.EngineConfig "$@" diff --git a/backend/manager/tools/engine-notifier/engine-notifier-resources/src/main/resources/engine-notifierd b/backend/manager/tools/engine-notifier/engine-notifier-resources/src/main/resources/engine-notifierd index 91a5337..e8f20e3 100755 --- a/backend/manager/tools/engine-notifier/engine-notifier-resources/src/main/resources/engine-notifierd +++ b/backend/manager/tools/engine-notifier/engine-notifier-resources/src/main/resources/engine-notifierd @@ -21,7 +21,7 @@ export JAVA_HOME # Path to the engine-notifier launch script -NOTIFIER_SCRIPT=/usr/share/ovirt-engine/notifier/notifier.sh +NOTIFIER_SCRIPT=/usr/share/ovirt-engine/bin/engine-notifier.sh if [ -z "$SHUTDOWN_WAIT" ]; then SHUTDOWN_WAIT=10 diff --git a/backend/manager/tools/engine-notifier/engine-notifier-resources/src/main/resources/notifier.sh b/backend/manager/tools/engine-notifier/engine-notifier-resources/src/main/resources/notifier.sh index b2c1126..fef9749 100755 --- a/backend/manager/tools/engine-notifier/engine-notifier-resources/src/main/resources/notifier.sh +++ b/backend/manager/tools/engine-notifier/engine-notifier-resources/src/main/resources/notifier.sh @@ -5,10 +5,9 @@ # files can be found under /usr/share/java. The service's configuration # should be under the /etc directory by default. # -die () { - printf >&2 "$1" - exit $2 -} + +# Load the prolog: +. $(dirname $(readlink -f $0))/engine-prolog.sh usage () { printf "engine-notifier: oVirt Event Notification Service\n" @@ -22,7 +21,7 @@ die "Error: $1 if defined can not be empty, please check for this in configuration file $CONF_FILE\n" 6 } -NOTIFIER_HOME=/usr/share/ovirt-engine/notifier/ +NOTIFIER_HOME=${ENGINE_USR}/notifier/ if [ ! -d "$NOTIFIER_HOME" ]; then die "Error: daemon home directory is missing or not accessible: $NOTIFIER_HOME.\n" 5 fi @@ -45,7 +44,7 @@ fi CONF_FILE="$1" else - CONF_FILE=/etc/ovirt-engine/notifier/notifier.conf + CONF_FILE=${ENGINE_ETC}/notifier/notifier.conf fi # Import configurations @@ -187,7 +186,7 @@ # Add the configuration directory to the classpath so that configuration # files can be loaded as resources: -CP=/etc/ovirt-engine/notifier/. +CP=${ENGINE_ETC}/notifier/. # Add the required jar files from the system wide jars directory: jar_names=' @@ -247,6 +246,6 @@ NOTIFIER_PID=/dev/null fi -exec java -cp .:$CP $JAVA_OPTS org.ovirt.engine.core.notifier.Notifier $CONF_FILE 2>/dev/null & +${JAVA_HOME}/bin/java -cp .:$CP $JAVA_OPTS org.ovirt.engine.core.notifier.Notifier $CONF_FILE 2>/dev/null & echo $! >$NOTIFIER_PID diff --git a/backend/manager/tools/engine-tools-common/src/main/shell/engine-prolog.sh b/backend/manager/tools/engine-tools-common/src/main/shell/engine-prolog.sh new file mode 100644 index 0000000..d92b312 --- /dev/null +++ b/backend/manager/tools/engine-tools-common/src/main/shell/engine-prolog.sh @@ -0,0 +1,21 @@ +# Print an error message to stderr and exit with an error code: +die() { + printf >&2 "$@\n" + exit 1 +} + +# Load the local configuration: +load_config() { + local engine_defaults="${ENGINE_DEFAULTS:=/usr/share/ovirt-engine/conf/engine.conf.defaults}" + if [ -r "${engine_defaults}" ]; then + . "${engine_defaults}" + fi + local engine_vars=${ENGINE_VARS:=/etc/sysconfig/ovirt-engine} + if [ -r "${engine_vars}" ]; then + . "${engine_vars}" + fi +} + +# In addition to defining the functions we also perform some tasks that +# any script will need: +load_config diff --git a/packaging/fedora/spec/ovirt-engine.spec.in b/packaging/fedora/spec/ovirt-engine.spec.in index 967559d..d8b76eb 100644 --- a/packaging/fedora/spec/ovirt-engine.spec.in +++ b/packaging/fedora/spec/ovirt-engine.spec.in @@ -657,6 +657,9 @@ %files backend +# Directory for binaries and scripts: +%dir %{engine_data}/bin + # Jar files: %{engine_java}/bll.jar %{engine_java}/dal.jar @@ -823,13 +826,11 @@ %files config -# Links to the main scripts: +# Scripts and links: %{_bindir}/engine-config %{_bindir}/engine-manage-domains - -# Scripts: -%{engine_data}/engine-config -%{engine_data}/engine-manage-domains +%{engine_data}/bin/engine-config.sh +%{engine_data}/bin/engine-manage-domains.sh # Configuration files for the configuration tool: %dir %{engine_etc}/engine-config @@ -846,7 +847,7 @@ %files notification-service # Startup scripts: -%{_datadir}/%{engine_name}/notifier +%{engine_data}/bin/engine-notifier.sh %{_initddir}/engine-notifierd # Log and state directories must be owned by ovirt because the notifier service -- To view, visit http://gerrit.ovirt.org/7556 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I501e5e5cca615f5bfffef225d9ebb3204f16b7c5 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Juan Hernandez <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
