Browse Source

HPCC-15142 Minimal changes needed for DESTDIR

Workflow:
export DESTDIR=$HOME/testdir
cmake -DRUNTIME_USER=$USER ../HPCC-Platform/
make install
make configure
$DESTDIR/etc/init.d/hpcc-init start

Signed-off-by: Michael Gardner <michael.gardner@lexisnexis.com>
Michael Gardner 9 years ago
parent
commit
2ae8bdcd44
40 changed files with 205 additions and 157 deletions
  1. 13 0
      CMakeLists.txt
  2. 2 2
      cmake_modules/commonSetup.cmake
  3. 10 7
      cmake_modules/optionDefaults.cmake
  4. 21 0
      cmake_uninstall.cmake.in
  5. 0 5
      deployment/deploy/CMakeLists.txt
  6. 0 1
      deployment/deploy/configesp.install
  7. 0 1
      deployment/deploy/configesp.uninstall
  8. 1 3
      esp/platform/CMakeLists.txt
  9. 1 0
      initfiles/bash-vars.in
  10. 11 8
      initfiles/bash/etc/init.d/CMakeLists.txt
  11. 3 3
      initfiles/bash/etc/init.d/dafilesrv.service
  12. 3 3
      initfiles/bash/etc/init.d/dafilesrv@.service
  13. 6 6
      initfiles/bash/etc/init.d/hpcc-init.in
  14. 0 1
      initfiles/bash/etc/init.d/hpcc-init.install
  15. 3 3
      initfiles/bash/etc/init.d/hpcc-init.service
  16. 0 2
      initfiles/bash/etc/init.d/hpcc-init.uninstall
  17. 3 3
      initfiles/bash/etc/init.d/hpcc-init@.service
  18. 10 9
      initfiles/bash/etc/init.d/hpcc_common.in
  19. 0 1
      initfiles/bash/etc/init.d/install-init.in
  20. 10 10
      initfiles/bin/CMakeLists.txt
  21. 7 7
      initfiles/bin/init_configesp
  22. 3 4
      initfiles/bin/init_dafilesrv.in
  23. 5 4
      initfiles/bin/init_dali
  24. 5 4
      initfiles/bin/init_dfuserver
  25. 3 4
      initfiles/bin/init_eclagent.in
  26. 5 4
      initfiles/bin/init_eclccserver
  27. 5 4
      initfiles/bin/init_eclscheduler
  28. 5 4
      initfiles/bin/init_esp
  29. 5 4
      initfiles/bin/init_roxie
  30. 5 5
      initfiles/bin/init_sasha
  31. 10 10
      initfiles/bin/init_thor
  32. 12 6
      initfiles/bin/init_thorslave
  33. 2 2
      initfiles/componentfiles/launcher/CMakeLists.txt
  34. 15 6
      initfiles/etc/DIR_NAME/CMakeLists.txt
  35. 4 2
      initfiles/etc/DIR_NAME/configmgr/CMakeLists.txt
  36. 1 1
      initfiles/etc/DIR_NAME/configmgr/esp.xml.in
  37. 11 11
      initfiles/etc/DIR_NAME/environment.xml.in
  38. 1 1
      initfiles/etc/bash_completion/CMakeLists.txt
  39. 2 4
      initfiles/sbin/configmgr.in
  40. 2 2
      initfiles/sbin/hpcc-run.sh.in

+ 13 - 0
CMakeLists.txt

@@ -447,4 +447,17 @@ if(PLATFORM OR CLIENTTOOLS OR REMBED)
     install(FILES ${HPCC_SOURCE_DIR}/${LICENSE_FILE} DESTINATION "." COMPONENT Runtime)
 endif()
 
