Merge pull request #23345 from taosdata/packaging/TD-26786

TD-26786: update script
This commit is contained in:
Alex Duan 2023-10-19 06:03:36 -05:00 committed by GitHub
commit 8460ac9ef3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 41 additions and 16 deletions

View File

@ -154,7 +154,7 @@ interactiveFqdn=yes # [yes | no]
verType=server # [server | client] verType=server # [server | client]
initType=systemd # [systemd | service | ...] initType=systemd # [systemd | service | ...]
while getopts "hv:e:i:" arg; do while getopts "hv:e:" arg; do
case $arg in case $arg in
e) e)
#echo "interactiveFqdn=$OPTARG" #echo "interactiveFqdn=$OPTARG"
@ -164,10 +164,6 @@ while getopts "hv:e:i:" arg; do
#echo "verType=$OPTARG" #echo "verType=$OPTARG"
verType=$(echo $OPTARG) verType=$(echo $OPTARG)
;; ;;
i)
#echo "initType=$OPTARG"
initType=$(echo $OPTARG)
;;
h) h)
echo "Usage: $(basename $0) -v [server | client] -e [yes | no]" echo "Usage: $(basename $0) -v [server | client] -e [yes | no]"
exit 0 exit 0
@ -385,7 +381,10 @@ function set_hostname() {
echo -e -n "${GREEN}Enter the public accessible IP address or fully qualified domain name TDengine will expose to users or applications (must not be 'localhost') :${NC}" echo -e -n "${GREEN}Enter the public accessible IP address or fully qualified domain name TDengine will expose to users or applications (must not be 'localhost') :${NC}"
read newHostname read newHostname
while true; do while true; do
if [[ ! -z "$newHostname" && "$newHostname" != "localhost" ]]; then if [ -z "$newHostname" ]; then
newHostname=$(hostname)
break
elif [ "$newHostname" != "localhost" ]; then
break break
else else
echo -e -n "${GREEN}Enter the public accessible IP address or fully qualified domain name TDengine will expose to users or applications (must not be 'localhost') :${NC}" echo -e -n "${GREEN}Enter the public accessible IP address or fully qualified domain name TDengine will expose to users or applications (must not be 'localhost') :${NC}"
@ -518,9 +517,7 @@ function install_adapter_config() {
} }
function install_config() { function install_config() {
local_fqdn_check
if [ ! -f "${cfg_install_dir}/${configFile2}" ]; then if [ ! -f "${cfg_install_dir}/${configFile2}" ]; then
${csudo}mkdir -p ${cfg_install_dir} ${csudo}mkdir -p ${cfg_install_dir}
@ -542,13 +539,15 @@ function install_config() {
# if ((${update_flag} == 1)); then if ((${update_flag} == 1)); then
# return 0 return 0
# fi fi
# if [ "$interactiveFqdn" == "no" ]; then if [ "$interactiveFqdn" == "no" ]; then
# return 0 return 0
# fi fi
local_fqdn_check
echo echo
echo -e -n "${GREEN}Enter FQDN:port (like h1.${emailName2}:6030) of an existing ${productName2} cluster node to join${NC}" echo -e -n "${GREEN}Enter FQDN:port (like h1.${emailName2}:6030) of an existing ${productName2} cluster node to join${NC}"
@ -1073,7 +1072,7 @@ function installProduct() {
echo -e "\033[44;32;1mTo access ${productName2} : ${clientName2} -h $serverFqdn${NC}" echo -e "\033[44;32;1mTo access ${productName2} : ${clientName2} -h $serverFqdn${NC}"
if [ "$verMode" == "cluster" ];then if [ "$verMode" == "cluster" ];then
echo -e "\033[44;32;1mTo access the management system : http://$serverFqdn:6060${NC}" echo -e "\033[44;32;1mTo access the management system : http://$serverFqdn:6060${NC}"
echo -e "\033[44;32;1mTo read the user manual : http://$serverFqdn:6060/docs${NC}" echo -e "\033[44;32;1mTo read the user manual : http://$serverFqdn:6060/docs-en${NC}"
fi fi
echo echo
else # Only install client else # Only install client

View File

@ -63,6 +63,10 @@ service_config_dir="/etc/systemd/system"
taos_service_name=${serverName2} taos_service_name=${serverName2}
taosadapter_service_name="${clientName2}adapter" taosadapter_service_name="${clientName2}adapter"
tarbitrator_service_name="tarbitratord" tarbitrator_service_name="tarbitratord"
config_dir="/etc/${clientName2}"
csudo="" csudo=""
if command -v sudo >/dev/null; then if command -v sudo >/dev/null; then
csudo="sudo " csudo="sudo "
@ -264,6 +268,20 @@ function clean_service() {
fi fi
} }
function remove_data_and_config() {
data_dir=`grep dataDir /etc/taos/taos.cfg | grep -v '#' | tail -n 1 | awk {'print $2'}`
if [ X"$data_dir" == X"" ]; then
data_dir="/var/lib/taos"
fi
log_dir=`grep logDir /etc/taos/taos.cfg | grep -v '#' | tail -n 1 | awk {'print $2'}`
if [ X"$log_dir" == X"" ]; then
log_dir="/var/lib/taos"
fi
${csudo}rm -rf ${config_dir}/*
${csudo}rm -rf ${data_dir}/*
${csudo}rm -rf ${log_dir}/*
}
function uninstall_taosx() { function uninstall_taosx() {
if [ -f /usr/local/taosx/uninstall.sh ]; then if [ -f /usr/local/taosx/uninstall.sh ]; then
cd /usr/local/taosx cd /usr/local/taosx
@ -374,6 +392,14 @@ remove_taoskeeper() {
} }
remove_taoskeeper remove_taoskeeper
echo
echo "Do you want to remove all the data, log and configuration files? [y/n]"
read answer
if [ X$answer == X"y" ] || [ X$answer == X"Y" ]; then
remove_data_and_config
fi
if [ "$verMode" == "cluster" ]; then if [ "$verMode" == "cluster" ]; then
uninstall_taosx uninstall_taosx
fi fi