فهرست منبع

Merge pull request #8956 from Michael-Gardner/hpcc-15142-2

HPCC-15142 Minimal changes needed for 'make install'

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 8 سال پیش
والد
کامیت
b714ccfb21
50فایلهای تغییر یافته به همراه248 افزوده شده و 184 حذف شده
  1. 29 0
      CMakeLists.txt
  2. 4 4
      cmake_modules/commonSetup.cmake
  3. 10 4
      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. 2 6
      initfiles/bash/etc/init.d/dafilesrv.in
  12. 3 3
      initfiles/bash/etc/init.d/dafilesrv.service
  13. 3 3
      initfiles/bash/etc/init.d/dafilesrv@.service
  14. 11 11
      initfiles/bash/etc/init.d/hpcc-init.in
  15. 0 1
      initfiles/bash/etc/init.d/hpcc-init.install
  16. 3 3
      initfiles/bash/etc/init.d/hpcc-init.service
  17. 0 2
      initfiles/bash/etc/init.d/hpcc-init.uninstall
  18. 3 3
      initfiles/bash/etc/init.d/hpcc-init@.service
  19. 13 12
      initfiles/bash/etc/init.d/hpcc_common.in
  20. 2 2
      initfiles/bash/etc/init.d/init-functions
  21. 0 1
      initfiles/bash/etc/init.d/install-init.in
  22. 3 3
      initfiles/bash/etc/init.d/lock.sh
  23. 2 2
      initfiles/bash/etc/init.d/pid.sh
  24. 10 10
      initfiles/bin/CMakeLists.txt
  25. 7 7
      initfiles/bin/init_configesp
  26. 3 4
      initfiles/bin/init_dafilesrv.in
  27. 5 4
      initfiles/bin/init_dali
  28. 5 4
      initfiles/bin/init_dfuserver
  29. 3 4
      initfiles/bin/init_eclagent.in
  30. 5 4
      initfiles/bin/init_eclccserver
  31. 5 4
      initfiles/bin/init_eclscheduler
  32. 5 4
      initfiles/bin/init_esp
  33. 5 4
      initfiles/bin/init_roxie
  34. 5 5
      initfiles/bin/init_sasha
  35. 10 10
      initfiles/bin/init_thor
  36. 12 6
      initfiles/bin/init_thorslave
  37. 1 1
      initfiles/componentfiles/configxml/@temp/esp_service.xsl
  38. 2 2
      initfiles/componentfiles/configxml/@temp/esp_service_WsSMC.xsl
  39. 1 1
      initfiles/componentfiles/configxml/@temp/esp_service_ecldirect.xsl
  40. 1 1
      initfiles/componentfiles/configxml/@temp/esp_service_wsecl.xsl
  41. 1 1
      initfiles/componentfiles/configxml/@temp/esp_service_wslogging.xsl
  42. 1 1
      initfiles/componentfiles/configxml/esp.xsl
  43. 2 2
      initfiles/componentfiles/launcher/CMakeLists.txt
  44. 16 6
      initfiles/etc/DIR_NAME/CMakeLists.txt
  45. 4 2
      initfiles/etc/DIR_NAME/configmgr/CMakeLists.txt
  46. 1 1
      initfiles/etc/DIR_NAME/configmgr/esp.xml.in
  47. 11 11
      initfiles/etc/DIR_NAME/environment.xml.in
  48. 1 1
      initfiles/etc/bash_completion/CMakeLists.txt
  49. 2 4
      initfiles/sbin/configmgr.in
  50. 2 2
      initfiles/sbin/hpcc-run.sh.in

+ 29 - 0
CMakeLists.txt

@@ -45,6 +45,26 @@
 #   5. To build the project, load the solution into the visual studio IDE and build in the usual way.
 #   6. Executables will be created in .\hpcc\bin\<release_mode>
 #