+#uninstall target
+configure_file(
+    "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
+    "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
+    IMMEDIATE @ONLY)
+add_custom_target(uninstall
+    COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
+
+if ( "$ENV{DESTDIR}" STRGREATER "" )
+  message(WARNING "DESTDIR is set to $ENV{DESTDIR}.
+This should only be done for development builds.")
+endif()
+
 include(CPack)

+ 2 - 2
cmake_modules/commonSetup.cmake

@@ -888,11 +888,11 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
   endif ( PLATFORM OR PLUGIN )
   set (CMAKE_SKIP_BUILD_RPATH  FALSE)
   set (CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
-  set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_DIR}")
+  set (CMAKE_INSTALL_RPATH "${INSTALL_DIR}/${LIB_DIR}")
   set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
   if (APPLE)
     # used to locate libraries when compiling ECL
-    set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${LIB_DIR}")
+    set(CMAKE_INSTALL_NAME_DIR "${INSTALL_DIR}/${LIB_DIR}")
   endif()
   MACRO (FETCH_GIT_TAG workdir edition result)
       execute_process(COMMAND "${GIT_COMMAND}" describe --tags --dirty --abbrev=6 --match ${edition}*

+ 10 - 7
cmake_modules/optionDefaults.cmake

@@ -78,7 +78,7 @@ if ( NOT RUNTIME_USER )
 endif()
 
 if ( NOT RUNTIME_GROUP )
-    set( RUNTIME_GROUP "hpcc" )
+    set( RUNTIME_GROUP "${RUNTIME_USER}" )
 endif()
 
 if ( NOT ENV_XML_FILE )
@@ -89,15 +89,18 @@ if ( NOT ENV_CONF_FILE )
     set( ENV_CONF_FILE "environment.conf" )
 endif()
 
-set( INSTALL_DIR "${PREFIX}/${DIR_NAME}" )
-set( CONFIG_DIR "${CONFIG_PREFIX}/${DIR_NAME}" )
-set( RUNTIME_PATH "${EXEC_PREFIX}/${RUNTIME_DIR}/${DIR_NAME}" )
-set( LOG_PATH "${EXEC_PREFIX}/${LOG_DIR}/${DIR_NAME}" )
-set( LOCK_PATH "${EXEC_PREFIX}/${LOCK_DIR}/${DIR_NAME}" )
-set( PID_PATH "${EXEC_PREFIX}/${PID_DIR}/${DIR_NAME}" )
+set( INSTALL_DIR "$ENV{DESTDIR}${PREFIX}/${DIR_NAME}" )
+set( CONFIG_DIR "$ENV{DESTDIR}${CONFIG_PREFIX}/${DIR_NAME}" )
+set( RUNTIME_PATH "$ENV{DESTDIR}${EXEC_PREFIX}/${RUNTIME_DIR}/${DIR_NAME}" )
+set( LOG_PATH "$ENV{DESTDIR}${EXEC_PREFIX}/${LOG_DIR}/${DIR_NAME}" )
+set( LOCK_PATH "$ENV{DESTDIR}${EXEC_PREFIX}/${LOCK_DIR}/${DIR_NAME}" )
+set( PID_PATH "$ENV{DESTDIR}${EXEC_PREFIX}/${PID_DIR}/${DIR_NAME}" )
+set( INIT_PATH "$ENV{DESTDIR}${CONFIG_PREFIX}/init.d")
+
 set( CONFIG_SOURCE_PATH "${CONFIG_DIR}/${CONFIG_SOURCE_DIR}" )
 set( COMPONENTFILES_PATH "${INSTALL_DIR}/${COMPONENTFILES_DIR}" )
 set( PLUGINS_PATH "${INSTALL_DIR}/${PLUGINS_DIR}" )
 set( LIB_PATH "${INSTALL_DIR}/${LIB_DIR}" )
 set( EXEC_PATH "${INSTALL_DIR}/${EXEC_DIR}" )
 set( ADMIN_PATH "${INSTALL_DIR}/${ADMIN_DIR}" )
+

+ 21 - 0
cmake_uninstall.cmake.in

@@ -0,0 +1,21 @@
+if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
+  message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+endif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
+
+file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
+string(REGEX REPLACE "\n" ";" files "${files}")
+foreach(file ${files})
+  message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
+  if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+    exec_program(
+      "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+      OUTPUT_VARIABLE rm_out
+      RETURN_VALUE rm_retval
+      )
+    if(NOT "${rm_retval}" STREQUAL 0)
+      message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
+    endif(NOT "${rm_retval}" STREQUAL 0)
+  else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+    message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
+  endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+endforeach(file)

+ 0 - 5
deployment/deploy/CMakeLists.txt

@@ -70,8 +70,3 @@ IF (USE_OPENSSL)
     	securesocket
     )
 ENDIF()
-
-if ( PLATFORM )
-    install ( PROGRAMS configesp.install DESTINATION etc/init.d/install COMPONENT Runtime )
-    install ( PROGRAMS configesp.uninstall DESTINATION etc/init.d/uninstall COMPONENT Runtime )
-endif()

+ 0 - 1
deployment/deploy/configesp.install

@@ -1 +0,0 @@
-installFile "$binPath/esp" "$binPath/configesp" 1 || exit 1

+ 0 - 1
deployment/deploy/configesp.uninstall

@@ -1 +0,0 @@
-removeSymlink "$binPath/configesp"

+ 1 - 3
esp/platform/CMakeLists.txt

@@ -60,6 +60,4 @@ target_link_libraries ( esp
          remote 
          dalibase 
          environment 
-    )
-
-
+    ) 

+ 1 - 0
initfiles/bash-vars.in

@@ -5,3 +5,4 @@ ENV_CONF_FILE=${ENV_CONF_FILE}
 PID_DIR=${PID_PATH}
 LOCK_DIR=${LOCK_PATH}
 LOG_DIR=${LOG_PATH}
+INIT_PATH=${INIT_PATH}

+ 11 - 8
initfiles/bash/etc/init.d/CMakeLists.txt

@@ -22,6 +22,11 @@ GENERATE_BASH(processor ${bash-vars} "hpcc-init.in" outFiles)
 GENERATE_BASH(processor ${bash-vars} "hpcc_common.in" outFiles)
 GENERATE_BASH(processor ${bash-vars} "uninstall-init.in" outFiles)
 
+configure_file(hpcc-init.service.in hpcc-init.service @ONLY)
+configure_file(hpcc-init@.service.in hpcc-init@.service @ONLY)
+configure_file(dafilesrv.service.in dafilesrv.service @ONLY)
+configure_file(dafilesrv@.service.in dafilesrv@.service @ONLY)
+
 ADD_CUSTOM_TARGET(ProcessFiles-initfiles-bash-etc-init.d ALL DEPENDS ${outFiles})
 FOREACH( oFILES
     ${outFiles}
@@ -29,15 +34,13 @@ FOREACH( oFILES
     ${CMAKE_CURRENT_SOURCE_DIR}/lock.sh
     ${CMAKE_CURRENT_SOURCE_DIR}/init-functions
     ${CMAKE_CURRENT_SOURCE_DIR}/export-path
-    ${CMAKE_CURRENT_SOURCE_DIR}/hpcc-init.service
-    ${CMAKE_CURRENT_SOURCE_DIR}/hpcc-init@.service
-    ${CMAKE_CURRENT_SOURCE_DIR}/dafilesrv.service
-    ${CMAKE_CURRENT_SOURCE_DIR}/dafilesrv@.service
+    ${CMAKE_CURRENT_BINARY_DIR}/hpcc-init.service
+    ${CMAKE_CURRENT_BINARY_DIR}/hpcc-init@.service
+    ${CMAKE_CURRENT_BINARY_DIR}/dafilesrv.service
+    ${CMAKE_CURRENT_BINARY_DIR}/dafilesrv@.service
 )
     install ( PROGRAMS ${oFILES} DESTINATION etc/init.d COMPONENT Runtime )
 ENDFOREACH ( oFILES )
 
-if ( PLATFORM )
-    install ( PROGRAMS hpcc-init.install DESTINATION etc/init.d/install COMPONENT Runtime )
-    install ( PROGRAMS hpcc-init.uninstall DESTINATION etc/init.d/uninstall COMPONENT Runtime )
-endif()
+install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/dafilesrv ${CMAKE_CURRENT_BINARY_DIR}/hpcc-init
+    DESTINATION ${CONFIG_PREFIX}/init.d COMPONENT Runtime)

+ 3 - 3
initfiles/bash/etc/init.d/dafilesrv.service

@@ -3,15 +3,15 @@
 # Start/stop HPCC: sudo service dafilesrv <start|stop|restart>
 #                  or sudo systemctl <start|stop|restart> dafilesrv
 # Query status: journal -u dafilesrv -t dafilesrv -f  (CRL-C to return)
-# Alternatively user can directly invoke /etc/init.d/dafilesrv <start|stop|status>
+# Alternatively user can directly invoke @INIT_PATH@/dafilesrv <start|stop|status>
 
 [Unit]
 Description=HPCC Systems® dafilesrv service
 
 [Service]
 Type=oneshot
-ExecStart=/etc/init.d/dafilesrv start
-ExecStop=/etc/init.d/dafilesrv stop
+ExecStart=@INIT_PATH@/dafilesrv start
+ExecStop=@INIT_PATH@/dafilesrv stop
 RemainAfterExit=yes
 #StandardOutput=tty
 #StandardError=tty

+ 3 - 3
initfiles/bash/etc/init.d/dafilesrv@.service

@@ -5,15 +5,15 @@
 #           sudo systemctl <start|stop|restart> dafilesrv@<terminal file name without /dev>.service
 #           For example sudo service dafilesrv@pts/1 start
 # Query status: journal -u dafilesrv -t dafilesrv -f  (To return: CRL-C)
-# Alternatively user can directly invoke /etc/init.d/dafilesrv <start|stop|status>
+# Alternatively user can directly invoke @INIT_PATH@/dafilesrv <start|stop|status>
 
 [Unit]
 Description=HPCC Systems® dafilesrv service
 
 [Service]
 Type=oneshot
-ExecStart=/etc/init.d/dafilesrv start
-ExecStop=/etc/init.d/dafilesrv stop
+ExecStart=@INIT_PATH@/dafilesrv start
+ExecStop=@INIT_PATH@/dafilesrv stop
 RemainAfterExit=yes
 StandardOutput=tty
 StandardError=tty

+ 6 - 6
initfiles/bash/etc/init.d/hpcc-init.in

@@ -331,18 +331,18 @@ unset IFS
 if [ ! -z "${compDafilesrv}" ];then
     case "$1" in
         start)
