diff --git a/build/cmake/centos7-test/Dockerfile b/build/cmake/centos7-test/Dockerfile index f31bc703ec..2be4b61f06 100644 --- a/build/cmake/centos7-test/Dockerfile +++ b/build/cmake/centos7-test/Dockerfile @@ -1,3 +1,3 @@ FROM centos:7 -RUN yum install -y yum-utils systemd +RUN yum install -y yum-utils systemd sysvinit-tools diff --git a/cmake/InstallLayout.cmake b/cmake/InstallLayout.cmake index 980622cc04..d54fc9cec9 100644 --- a/cmake/InstallLayout.cmake +++ b/cmake/InstallLayout.cmake @@ -277,7 +277,7 @@ set(CPACK_RPM_SERVER-EL7_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/packaging/rpm/scripts/preserver.sh) set(CPACK_RPM_SERVER-EL6_POST_INSTALL_SCRIPT_FILE - ${CMAKE_SOURCE_DIR}/packaging/rpm/scripts/postserver.sh) + ${CMAKE_SOURCE_DIR}/packaging/rpm/scripts/postserver-el6.sh) set(CPACK_RPM_SERVER-EL7_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/packaging/rpm/scripts/postserver.sh) diff --git a/packaging/rpm/scripts/postserver-el6.sh b/packaging/rpm/scripts/postserver-el6.sh new file mode 100644 index 0000000000..e5114049b3 --- /dev/null +++ b/packaging/rpm/scripts/postserver-el6.sh @@ -0,0 +1,20 @@ +if [ $1 -eq 1 ]; then + if [ ! -f /etc/foundationdb/fdb.cluster ]; then + description=$(LC_CTYPE=C tr -dc A-Za-z0-9 < /dev/urandom | head -c 8) + random_str=$(LC_CTYPE=C tr -dc A-Za-z0-9 < /dev/urandom | head -c 8) + echo $description:$random_str@127.0.0.1:4500 > /etc/foundationdb/fdb.cluster + chown foundationdb:foundationdb /etc/foundationdb/fdb.cluster + chmod 0664 /etc/foundationdb/fdb.cluster + NEWDB=1 + fi + + /sbin/chkconfig --add foundationdb >/dev/null 2>&1 + /sbin/service foundationdb start >/dev/null 2>&1 + + if [ "$NEWDB" != "" ]; then + /usr/bin/fdbcli -C /etc/foundationdb/fdb.cluster --exec "configure new single memory" --timeout 20 >/dev/null 2>&1 + fi +else + /sbin/service foundationdb condrestart >/dev/null 2>&1 +fi +exit 0 diff --git a/packaging/rpm/scripts/postserver.sh b/packaging/rpm/scripts/postserver.sh index 9fe2ee1e12..cad72803e3 100644 --- a/packaging/rpm/scripts/postserver.sh +++ b/packaging/rpm/scripts/postserver.sh @@ -3,30 +3,19 @@ if [ $1 -eq 1 ]; then description=$(LC_CTYPE=C tr -dc A-Za-z0-9 < /dev/urandom | head -c 8) random_str=$(LC_CTYPE=C tr -dc A-Za-z0-9 < /dev/urandom | head -c 8) echo $description:$random_str@127.0.0.1:4500 > /etc/foundationdb/fdb.cluster - chown foundationdb:foundationdb /etc/foundationdb/fdb.cluster + chown foundationdb:foundationdb /etc/foundationdb/fdb.cluster chmod 0664 /etc/foundationdb/fdb.cluster NEWDB=1 fi - if pidof systemd > /dev/null - then - /usr/bin/systemctl enable foundationdb >/dev/null 2>&1 - /usr/bin/systemctl start foundationdb >/dev/null 2>&1 - else - /sbin/chkconfig --add foundationdb >/dev/null 2>&1 - /sbin/service foundationdb start >/dev/null 2>&1 - fi + /usr/bin/systemctl enable foundationdb >/dev/null 2>&1 + /usr/bin/systemctl start foundationdb >/dev/null 2>&1 if [ "$NEWDB" != "" ]; then /usr/bin/fdbcli -C /etc/foundationdb/fdb.cluster --exec "configure new single memory" --timeout 20 >/dev/null 2>&1 fi else - if pidof systemd > /dev/null - then - /usr/bin/systemctl condrestart foundationdb >/dev/null 2>&1 - else - /sbin/service foundationdb condrestart >/dev/null 2>&1 - fi + /usr/bin/systemctl condrestart foundationdb >/dev/null 2>&1 fi exit 0