+#   To create a development installation on Linux:
+#   1. Check out sources (for example, to directory ~/hpcc)
+#   2. Create a build directory alongside your source
+#   3. To create makefiles and have the ability to run the applications as non-superuser, execute
+#       cmake -DRUNTIME_USER=$USER -DRUNTIME_GROUP=groupname -DDESTDIR=$HOME/myruntime ~/hpcc
+#   4. To build the makefiles just created above, run
+#       make
+#   5. To install the project under DESTDIR, run
+#       make install
+#   6. To populate environment xml's and conf files necessary for running your development installation, run
+#       make configure
+#   7a.To start up the platform, execute all binaries and scripts under DESTDIR as a regular user, example
+#       $HOME/myruntime/etc/init.d/hpcc-init start
+#   7b.All runtime files will be under $HOME/myruntime/var/{log,lib,run,lock}
+#   8a.To patch your running installation, simply modify the source, and then from the build directory run
+#       make install
+#      Which will recompile any changes and only install files into the platform that have been modified
+#   8b.Restart the platform (or specific component that had modifications), example
+#       $HOME/myruntime/etc/init.d/hpcc-init restart
+#
 #########################################################
 
 project(hpccsystems-platform)
@@ -96,6 +116,7 @@ option(RUNTIME_GROUP "Set the runtime group")
 option(ENV_XML_FILE "Set the environment xml file name.")
 option(ENV_CONF_FILE "Set the environment conf file name.")
 option(LICENSE_FILE "Set the license file to use.")
+option(DESTDIR "Set the alternate root installation path.")
 
 if(NOT LICENSE_FILE)
     if(REMBED)
@@ -447,4 +468,12 @@ 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)
+
 include(CPack)

+ 4 - 4
cmake_modules/commonSetup.cmake

@@ -882,17 +882,17 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
   ## The following sets the install directories and names.
   ###
   if ( PLATFORM OR PLUGIN )
-    set ( CMAKE_INSTALL_PREFIX "${PREFIX}/${DIR_NAME}" )
+      set ( CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" )
   else ( )
-    set ( CMAKE_INSTALL_PREFIX "${PREFIX}/${DIR_NAME}/${version}/clienttools" )
+    set ( CMAKE_INSTALL_PREFIX "${INSTALL_DIR}/${version}/clienttools" )
   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 - 4
cmake_modules/optionDefaults.cmake

@@ -1,3 +1,6 @@
+if ( NOT DESTDIR )
+    set( DESTDIR "" )
+endif()
 
 if ( NOT PREFIX )
 if ( WIN32 )
@@ -9,16 +12,16 @@ if ( WIN32 )
     endif()
     string(REGEX REPLACE "\\\\" "/" PREFIX ${PREFIX})    
 else (WIN32)
-    set( PREFIX "/opt" )
+    set( PREFIX "${DESTDIR}/opt" )
 endif (WIN32)    
 endif()
 
 if ( NOT EXEC_PREFIX )
-    set( EXEC_PREFIX "/var" )
+    set( EXEC_PREFIX "${DESTDIR}/var" )
 endif()
 
 if ( NOT CONFIG_PREFIX )
-    set( CONFIG_PREFIX "/etc" )
+    set( CONFIG_PREFIX "${DESTDIR}/etc" )
 endif()
 
 if ( NOT DIR_NAME )
@@ -78,7 +81,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 )
@@ -95,9 +98,12 @@ 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( INIT_PATH "${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)

+ 2 - 6
initfiles/bash/etc/init.d/dafilesrv.in

@@ -82,16 +82,12 @@ if [ $? -ne 1 ];then
    exit 3
 fi
 
-groupNum=`grep -w ${user} /etc/passwd  | cut -d ':' -f 4`
-group=`grep -w ${groupNum} /etc/group | cut -d ':' -f 1`
-
 check_group ${group}
 if [ $? -ne 1 ];then
    echo "Group for user ${user} does not exist on the system. Exiting....."
    exit 3
 fi
 
-
 COMPS=$(${configgen_path}/configgen -env ${envfile} -ip "127.0.0.1" -list)
 if [[ $rc -ne 0 ]]; then
     log "hpcc-init: failure to build COMPS from configgen call"
@@ -121,9 +117,9 @@ if [ -z "${component}" ] ; then
     exit 3
 fi
 
-TEMP=`/usr/bin/getopt -o h --long help -n 'dafilesrv' -- "$@"`
+TEMP=`getopt -o h --long help -n 'dafilesrv' -- "$@"`
 if [ $? != 0 ] ; then echo "Failure to parse commandline." >&2 ; exit 1 ; fi
-eval set -- "$TEMP"
+eval set -- $TEMP
 while true ; do
     case "$1" in
         -h|--help) print_usage