-            /etc/init.d/dafilesrv status 1>/dev/null 2>/dev/null
+            ${INIT_PATH}/dafilesrv status 1>/dev/null 2>/dev/null
             if [ $? -ne 0 ];then
               log "--------------------------"
               log "${compDafilesrv} ---> ${cmd}"
-              /etc/init.d/dafilesrv $1 2>/dev/null
+              ${INIT_PATH}/dafilesrv $1 2>/dev/null
             else
               log  "Dependent service dafilesrv, ${compDafilesrv} is already running."
               echo "Dependent service dafilesrv, ${compDafilesrv} is already running."
             fi
             ;;
         status|setup)
-            /etc/init.d/dafilesrv ${1} 2>/dev/null
+            ${INIT_PATH}/dafilesrv ${1} 2>/dev/null
             ;;
         stop|restart)
             ;;
@@ -387,11 +387,11 @@ if [ ${cmd} = "restart" ] && [ "${isComp}" -eq 0 ]; then
     echo "Starting the entire System"
     echo "***************************************************"
     cmd=start
-    /etc/init.d/dafilesrv status 1>/dev/null 2>/dev/null
+    ${INIT_PATH}/dafilesrv status 1>/dev/null 2>/dev/null
     if [ $? -ne 0 ];then
         log "--------------------------"
         log "${compDafilesrv} ---> ${cmd}"
-        /etc/init.d/dafilesrv $1 2>/dev/null
+        ${INIT_PATH}/dafilesrv $1 2>/dev/null
     fi
 
     statForStart=0
@@ -450,7 +450,7 @@ done
 
 if [ "$cmd" = "stop" ] && [ -n "$compDafilesrv" ]
 then
-    /etc/init.d/dafilesrv status 1>/dev/null 2>/dev/null
+    ${INIT_PATH}/dafilesrv status 1>/dev/null 2>/dev/null
     if [ $? -ne 0 ];then
       log  "Service dafilesrv, ${compDafilesrv} is already stopped."
       echo "Service dafilesrv, ${compDafilesrv} is already stopped."

+ 0 - 1
initfiles/bash/etc/init.d/hpcc-init.install

@@ -1 +0,0 @@
-installFile "$initPath/hpcc-init" "/etc/init.d/hpcc-init" 1 || exit 1

+ 3 - 3
initfiles/bash/etc/init.d/hpcc-init.service

@@ -3,15 +3,15 @@
 # Start/stop HPCC: sudo service hpcc-init <start|stop|restart>
 #                  or sudo systemctl <start|stop|restart> hpcc-init
 # Query status: journal -u hpcc-init -t hpcc-init -f  (CRL-C to return)
-# Alternatively user can directly invoke /etc/init.d/hpcc-init <start|stop|status>
+# Alternatively user can directly invoke @INIT_PATH@/hpcc-init <start|stop|status>
 
 [Unit]
 Description=HPCC Systems®
 
 [Service]
 Type=oneshot
-ExecStart=/etc/init.d/hpcc-init start
-ExecStop=/etc/init.d/hpcc-init stop
+ExecStart=@INIT_PATH@/hpcc-init start
+ExecStop=@INIT_PATH@/hpcc-init stop
 RemainAfterExit=yes
 #StandardOutput=tty
 #StandardError=tty

+ 0 - 2
initfiles/bash/etc/init.d/hpcc-init.uninstall

@@ -1,2 +0,0 @@
-removeSymlink "/etc/init.d/hpcc-init"
-removeSymlink "/etc/init.d/dafilesrv"

+ 3 - 3
initfiles/bash/etc/init.d/hpcc-init@.service

@@ -5,15 +5,15 @@
 #           sudo systemctl <start|stop|restart> hpcc-init@<terminal file name without /dev>.service
 #           For example sudo service hpcc-init@pts/1 start
 # Query status: journal -u hpcc-init -t hpcc-init -f  (To return: CRL-C)
-# Alternatively user can directly invoke /etc/init.d/hpcc-init <start|stop|status>
+# Alternatively user can directly invoke @INIT_PATH@/hpcc-init <start|stop|status>
 
 [Unit]
 Description=HPCC Systems®
 
 [Service]
 Type=oneshot
-ExecStart=/etc/init.d/hpcc-init start
-ExecStop=/etc/init.d/hpcc-init stop
+ExecStart=@INIT_PATH@/hpcc-init start
+ExecStop=@INIT_PATH@/hpcc-init stop
 RemainAfterExit=yes
 StandardOutput=tty
 StandardError=tty

+ 10 - 9
initfiles/bash/etc/init.d/hpcc_common.in

