diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index 6476d542b6..eba41d3316 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -34,6 +34,7 @@ benchmarkName="taosBenchmark" dumpName="taosdump" demoName="taosdemo" xname="taosx" +keeperName="taoskeeper" clientName2="taos" serverName2="${clientName2}d" @@ -42,6 +43,7 @@ productName2="TDengine" emailName2="taosdata.com" xname2="${clientName2}x" adapterName2="${clientName2}adapter" +keeperName2="${clientName2}keeper" explorerName="${clientName2}-explorer" benchmarkName2="${clientName2}Benchmark" @@ -214,6 +216,7 @@ function install_bin() { ${csudo}rm -f ${bin_link_dir}/${demoName2} || : ${csudo}rm -f ${bin_link_dir}/${benchmarkName2} || : ${csudo}rm -f ${bin_link_dir}/${dumpName2} || : + ${csudo}rm -f ${bin_link_dir}/${keeperName2} || : ${csudo}rm -f ${bin_link_dir}/set_core || : ${csudo}rm -f ${bin_link_dir}/TDinsight.sh || : @@ -227,6 +230,7 @@ function install_bin() { [ -x ${install_main_dir}/bin/${benchmarkName2} ] && ${csudo}ln -sf ${install_main_dir}/bin/${benchmarkName2} ${bin_link_dir}/${demoName2} || : [ -x ${install_main_dir}/bin/${benchmarkName2} ] && ${csudo}ln -sf ${install_main_dir}/bin/${benchmarkName2} ${bin_link_dir}/${benchmarkName2} || : [ -x ${install_main_dir}/bin/${dumpName2} ] && ${csudo}ln -sf ${install_main_dir}/bin/${dumpName2} ${bin_link_dir}/${dumpName2} || : + [ -x ${install_main_dir}/bin/${keeperName2} ] && ${csudo}ln -sf ${install_main_dir}/bin/${keeperName2} ${bin_link_dir}/${keeperName2} || : [ -x ${install_main_dir}/bin/TDinsight.sh ] && ${csudo}ln -sf ${install_main_dir}/bin/TDinsight.sh ${bin_link_dir}/TDinsight.sh || : if [ "$clientName2" == "${clientName}" ]; then [ -x ${install_main_dir}/bin/remove.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/${uninstallScript} || : @@ -518,6 +522,23 @@ function install_adapter_config() { } +function install_keeper_config() { + if [ -f ${script_dir}/cfg/${keeperName2}.toml ]; then + ${csudo}sed -i -r "s/127.0.0.1/${serverFqdn}/g" ${script_dir}/cfg/${keeperName2}.toml + fi + if [ -f "${configDir}/keeper.toml" ]; then + echo "The file keeper.toml will be renamed to ${keeperName2}.toml" + ${csudo}cp ${script_dir}/cfg/${keeperName2}.toml ${configDir}/${keeperName2}.toml.new + ${csudo}mv ${configDir}/keeper.toml ${configDir}/${keeperName2}.toml + elif [ -f "${configDir}/${keeperName2}.toml" ]; then + # "taoskeeper.toml exists,new config is taoskeeper.toml.new" + ${csudo}cp ${script_dir}/cfg/${keeperName2}.toml ${configDir}/${keeperName2}.toml.new + else + ${csudo}cp ${script_dir}/cfg/${keeperName2}.toml ${configDir}/${keeperName2}.toml + fi + command -v systemctl >/dev/null 2>&1 && ${csudo}systemctl daemon-reload >/dev/null 2>&1 || true +} + function install_config() { if [ ! -f "${cfg_install_dir}/${configFile2}" ]; then @@ -914,6 +935,7 @@ function updateProduct() { install_adapter_service install_adapter_config install_keeper_service + install_keeper_config openresty_work=false @@ -1014,6 +1036,7 @@ function installProduct() { install_adapter_service install_adapter_config install_keeper_service + install_keeper_config openresty_work=false diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh index d3d72eed24..64facc9c3b 100755 --- a/packaging/tools/makepkg.sh +++ b/packaging/tools/makepkg.sh @@ -92,14 +92,10 @@ else ${build_dir}/bin/tdengine-datasource.zip.md5" fi - [ -f ${build_dir}/bin/taosx ] && taosx_bin="${build_dir}/bin/taosx" - explorer_bin_files=$(find ${build_dir}/bin/ -name '*-explorer') bin_files="${build_dir}/bin/${serverName} \ ${build_dir}/bin/${clientName} \ ${taostools_bin_files} \ - ${taosx_bin} \ - ${explorer_bin_files} \ ${build_dir}/bin/${clientName}adapter \ ${build_dir}/bin/udfd \ ${script_dir}/remove.sh \ @@ -375,9 +371,6 @@ if [ "$verMode" == "cluster" ]; then cp ${top_dir}/../enterprise/packaging/install_taosx.sh ${install_dir}/taosx cp ${top_dir}/../enterprise/src/plugins/taosx/packaging/uninstall.sh ${install_dir}/taosx sed -i 's/target=\"\"/target=\"taosx\"/g' ${install_dir}/taosx/uninstall.sh - else - echo "taox package not found" - exit 1 fi fi fi diff --git a/packaging/tools/remove.sh b/packaging/tools/remove.sh index 482b67ccfe..4ea4520d28 100755 --- a/packaging/tools/remove.sh +++ b/packaging/tools/remove.sh @@ -277,60 +277,11 @@ function remove_data_and_config() { if [ X"$log_dir" == X"" ]; then log_dir="/var/log/taos" fi - ${csudo}rm -rf ${config_dir}/* - ${csudo}rm -rf ${data_dir}/* - ${csudo}rm -rf ${log_dir}/* + [ -d "${config_dir}" ] && ${csudo}rm -rf ${config_dir}/* + [ -d "${data_dir}" ] && ${csudo}rm -rf ${data_dir}/* + [ -d "${log_dir}" ] && ${csudo}rm -rf ${log_dir}/* } -function uninstall_taosx() { - if [ -f ${installDir}/uninstall.sh ]; then - cd ${installDir} - bash uninstall.sh - fi -} - -if [ "$verMode" == "cluster" ]; then - uninstall_taosx -fi - -# Stop service and disable booting start. -clean_service -# Remove binary file and links -clean_bin -# Remove links of local bin -clean_local_bin -# Remove header file. -clean_header -# Remove lib file -clean_lib -# Remove link log directory -clean_log -# Remove link configuration file -clean_config -# Remove data link directory -${csudo}rm -rf ${data_link_dir} || : - -${csudo}rm -rf ${install_main_dir} -if [[ -e /etc/os-release ]]; then - osinfo=$(awk -F= '/^NAME/{print $2}' /etc/os-release) -else - osinfo="" -fi - -if echo $osinfo | grep -qwi "ubuntu"; then - # echo "this is ubuntu system" - ${csudo}dpkg --force-all -P tdengine >/dev/null 2>&1 || : -elif echo $osinfo | grep -qwi "debian"; then - # echo "this is debian system" - ${csudo}dpkg --force-all -P tdengine >/dev/null 2>&1 || : -elif echo $osinfo | grep -qwi "centos"; then - # echo "this is centos system" - ${csudo}rpm -e --noscripts tdengine >/dev/null 2>&1 || : -fi -if [ "$osType" = "Darwin" ]; then - ${csudo}rm -rf /Applications/TDengine.app -fi - _kill_service_of() { _service=$1 pid=$(ps -ef | grep "$_service" | grep -v "grep" | awk '{print $2}') @@ -391,10 +342,60 @@ remove_taoskeeper() { # remove taoskeeper bin _clean_service_of taoskeeper [ -e "${bin_link_dir}/taoskeeper" ] && ${csudo}rm -rf ${bin_link_dir}/taoskeeper + [ -e "${installDir}/taoskeeper" ] && ${csudo}rm -rf ${installDir}/taoskeeper [ -e "${cfg_link_dir}/metrics.toml" ] || ${csudo}rm -rf ${cfg_link_dir}/metrics.toml echo "taosKeeper is removed successfully!" } + +function uninstall_taosx() { + if [ -f ${installDir}/uninstall.sh ]; then + cd ${installDir} + bash uninstall.sh + fi +} + +if [ "$verMode" == "cluster" ]; then + uninstall_taosx +fi + remove_taoskeeper +# Stop service and disable booting start. +clean_service +# Remove binary file and links +clean_bin +# Remove links of local bin +clean_local_bin +# Remove header file. +clean_header +# Remove lib file +clean_lib +# Remove link log directory +clean_log +# Remove link configuration file +clean_config +# Remove data link directory +${csudo}rm -rf ${data_link_dir} || : + +${csudo}rm -rf ${install_main_dir} +if [[ -e /etc/os-release ]]; then + osinfo=$(awk -F= '/^NAME/{print $2}' /etc/os-release) +else + osinfo="" +fi + +if echo $osinfo | grep -qwi "ubuntu"; then + # echo "this is ubuntu system" + ${csudo}dpkg --force-all -P tdengine >/dev/null 2>&1 || : +elif echo $osinfo | grep -qwi "debian"; then + # echo "this is debian system" + ${csudo}dpkg --force-all -P tdengine >/dev/null 2>&1 || : +elif echo $osinfo | grep -qwi "centos"; then + # echo "this is centos system" + ${csudo}rpm -e --noscripts tdengine >/dev/null 2>&1 || : +fi +if [ "$osType" = "Darwin" ]; then + ${csudo}rm -rf /Applications/TDengine.app +fi echo echo "Do you want to remove all the data, log and configuration files? [y/n]"