+ 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

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

@@ -109,8 +109,8 @@ envfile=$configs/$environment
 
 # Know HPCC user after set_environmentvars
 log_dir_owner=$(ls -ld $LOG_DIR | awk '{print $3}')
-[ "log_dir_owner" != "${user}" ] && chown ${user}:${user} $LOG_DIR
-chown ${user}:${user} $logfile
+[ "log_dir_owner" != "${user}" ] && chown ${user}:${group} $LOG_DIR
+chown ${user}:${group} $logfile
 
 #Sourcing the hpcc environment
 configgen_path=${path}/sbin
@@ -220,9 +220,9 @@ component=""
 runSetupOnly=0
 dafilesrvflag=0
 
-TEMP=`/usr/bin/getopt -o c:hdf --long help,componentlist,typelist,debug,force -n 'hpcc-init' -- "$@"`
+TEMP=`getopt -o c:hdf --long help,componentlist,typelist,debug,force -n 'hpcc-init' -- "$@"`
 if [ $? != 0 ] ; then echo "Failure to parse commandline." >&2 ; exit 1 ; fi
-eval set -- "$TEMP"
+eval set -- $TEMP
 while true ; do
     case "$1" in
         -c) comp=$2
@@ -275,7 +275,7 @@ fi
 log "Debug log written to $LOG_DIR/hpcc-init.debug"
 [ -e $LOG_DIR/hpcc-init.debug ] && rm -rf ${LOG_DIR}/hpcc-init.debug
 touch ${LOG_DIR}/hpcc-init.debug
-chown ${user}:${user} ${LOG_DIR}/hpcc-init.debug
+chown ${user}:${group} ${LOG_DIR}/hpcc-init.debug
 exec 2>$LOG_DIR/hpcc-init.debug
 set -x
 
@@ -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

+ 13 - 12
initfiles/bash/etc/init.d/hpcc_common.in