@@ -391,12 +391,12 @@ cleanupRuntimeEnvironment() {
 
 
 start_dafilesrv() {
-   /etc/init.d/dafilesrv status 1>/dev/null 2>/dev/null
+   ${INIT_PATH}/dafilesrv status 1>/dev/null 2>/dev/null
    if [ $? -ne 0 ];then
       #Dafilesrv is not running so start it , before starting cleanup the lock and pid file.
       cleanupRuntimeEnvironment
       noStatusCheck=1
-      /etc/init.d/dafilesrv setup 1>/dev/null 2>/dev/null
+      ${INIT_PATH}/dafilesrv setup 1>/dev/null 2>/dev/null
       startCmd ${compName} ${noStatusCheck}
       return $?
    else
@@ -483,7 +483,7 @@ startCmd() {
             limits[i]=$_temp
         fi
         flag="-${element:5:1}"
-        ulimit $flag ${limits[i]##*"="}
+        ulimit $flag ${limits[i]##*"="} 1>/dev/null 2>&1
         i=$((i+1))
     done
 
@@ -628,15 +628,15 @@ start_component() {
 
 restart_component() {
     if strstr "${compType}" "dafilesrv" ;then
-      /etc/init.d/dafilesrv status 1>/dev/null 2>/dev/null
+      ${INIT_PATH}/dafilesrv status 1>/dev/null 2>/dev/null
       if [ $? -eq 0 ];then
-        /etc/init.d/dafilesrv stop 2>/dev/null
+        ${INIT_PATH}/dafilesrv stop 2>/dev/null
       else
         log  "$compName ---> Stopped.  Now Starting ..."
         echo "Component $compName was not running. Will start it now for you ..."
         cleanupRuntimeEnvironment
       fi
-      /etc/init.d/dafilesrv start 2>/dev/null
+      ${INIT_PATH}/dafilesrv start 2>/dev/null
     else
       check_status ${PIDPATH} ${LOCKPATH} ${COMPPIDPATH} 1
       RCRESTART=$?
@@ -965,12 +965,13 @@ cluster_tools_init() {
 
    set_environmentvars
 
-   _cmd_prefix=
-   [ "$(id -u)" != "0" ] && _cmd_prefix=sudo
+   #_cmd_prefix=
+   #[ "$(id -u)" != "0" ] && _cmd_prefix=sudo
 
    # Check and set log directory
    CLUSTER_LOG_DIR=${LOG_DIR}/cluster
-   [ ! -d $LOG_DIR ]  && ${_cmd_prefix} /etc/init.d/hpcc-init status > /dev/null 2>&1
+   #[ ! -d $LOG_DIR ]  && ${_cmd_prefix} ${INIT_PATH}/hpcc-init status > /dev/null 2>&1
+   [ ! -d $LOG_DIR ]  && ${INIT_PATH}/hpcc-init status > /dev/null 2>&1
 
    [ ! -d $CLUSTER_LOG_DIR ] && mkdir -p $CLUSTER_LOG_DIR
    # workaround inconsistency of stat command

+ 0 - 1
initfiles/bash/etc/init.d/install-init.in

@@ -188,7 +188,6 @@ installConfs "environment.xml" $configs/  1 || exit 1
 installConfs "genenvrules.conf" $configs/ 1 || exit 1
 
 installFile "$path${CONFIG_DIR}/version" "${CONFIG_DIR}/version" 1 || exit 1
-installFile "$initPath/dafilesrv" "/etc/init.d/dafilesrv" 1 || exit 1
 installFile "$binPath/dfuplus" "/usr/bin/dfuplus" 1 || exit 1
 installFile "$binPath/ecl" "/usr/bin/ecl" 1 || exit 1
 installFile "$binPath/eclcc" "/usr/bin/eclcc" 1 || exit 1

+ 10 - 10
initfiles/bin/CMakeLists.txt

@@ -17,22 +17,22 @@
 SET(outFiles)
 GENERATE_BASH(processor ${bash-vars} "init_dafilesrv.in" outFiles)
 GENERATE_BASH(processor ${bash-vars} "init_eclagent.in" outFiles)
+GENERATE_BASH(processor ${bash-vars} "init_dali.in" outFiles)
+GENERATE_BASH(processor ${bash-vars} "init_thor.in" outFiles)
+GENERATE_BASH(processor ${bash-vars} "init_configesp.in" outFiles)
+GENERATE_BASH(processor ${bash-vars} "init_dfuserver.in" outFiles)
+GENERATE_BASH(processor ${bash-vars} "init_eclccserver.in" outFiles)
+GENERATE_BASH(processor ${bash-vars} "init_eclscheduler.in" outFiles)
+GENERATE_BASH(processor ${bash-vars} "init_esp.in" outFiles)
+GENERATE_BASH(processor ${bash-vars} "init_roxie.in" outFiles)
+GENERATE_BASH(processor ${bash-vars} "init_sasha.in" outFiles)
+GENERATE_BASH(processor ${bash-vars} "init_thorslave.in" outFiles)
 ADD_CUSTOM_TARGET(ProcessFiles-initfiles-bin ALL DEPENDS ${outFiles})
 
 FOREACH( iFILES
     ${outFiles}
-    ${CMAKE_CURRENT_SOURCE_DIR}/init_configesp
-    ${CMAKE_CURRENT_SOURCE_DIR}/init_dali
-    ${CMAKE_CURRENT_SOURCE_DIR}/init_dfuserver
-    ${CMAKE_CURRENT_SOURCE_DIR}/init_eclccserver
-    ${CMAKE_CURRENT_SOURCE_DIR}/init_eclscheduler
-    ${CMAKE_CURRENT_SOURCE_DIR}/init_esp
     ${CMAKE_CURRENT_SOURCE_DIR}/init_ftslave
-    ${CMAKE_CURRENT_SOURCE_DIR}/init_roxie
     ${CMAKE_CURRENT_SOURCE_DIR}/init_roxie_cluster
-    ${CMAKE_CURRENT_SOURCE_DIR}/init_sasha
-    ${CMAKE_CURRENT_SOURCE_DIR}/init_thor
-    ${CMAKE_CURRENT_SOURCE_DIR}/init_thorslave
 )
     install ( PROGRAMS ${iFILES} DESTINATION ${EXEC_DIR} COMPONENT Runtime )
 ENDFOREACH ( iFILES )

+ 7 - 7
initfiles/bin/init_configesp

@@ -15,10 +15,10 @@
 #    limitations under the License.
 ################################################################################
 
+###<REPLACE>###
 
-PATH_PRE=$(type -path hpcc_setenv)
-source ${PATH_PRE}
-PID_NAME="$PID/$(basename $PWD).pid"
+source ${INSTALL_DIR}/sbin/hpcc_setenv
+PID_NAME="${PID_DIR}/$(basename $PWD).pid"
 source ${INSTALL_DIR}/etc/init.d/hpcc_common
 
 component=$(basename $PWD)
@@ -31,19 +31,19 @@ rm -f ${SENTINEL}
 killed()
 {
     log "attempting to kill $component"
-    kill_process ${PID_NAME} configesp 3 ${SENTINEL}
+    kill_process ${PID_NAME} esp 3 ${SENTINEL}
     if [[ $? -eq 1 ]]; then
         log "could not kill $component"
     else
         log "Stopped $component"
-        unlock /var/lock/HPCCSystems/$component/${component}.lock
+        unlock ${LOCK_DIR}/$component/${component}.lock
     fi
     exit 255
 }
 
 trap "killed" SIGINT SIGTERM SIGKILL
 log "calling configesp 1>/dev/null 2>/dev/null"
-nohup configesp 1>/dev/null 2>/dev/null &
+nohup esp 1>/dev/null 2>/dev/null &
 echo $! > $PID_NAME
 wait
 log "removing $PID_NAME"
@@ -53,7 +53,7 @@ while [[ -e ${SENTINEL} ]]; do
     sleep 5
     if [[ -e ${SENTINEL} ]]; then
         log "calling configesp 1>/dev/null 2>/dev/null"
-        nohup configesp 1>/dev/null 2>/dev/null &
+        nohup esp 1>/dev/null 2>/dev/null &
         echo $! > $PID_NAME
         wait
         log "removing $PID_NAME"

+ 3 - 4
initfiles/bin/init_dafilesrv.in

@@ -24,9 +24,8 @@ else
 fi
 shift
 
-PATH_PRE=$(type -path hpcc_setenv)
-source ${PATH_PRE}
-PID_NAME="$PID/$(basename $PWD).pid"
+source ${INSTALL_DIR}/sbin/hpcc_setenv
+PID_NAME="${PID_DIR}/$(basename $PWD).pid"
 source ${INSTALL_DIR}/etc/init.d/hpcc_common
 
 # this must match jsocket hard limit
@@ -47,7 +46,7 @@ killed()
         log "could not kill $component"
     else
         log "$component Stopped"
-        unlock /var/lock/HPCCSystems/$component/${component}.lock
+        unlock ${LOCK_DIR}/$component/${component}.lock
     fi
     exit 255
 }

+ 5 - 4
initfiles/bin/init_dali

@@ -15,9 +15,10 @@
 #    limitations under the License.
 ################################################################################
 
-PATH_PRE=$(type -path hpcc_setenv)
-source ${PATH_PRE}
-PID_NAME="$PID/$(basename $PWD).pid"
+###<REPLACE>###
+
+source ${INSTALL_DIR}/sbin/hpcc_setenv
+PID_NAME="${PID_DIR}/$(basename $PWD).pid"
 source ${INSTALL_DIR}/etc/init.d/hpcc_common
 
 component=$(basename $PWD)
@@ -37,7 +38,7 @@ killed()
         log "could not kill $component"
     else
         log "$component Stopped"
-        unlock /var/lock/HPCCSystems/$component/${component}.lock
+        unlock ${LOCK_DIR}/$component/${component}.lock
     fi
     exit 255
 }

+ 5 - 4
initfiles/bin/init_dfuserver

@@ -15,9 +15,10 @@
 #    limitations under the License.
 ################################################################################
 
-PATH_PRE=$(type -path hpcc_setenv)
-source ${PATH_PRE}
-PID_NAME="$PID/$(basename $PWD).pid"
+###<REPLACE>###
+
+source ${INSTALL_DIR}/sbin/hpcc_setenv
+PID_NAME="${PID_DIR}/$(basename $PWD).pid"
 source ${INSTALL_DIR}/etc/init.d/hpcc_common
 
 component=$(basename $PWD)
@@ -35,7 +36,7 @@ killed()
         log "could not kill $component"
     else
         log "$component Stopped"
-        unlock /var/lock/HPCCSystems/$component/${component}.lock
+        unlock ${LOCK_DIR}/$component/${component}.lock
     fi
     exit 255
 }

+ 3 - 4
initfiles/bin/init_eclagent.in

@@ -17,9 +17,8 @@
 
 ###<REPLACE>###
 
-PATH_PRE=$(type -path hpcc_setenv)
-source ${PATH_PRE}
-PID_NAME="$PID/$(basename $PWD).pid"
+source ${INSTALL_DIR}/sbin/hpcc_setenv
+PID_NAME="${PID_DIR}/$(basename $PWD).pid"
 source ${INSTALL_DIR}/etc/init.d/hpcc_common
 
 component=$(basename $PWD)
@@ -40,7 +39,7 @@ killed ()
         log "could not kill $component"
     else
         log "$component Stopped"
-        unlock /var/lock/HPCCSystems/$component/${component}.lock
+        unlock ${LOCK_DIR}/$component/${component}.lock
     fi
     exit 255
 }

+ 5 - 4
initfiles/bin/init_eclccserver

@@ -15,9 +15,10 @@
 #    limitations under the License.
 ################################################################################
 
-PATH_PRE=$(type -path hpcc_setenv)
-source ${PATH_PRE}
-PID_NAME="$PID/$(basename $PWD).pid"
+###<REPLACE>###
+
+source ${INSTALL_DIR}/sbin/hpcc_setenv
+PID_NAME="${PID_DIR}/$(basename $PWD).pid"
 source ${INSTALL_DIR}/etc/init.d/hpcc_common
 
 component=$(basename $PWD)
@@ -34,7 +35,7 @@ killed()
         log "could not kill $component"
     else
         log "$component Stopped"
-        unlock /var/lock/HPCCSystems/$component/${component}.lock
+        unlock ${LOCK_DIR}/$component/${component}.lock
     fi
     exit 255
 }

+ 5 - 4
initfiles/bin/init_eclscheduler

@@ -15,9 +15,10 @@
 #    limitations under the License.
 ################################################################################
 
-PATH_PRE=$(type -path hpcc_setenv)
-source ${PATH_PRE}
-PID_NAME="$PID/$(basename $PWD).pid"
+###<REPLACE>###
+
+source ${INSTALL_DIR}/sbin/hpcc_setenv
+PID_NAME="${PID_DIR}/$(basename $PWD).pid"
 source ${INSTALL_DIR}/etc/init.d/hpcc_common
 
 component=$(basename $PWD)
@@ -35,7 +36,7 @@ killed()
         log "could not kill $component"
     else
         log "$component Stopped"
-        unlock /var/lock/HPCCSystems/$component/${component}.lock
+        unlock ${LOCK_DIR}/$component/${component}.lock
     fi
     exit 255
 }

+ 5 - 4
initfiles/bin/init_esp

@@ -15,9 +15,10 @@
 #    limitations under the License.
 ################################################################################
 
-PATH_PRE=$(type -path hpcc_setenv)
-source ${PATH_PRE}
-PID_NAME="$PID/$(basename $PWD).pid"
+###<REPLACE>###
+
+source ${INSTALL_DIR}/sbin/hpcc_setenv
+PID_NAME="${PID_DIR}/$(basename $PWD).pid"
 source ${INSTALL_DIR}/etc/init.d/hpcc_common
 
 component=$(basename $PWD)
@@ -38,7 +39,7 @@ killed()
         log "could not kill $component"
     else
         log "$component Stopped"
-        unlock /var/lock/HPCCSystems/$component/${component}.lock
+        unlock ${LOCK_DIR}/$component/${component}.lock
     fi
     exit 255
 }

+ 5 - 4
initfiles/bin/init_roxie

@@ -15,9 +15,10 @@
 #    limitations under the License.
 ################################################################################
 
-PATH_PRE=$(type -path hpcc_setenv)
-source ${PATH_PRE}
-PID_NAME="$PID/$(basename $PWD).pid"
+###<REPLACE>###
+
+source ${INSTALL_DIR}/sbin/hpcc_setenv
+PID_NAME="${PID_DIR}/$(basename $PWD).pid"
 source ${INSTALL_DIR}/etc/init.d/hpcc_common
 
 component=$(basename $PWD)
@@ -62,7 +63,7 @@ killed()
         log "could not kill $component"
     else
         log "$component Stopped"
-        unlock /var/lock/HPCCSystems/$component/${component}.lock
+        unlock ${LOCK_DIR}/$component/${component}.lock
     fi
     exit 255
 }

