Skip to content

Commit

Permalink
Merge pull request #23345 from taosdata/packaging/TD-26786
Browse files Browse the repository at this point in the history
TD-26786: update script
  • Loading branch information
DuanKuanJun committed Oct 19, 2023
2 parents bffd1f7 + 528f3c8 commit 8460ac9
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 16 deletions.
31 changes: 15 additions & 16 deletions packaging/tools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ interactiveFqdn=yes # [yes | no]
verType=server # [server | client]
initType=systemd # [systemd | service | ...]

while getopts "hv:e:i:" arg; do
while getopts "hv:e:" arg; do
case $arg in
e)
#echo "interactiveFqdn=$OPTARG"
Expand All @@ -164,10 +164,6 @@ while getopts "hv:e:i:" arg; do
#echo "verType=$OPTARG"
verType=$(echo $OPTARG)
;;
i)
#echo "initType=$OPTARG"
initType=$(echo $OPTARG)
;;
h)
echo "Usage: $(basename $0) -v [server | client] -e [yes | no]"
exit 0
Expand Down Expand Up @@ -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}"
read newHostname
while true; do
if [[ ! -z "$newHostname" && "$newHostname" != "localhost" ]]; then
if [ -z "$newHostname" ]; then
newHostname=$(hostname)
break
elif [ "$newHostname" != "localhost" ]; then
break
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}"
Expand Down Expand Up @@ -518,9 +517,7 @@ function install_adapter_config() {

}

function install_config() {

local_fqdn_check
function install_config() {

if [ ! -f "${cfg_install_dir}/${configFile2}" ]; then
${csudo}mkdir -p ${cfg_install_dir}
Expand All @@ -542,13 +539,15 @@ function install_config() {



# if ((${update_flag} == 1)); then
# return 0
# fi
if ((${update_flag} == 1)); then
return 0
fi

# if [ "$interactiveFqdn" == "no" ]; then
# return 0
# fi
if [ "$interactiveFqdn" == "no" ]; then
return 0
fi

local_fqdn_check

echo
echo -e -n "${GREEN}Enter FQDN:port (like h1.${emailName2}:6030) of an existing ${productName2} cluster node to join${NC}"
Expand Down Expand Up @@ -1073,7 +1072,7 @@ function installProduct() {
echo -e "\033[44;32;1mTo access ${productName2} : ${clientName2} -h $serverFqdn${NC}"
if [ "$verMode" == "cluster" ];then
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
echo
else # Only install client
Expand Down
26 changes: 26 additions & 0 deletions packaging/tools/remove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ service_config_dir="/etc/systemd/system"
taos_service_name=${serverName2}
taosadapter_service_name="${clientName2}adapter"
tarbitrator_service_name="tarbitratord"

config_dir="/etc/${clientName2}"


csudo=""
if command -v sudo >/dev/null; then
csudo="sudo "
Expand Down Expand Up @@ -264,6 +268,20 @@ function clean_service() {
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() {
if [ -f /usr/local/taosx/uninstall.sh ]; then
cd /usr/local/taosx
Expand Down Expand Up @@ -374,6 +392,14 @@ 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
uninstall_taosx
fi
Expand Down

0 comments on commit 8460ac9

Please sign in to comment.