@@ -63,7 +63,7 @@ cfg.parser () {
     if [ ! -e $1 ] || [ $# -lt 1 ]; then
     [[ "${VERBOSE:-0}" -eq 1 ]] && log_end_msg 1 && return 1 || return 1
     fi
-    IFS=$'\n' && ini=( $(cat $1 | sed -e 's/[ \t]*=[ \t]*/=/') )              # convert to line-array
+    IFS=$'\n' && ini=( $(cat $1 | sed -e 's/[[:blank:]]*=[[:blank:]]*/=/') )              # convert to line-array
     ini=( ${ini[*]//[;#]*/} )                   # remove comments
     ini=( ${ini[*]/#[/\}$'\n'cfg.section.} ) # set section prefix
     ini=( ${ini[*]/%]/ \(} )                 # convert text2function (1)
@@ -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=$?
@@ -732,7 +732,7 @@ check_group(){
     GROUP=$1
     touch /tmp/file.$$
     chgrp ${GROUP} /tmp/file.$$ > /dev/null 2>&1
-    if [ $(stat -c %G /tmp/file.$$) = "${GROUP}" ];
+    if [ $(stat -c %G /tmp/file.$$ 2>/dev/null || stat -f %Sg /tmp/file.$$ 2>/dev/null) = "${GROUP}" ];
     then
         rm -rf /tmp/file.$$
         return 1
@@ -965,17 +965,18 @@ 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
    cluster_log_dir_owner=$(ls -ld $CLUSTER_LOG_DIR | awk '{print $3}')
-   [ "$cluster_log_dir_owner" != "${user}" ] && ${_cmd_prefix} chown ${user}:${user} $CLUSTER_LOG_DIR
+   [ "$cluster_log_dir_owner" != "${user}" ] && ${_cmd_prefix} chown ${user}:${group} $CLUSTER_LOG_DIR
 }
 
 ##

+ 2 - 2
initfiles/bash/etc/init.d/init-functions

@@ -207,8 +207,8 @@ log() {
   fi
 
   local msg=$@
-  local header=$( date --universal --iso-8601='seconds' )
-  local header="${header:0:19}: "
+  local header=$( date +%Y_%m_%d_%H_%M_%S )
+  local header="${header}: "
   printf "%s%s\n" "$header" "$msg" >> $logfile
 
   return 0

+ 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

+ 3 - 3
initfiles/bash/etc/init.d/lock.sh

@@ -25,7 +25,7 @@ checkLockDir () {
     else 
         log "$LOCKPATH ..."
         log "Creating Lock Path ..."
-        /bin/mkdir $LOCKPATH
+        mkdir $LOCKPATH
         if [ !-d $LOCKPATH ]; then
             log "Can not create Lock Path $LOCKPATH ..."
         fi  
@@ -45,7 +45,7 @@ lock () {
         __lockCreated=0
         log "Lock file $FILE already exists"
     else
-        /bin/touch $FILE
+        touch $FILE
         locked $FILE
         if [ $flagLocked -eq 1 ]; then
             #log_success_msg 
@@ -79,7 +79,7 @@ unlock () {
         log "Lock file $FILE does not exist"
         __lockRemoved=0
     else
-        /bin/rm -rf $FILE
+        rm -rf $FILE
         if [ -e $FILE ]; then
             log "File $FILE can not be removed"
             __lockRemoved=0

+ 2 - 2
initfiles/bash/etc/init.d/pid.sh

@@ -23,7 +23,7 @@ checkPidDir () {
     else
         log_failure_msg "" 
         echo "Creating a Pid directory"
-        /bin/mkdir -P ${PIDFILEPATH} 
+        mkdir -P ${PIDFILEPATH} 
         if [[ ! -e ${PIDFILEPATH} ]]; then
             log  "Can not create a Pid directory $PIDFILEPATH"
         else
@@ -70,7 +70,7 @@ getPid () {
     PIDFILEPATH=$1
     checkPid ${PIDFILEPATH}
     if [[ $__flagPid -eq 1 ]]; then
-        __pidValue=$(/bin/cat $PIDFILEPATH)
+        __pidValue=$(cat $PIDFILEPATH)
     else
         __pidValue=0
     fi

+ 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 || stat -f %Su ${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} ))

+ 1 - 1
initfiles/componentfiles/configxml/@temp/esp_service.xsl

@@ -1104,7 +1104,7 @@ xmlns:seisint="http://seisint.com"  xmlns:set="http://exslt.org/sets" exclude-re
         <xsl:value-of select="$plugin"/>
         <!--
         <xsl:choose>
-            <xsl:when test="$isLinuxInstance">lib<xsl:value-of select="$plugin"/>.so</xsl:when>
+            <xsl:when test="$isLinuxInstance"><xsl:value-of select="$plugin"/></xsl:when>
             <xsl:otherwise>
                 <xsl:value-of select="$plugin"/>.dll</xsl:otherwise>
         </xsl:choose>-->

+ 2 - 2
initfiles/componentfiles/configxml/@temp/esp_service_WsSMC.xsl

@@ -367,7 +367,7 @@ This is required by its binding with ESP service '<xsl:value-of select="$espServ
       <xsl:variable name="bindType" select="'EclDirectSoapBinding'"/>
       <xsl:variable name="servicePlugin">
         <xsl:choose>
-          <xsl:when test="$isLinuxInstance">libEclDirect.so</xsl:when>
+          <xsl:when test="$isLinuxInstance">EclDirect</xsl:when>
           <xsl:otherwise>EclDirect.dll</xsl:otherwise>
         </xsl:choose>
       </xsl:variable>
@@ -715,7 +715,7 @@ This is required by its binding with ESP service '<xsl:value-of select="$espServ
     <xsl:template name="defineServicePlugin">
         <xsl:param name="plugin"/>            
         <xsl:choose>
-            <xsl:when test="$isLinuxInstance">lib<xsl:value-of select="$plugin"/>.so</xsl:when>
+            <xsl:when test="$isLinuxInstance"><xsl:value-of select="$plugin"/></xsl:when>
             <xsl:otherwise><xsl:value-of select="$plugin"/>.dll</xsl:otherwise>
         </xsl:choose>
     </xsl:template>

+ 1 - 1
initfiles/componentfiles/configxml/@temp/esp_service_ecldirect.xsl

@@ -59,7 +59,7 @@
         <xsl:variable name="bindType" select="'EclDirectSoapBinding'"/>
         <xsl:variable name="servicePlugin">
             <xsl:choose>
-                <xsl:when test="$isLinuxInstance">libEclDirect.so</xsl:when>
+                <xsl:when test="$isLinuxInstance">EclDirect</xsl:when>
                 <xsl:otherwise>EclDirect.dll</xsl:otherwise>
             </xsl:choose>
         </xsl:variable>

+ 1 - 1
initfiles/componentfiles/configxml/@temp/esp_service_wsecl.xsl

@@ -59,7 +59,7 @@
       <xsl:variable name="bindType" select="'scrubbed_binding'"/>
       <xsl:variable name="servicePlugin">
       <xsl:choose>
-         <xsl:when test="$isLinuxInstance">libws_ecl_attribute.so</xsl:when>
+         <xsl:when test="$isLinuxInstance">ws_ecl_attribute</xsl:when>
          <xsl:otherwise>ws_ecl_attribute.dll</xsl:otherwise>
       </xsl:choose>
       </xsl:variable>

+ 1 - 1
initfiles/componentfiles/configxml/@temp/esp_service_wslogging.xsl

@@ -11,7 +11,7 @@ xmlns:seisint="http://seisint.com"  xmlns:set="http://exslt.org/sets" exclude-re
         <xsl:variable name="bindType" select="'loggingservice_binding'"/>
         <xsl:variable name="servicePlugin">
             <xsl:choose>
-                <xsl:when test="$isLinuxInstance">libws_loggingservice.so</xsl:when>
+                <xsl:when test="$isLinuxInstance">ws_loggingservice</xsl:when>
                 <xsl:otherwise>ws_loggingservice.dll</xsl:otherwise>
             </xsl:choose>
         </xsl:variable>

+ 1 - 1
initfiles/componentfiles/configxml/esp.xsl

@@ -462,7 +462,7 @@
     <xsl:template name="makeServicePluginName">
         <xsl:param name="plugin"/>
         <xsl:choose>
-            <xsl:when test="$isLinuxInstance">lib<xsl:value-of select="$plugin"/>.so</xsl:when>
+            <xsl:when test="$isLinuxInstance"><xsl:value-of select="$plugin"/></xsl:when>
             <xsl:otherwise>
                 <xsl:value-of select="$plugin"/>.dll</xsl:otherwise>
         </xsl:choose>

+ 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 )

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

@@ -15,17 +15,27 @@
 #    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 )
 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 )
+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(NOT "${DESTDIR}" STREQUAL "")
+    message(STATUS "DESTDIR is set to ${DESTDIR}. Enabling configure target.")
+    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;