+ 5 - 5
initfiles/bin/init_sasha

@@ -15,11 +15,11 @@
 #    limitations under the License.
 ################################################################################
 
-PATH_PRE=$(type -path hpcc_setenv)
-source ${PATH_PRE}
-PID_NAME="$PID/$(basename $PWD).pid"
+###<REPLACE>###
+
+source ${INSTALL_DIR}/sbin/hpcc_setenv
+PID_NAME="${PID_DIR}/$(basename $PWD).pid"
 
-INSTALL_DIR="$(dirname ${PATH_PRE})/.."
 source  ${INSTALL_DIR}/etc/init.d/hpcc_common
 
 component=$(basename $PWD)
@@ -37,7 +37,7 @@ killed()
         log "could not kill $component"
     else
         log "$component Stopped"
-        unlock /var/lock/HPCCSystems/$component/${component}.lock
+        unlock ${LOCK_DIR}/$component/${component}.lock
     fi
     exit 255
 }

+ 10 - 10
initfiles/bin/init_thor

@@ -15,15 +15,15 @@
 #    limitations under the License.
 ################################################################################
 
+###<REPLACE>###
+
+source ${INSTALL_DIR}/sbin/hpcc_setenv
 deploydir=$(dirname $(type -path $0))
-PATH_PRE=$(type -path hpcc_setenv)
-source ${PATH_PRE}
 
-INSTALL_DIR=$(dirname ${PATH_PRE})/..
 source  ${INSTALL_DIR}/etc/init.d/hpcc_common
 component=$(basename $PWD)
 
-PID_NAME="$PID/${component}.pid"
+PID_NAME="${PID_DIR}/${component}.pid"
 
 timestamp="$(date +%Y_%m_%d_%H_%M_%S)"
 export logfile="${LOG_DIR}/${component}/init_${component}_${timestamp}.log"
@@ -69,12 +69,12 @@ kill_slaves()
     log "Killing slaves"
     # NB: many of the parameters to init_thorslave not used by 'stop' command
     if [[ "$localthor" = "true" ]]; then
-        $deploydir/init_thorslave stop localhost $slavespernode $THORSLAVEPORT $slaveportinc $THORMASTER $THORMASTERPORT $LOG_DIR $instancedir $deploydir $THORNAME $PATH_PRE $logredirect
+        $deploydir/init_thorslave stop localhost $slavespernode $THORSLAVEPORT $slaveportinc $THORMASTER $THORMASTERPORT $LOG_DIR $instancedir $deploydir $THORNAME ${INSTALL_DIR}/sbin $logredirect
     else
         # we want to kill only slaves that have already been started in run_thor
         if [[ -r $instancedir/uslaves ]]; then
             clusternodes=$(cat $instancedir/uslaves 2> /dev/null | wc -l)
-            $deploydir/frunssh $instancedir/slaves "/bin/sh -c '$deploydir/init_thorslave stop localhost $slavespernode $THORSLAVEPORT $slaveportinc $THORMASTER $THORMASTERPORT $LOG_DIR $instancedir $deploydir $THORNAME $PATH_PRE $logredirect'" -i:$SSHidentityfile -u:$SSHusername -pe:$SSHpassword -t:$SSHtimeout -a:$SSHretries -n:$clusternodes 2>&1
+            $deploydir/frunssh $instancedir/slaves "/bin/sh -c '$deploydir/init_thorslave stop localhost $slavespernode $THORSLAVEPORT $slaveportinc $THORMASTER $THORMASTERPORT $LOG_DIR $instancedir $deploydir $THORNAME ${INSTALL_DIR}/sbin $logredirect'" -i:$SSHidentityfile -u:$SSHusername -pe:$SSHpassword -t:$SSHtimeout -a:$SSHretries -n:$clusternodes 2>&1
             FRUNSSH_RC=$?
             if [[ ${FRUNSSH_RC} -gt 0 ]]; then
                 log "Error ${FRUNSSH_RC} in frunssh"
@@ -82,7 +82,7 @@ kill_slaves()
                 # clean up any slaves it was able to reach
                 log "Stopping ${component}"
                 kill_process ${PID_NAME} thormaster_${component} 30
-                unlock /var/lock/HPCCSystems/$component/${component}.lock
+                unlock ${LOCK_DIR}/$component/${component}.lock
                 rm -f $INIT_PID_NAME $instancedir/slaves > /dev/null 2>&1
                 exit 255
             fi
@@ -100,7 +100,7 @@ killed()
         log "could not kill $component"
     else
         log "$component Stopped"
-        unlock /var/lock/HPCCSystems/$component/${component}.lock
+        unlock ${LOCK_DIR}/$component/${component}.lock
         kill_slaves
         log "removing init.pid file and slaves file"
         rm -f $INIT_PID_NAME $instancedir/slaves > /dev/null 2>&1
@@ -131,10 +131,10 @@ while [[ 1 ]]; do
 
     if [[ "$localthor" = "true" ]]; then
         slaveip=$(head -n 1 $instancedir/uslaves)
-        $deploydir/init_thorslave start $slaveip $slavespernode $THORSLAVEPORT $slaveportinc $THORMASTER $THORMASTERPORT $LOG_DIR $instancedir $deploydir $THORNAME $PATH_PRE $logredirect
+        $deploydir/init_thorslave start $slaveip $slavespernode $THORSLAVEPORT $slaveportinc $THORMASTER $THORMASTERPORT $LOG_DIR $instancedir $deploydir $THORNAME ${INSTALL_DIR}/sbin $logredirect
     else
         clusternodes=$(cat $instancedir/uslaves | wc -l)
-        $deploydir/frunssh $instancedir/uslaves "/bin/sh -c '$deploydir/init_thorslave start %a $slavespernode $THORSLAVEPORT $slaveportinc $THORMASTER $THORMASTERPORT $LOG_DIR $instancedir $deploydir $THORNAME $PATH_PRE $logredirect'" -i:$SSHidentityfile -u:$SSHusername -pe:$SSHpassword -t:$SSHtimeout -a:$SSHretries -n:$clusternodes 2>&1
+        $deploydir/frunssh $instancedir/uslaves "/bin/sh -c '$deploydir/init_thorslave start %a $slavespernode $THORSLAVEPORT $slaveportinc $THORMASTER $THORMASTERPORT $LOG_DIR $instancedir $deploydir $THORNAME ${INSTALL_DIR}/sbin $logredirect'" -i:$SSHidentityfile -u:$SSHusername -pe:$SSHpassword -t:$SSHtimeout -a:$SSHretries -n:$clusternodes 2>&1
         FRUNSSH_RC=$?
         if [[ ${FRUNSSH_RC} -gt 0 ]]; then
             log "Error ${FRUNSSH_RC} in frunssh"

+ 12 - 6
initfiles/bin/init_thorslave

@@ -15,6 +15,8 @@
 #    limitations under the License.
 ################################################################################
 
+###<REPLACE>###
+
 cmd=$1
 ip=$2
 slavespernode=$3
@@ -30,8 +32,10 @@ hpcc_setenv=${12}
 
 export logfile="${logpth}/${hpcc_compname}/${13}"
 
-source "$hpcc_setenv"
-source "$(dirname $hpcc_setenv)/../etc/init.d/hpcc_common"
+source ${INSTALL_DIR}/etc/init.d/hpcc_common
+source ${INSTALL_DIR}/sbin/hpcc_setenv
+set_environmentvars
+
 
 slavename=thorslave_${hpcc_compname}
 
@@ -54,15 +58,17 @@ stop_slaves()
         killall -SIGKILL $slavename > /dev/null
     fi
 
-    rm -f $PID/${slavename}_*.pid > /dev/null
+    rm -f ${PID_DIR}/${slavename}_*.pid > /dev/null
 }
 
 start_slaves()
 {
     # insuring dafilesrv is running on the machine as it is a prerequisite
-    sudo /etc/init.d/dafilesrv status > /dev/null
+    dafilesrv_owner=$(stat -c "%U" ${INIT_PATH}/dafilesrv 2>/dev/null)
+    [[ "${dafilesrv_owner}" != "${user}" ]] && cmd_prefix="sudo"
+    ${cmd_prefix} ${INIT_PATH}/dafilesrv status > /dev/null
     if [[ $? -ne 0 ]];then
-        sudo /etc/init.d/dafilesrv start > /dev/null
+        ${cmd_prefix} ${INIT_PATH}/dafilesrv start > /dev/null
         if [[ $? -ne 0 ]];then
             exit 1
         fi
@@ -108,7 +114,7 @@ start_slaves()
                     fts=1
                 else
                     log "slave pid $slavepid started"
-                    PID_NAME="$PID/${slavename}_${slavenum}.pid"
+                    PID_NAME="${PID_DIR}/${slavename}_${slavenum}.pid"
                     echo $slavepid > $PID_NAME
                 fi
                 slaveport=$(( ${slaveport} + ${slaveportinc} ))

+ 2 - 2
initfiles/componentfiles/launcher/CMakeLists.txt

@@ -15,5 +15,5 @@
 #    limitations under the License.
 ################################################################################
 
-install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/hpcc-systems.desktop DESTINATION ${INSTALL_DIR}/share COMPONENT Runtime )
-install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/LN.png DESTINATION ${INSTALL_DIR}/share COMPONENT Runtime )
+install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/hpcc-systems.desktop DESTINATION share COMPONENT Runtime )
+install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/LN.png DESTINATION share COMPONENT Runtime )

+ 15 - 6
initfiles/etc/DIR_NAME/CMakeLists.txt

@@ -15,17 +15,26 @@
 #    limitations under the License.
 ################################################################################
 configure_file("version.in" "version")
-configure_file("environment.conf.in" "environment.conf")
-configure_file("environment.xml.in" "environment.xml")
+configure_file("environment.conf.in" "environment.conf" IMMEDIATE)
+configure_file("environment.xml.in" "environment.xml" IMMEDIATE)
 FOREACH( iFILES
     ${CMAKE_CURRENT_BINARY_DIR}/environment.conf
     ${CMAKE_CURRENT_BINARY_DIR}/version
 )
-    Install ( FILES ${iFILES}  DESTINATION .${CONFIG_DIR} COMPONENT Runtime )	#  Don't delete the "."
+    Install ( FILES ${iFILES}  DESTINATION etc/${DIR_NAME} COMPONENT Runtime )	#  Don't delete the "."
 ENDFOREACH ( iFILES)
 
-Install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/environment.xml DESTINATION .${CONFIG_DIR}/rpmnew COMPONENT Runtime ) 	#  Don't delete the "."
-Install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/environment.conf DESTINATION .${CONFIG_DIR}/rpmnew COMPONENT Runtime )
-Install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/genenvrules.conf DESTINATION .${CONFIG_DIR}/rpmnew COMPONENT Runtime )
+Install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/environment.xml DESTINATION etc/${DIR_NAME}/rpmnew COMPONENT Runtime ) 	#  Don't delete the "."
+Install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/environment.conf DESTINATION etc/${DIR_NAME}/rpmnew COMPONENT Runtime )
+Install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/genenvrules.conf DESTINATION etc/${DIR_NAME}/rpmnew COMPONENT Runtime )
+Install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/environment.xml DESTINATION ${CONFIG_PREFIX}/${DIR_NAME}/${CONFIG_SOURCE_DIR} )
 
 ADD_SUBDIRECTORY(configmgr)
+
+if("$ENV{DESTDIR}" STRGREATER "")
+    add_custom_target(configure
+        COMMAND ${CMAKE_COMMAND} -E make_directory ${CONFIG_DIR}
+        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${ENV_XML_FILE} ${CONFIG_DIR}
+        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${ENV_CONF_FILE} ${CONFIG_DIR}
+        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/genenvrules.conf ${CONFIG_DIR})
+endif()

+ 4 - 2
initfiles/etc/DIR_NAME/configmgr/CMakeLists.txt

@@ -16,5 +16,7 @@
 ################################################################################
 configure_file("configmgr.conf.in" "configmgr.conf")
 configure_file("esp.xml.in" "esp.xml")
-Install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/configmgr.conf DESTINATION .${CONFIG_DIR}/configmgr COMPONENT Runtime ) # Don't delete the "."
-Install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/esp.xml DESTINATION .${CONFIG_DIR}/configmgr COMPONENT Runtime ) # Don't delete the "."
+Install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/configmgr.conf DESTINATION etc/${DIR_NAME}/configmgr COMPONENT Runtime ) # Don't delete the "."
+Install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/configmgr.conf DESTINATION ${CONFIG_PREFIX}/${DIR_NAME}/configmgr COMPONENT Runtime )
+Install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/esp.xml DESTINATION etc/${DIR_NAME}/configmgr COMPONENT Runtime ) # Don't delete the "."
+Install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/esp.xml DESTINATION ${CONFIG_PREFIX}/${DIR_NAME}/configmgr COMPONENT Runtime )

+ 1 - 1
initfiles/etc/DIR_NAME/configmgr/esp.xml.in

@@ -24,7 +24,7 @@
 <EspProtocol name="http" type="http_protocol" plugin="esphttp" maxRequestEntityLength="8000000"/>
 <EspService name="WsDeploy_wsdeploy_esp" type="WsDeploy" plugin="WsDeploy">
   <LocalEnvFile>${CONFIG_DIR}/${ENV_XML_FILE}</LocalEnvFile>
-  <LocalConfFile>${INSTALL_DIR}${CONFIG_DIR}/configmgr/configmgr.conf</LocalConfFile>
+  <LocalConfFile>${INSTALL_DIR}/etc/${DIR_NAME}/configmgr/configmgr.conf</LocalConfFile>
   <LocalEnvConfFile>${CONFIG_DIR}/${ENV_CONF_FILE}</LocalEnvConfFile>
 </EspService>
 <EspBinding name="WsDeploy_EspBinding_esp" service="WsDeploy_wsdeploy_esp" protocol="http" type="WsDeploySoapBinding" plugin="WsDeploy" netAddress="0.0.0.0" port="8015" defaultBinding="true">

+ 11 - 11
initfiles/etc/DIR_NAME/environment.xml.in

@@ -436,17 +436,17 @@
    </EspBinding>
   </EspProcess>
   <Directories name="${DIR_NAME}">
-   <Category dir="${EXEC_PREFIX}/log/[NAME]/[INST]" name="log"/>
-   <Category dir="${EXEC_PREFIX}/lib/[NAME]/[INST]" name="run"/>
-   <Category dir="${CONFIG_PREFIX}/[NAME]/[INST]" name="conf"/>
-   <Category dir="${EXEC_PREFIX}/lib/[NAME]/[INST]/temp" name="temp"/>
-   <Category dir="${EXEC_PREFIX}/lib/[NAME]/hpcc-data/[COMPONENT]" name="data"/>
-   <Category dir="${EXEC_PREFIX}/lib/[NAME]/hpcc-data2/[COMPONENT]" name="data2"/>
-   <Category dir="${EXEC_PREFIX}/lib/[NAME]/hpcc-data3/[COMPONENT]" name="data3"/>
-   <Category dir="${EXEC_PREFIX}/lib/[NAME]/hpcc-mirror/[COMPONENT]" name="mirror"/>
-   <Category dir="${EXEC_PREFIX}/lib/[NAME]/queries/[INST]" name="query"/>
-   <Category dir="${EXEC_PREFIX}/lock/[NAME]/[INST]" name="lock"/>
-   <Category dir="${EXEC_PREFIX}/lib/[NAME]/hpcc-data4/[COMPONENT]" name="data4"/>
+   <Category dir="$ENV{DESTDIR}${EXEC_PREFIX}/log/[NAME]/[INST]" name="log"/>
+   <Category dir="$ENV{DESTDIR}${EXEC_PREFIX}/lib/[NAME]/[INST]" name="run"/>
+   <Category dir="$ENV{DESTDIR}${CONFIG_PREFIX}/[NAME]/[INST]" name="conf"/>
+   <Category dir="$ENV{DESTDIR}${EXEC_PREFIX}/lib/[NAME]/[INST]/temp" name="temp"/>
+   <Category dir="$ENV{DESTDIR}${EXEC_PREFIX}/lib/[NAME]/hpcc-data/[COMPONENT]" name="data"/>
+   <Category dir="$ENV{DESTDIR}${EXEC_PREFIX}/lib/[NAME]/hpcc-data2/[COMPONENT]" name="data2"/>
+   <Category dir="$ENV{DESTDIR}${EXEC_PREFIX}/lib/[NAME]/hpcc-data3/[COMPONENT]" name="data3"/>
+   <Category dir="$ENV{DESTDIR}${EXEC_PREFIX}/lib/[NAME]/hpcc-mirror/[COMPONENT]" name="mirror"/>
+   <Category dir="$ENV{DESTDIR}${EXEC_PREFIX}/lib/[NAME]/queries/[INST]" name="query"/>
+   <Category dir="$ENV{DESTDIR}${EXEC_PREFIX}/lock/[NAME]/[INST]" name="lock"/>
+   <Category dir="$ENV{DESTDIR}${EXEC_PREFIX}/lib/[NAME]/hpcc-data4/[COMPONENT]" name="data4"/>
   </Directories>
   <EclAgentProcess allowedPipePrograms="*"
                    build="_"

+ 1 - 1
initfiles/etc/bash_completion/CMakeLists.txt

@@ -20,5 +20,5 @@ FOREACH( oFILES
     ${CMAKE_CURRENT_SOURCE_DIR}/eclplus
     ${CMAKE_CURRENT_SOURCE_DIR}/eclagent
 )
-    install ( FILES ${oFILES} DESTINATION ${INSTALL_DIR}/etc/bash_completion.d COMPONENT Runtime )
+    install ( FILES ${oFILES} DESTINATION etc/bash_completion.d COMPONENT Runtime )
 ENDFOREACH ( oFILES )

+ 2 - 4
initfiles/sbin/configmgr.in

@@ -27,19 +27,17 @@ source ${INSTALL_DIR}/etc/init.d/hpcc_common
 
 createConf ()
 {
-    awk -f ${reg_path}/regex.awk -v NEW_ENVFILE=$1 -v NEW_PORT=$2 -v NEW_CONFFILE=$3< ${path}${configs}/configmgr/esp.xml >${runtime}/${compName}/esp.xml
+    awk -f ${reg_path}/regex.awk -v NEW_ENVFILE=$1 -v NEW_PORT=$2 -v NEW_CONFFILE=$3< ${CONFIG_DIR}/configmgr/esp.xml >${runtime}/${compName}/esp.xml
 }
 
 
 cleanup ()
 {
     echo "Exiting configMgr"
-    #stop configesp
     PIDPATH=${pid}/${compName}_init.pid
     stopcmd="${START_STOP_DAEMON} -K -p $PIDPATH"
     eval $stopcmd
     sleep 2
-    killall -9 configesp >/dev/null 2>&1
     cleanupRuntimeEnvironment
     exit
 }
@@ -67,7 +65,7 @@ reg_path=${path}/sbin
 compName=configmgr
 compPath=${runtime}/${compName}
 
-is_root
+[[ ! -w "${CONFIG_DIR}" ]] && is_root
 
 # Trapping keyboard interrupt  control-c
 trap control_c SIGINT

+ 2 - 2
initfiles/sbin/hpcc-run.sh.in

@@ -82,7 +82,7 @@ doOneIP(){
             return 1
         else
             hpccStatusFile=/tmp/hpcc_status_$$
-            local CMD="sudo /etc/init.d/$_action $_args"
+            local CMD="sudo ${INIT_PATH}/$_action $_args"
             echo "$_ip: Running $CMD"
             local CMD="$CMD | tee ${hpccStatusFile}"
 
@@ -118,7 +118,7 @@ if ping -c 1 -w 5 -n \$IP > /dev/null 2>&1; then
         echo "\$IP: Cannot SSH to host."
         exit 1
     else
-        CMD="sudo /etc/init.d/$_action $_args"
+        CMD="sudo ${INIT_PATH}/$_action $_args"
         echo "\$IP: Running \$CMD"
         CMD="\$CMD | tee $hpccStatusFile"
         ssh -i $home/$user/.ssh/id_rsa -o LogLevel=QUIET $user@\$IP \$CMD;