#!/bin/bash
# Author:  EinicYeo <einicyeo AT gmail.com>
# BLOG:  https://www.infvie.com
#
# Notes: EnvoyinStack for CentOS/RedHat 6+

export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
clear
printf "
#######################################################################
#                Author:  EinicYeo <einicyeo AT gmail.com>            #
#                    EnvoyinStack for CentOS/RedHat 6+                #
#                         Uninstall EnvoyinStack                      #
#      For more information please visit https://www.infvie.com       #
#######################################################################
"
# Check if user is root
[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }

envoyinstack_dir=$(dirname "`readlink -f $0`")
pushd ${envoyinstack_dir} > /dev/null
. ./config/options.conf
. ./include/color.sh
. ./include/get_char.sh
. ./include/check_dir.sh

Show_Help() {
  echo
  echo "Usage: $0  command ...[parameters]....
  --help, -h                    Show this help message
  --quiet, -q                   quiet operation
  --all                         Uninstall All
  --web                         Uninstall Nginx/OpenResty/Tomcat
  --mysql                       Uninstall MySQL/MariaDB/Percona/AliSQL
  --postgresql                  Uninstall PostgreSQL
  --mongodb                     Uninstall MongoDB
  --redis                       Uninstall Redis-server
  --rabbitmq                    Uninstall Rabbitmq-server
  --fastdfs                     Uninstall Fastdfs and fastdht
  --proxysql                    Uninstall ProxySQL
  --kong                        Uninstall Gateway kong server and konga
  --python                      Uninstall Python (PATH: ${python_install_dir})
  --elasticstack                Uninstall Elasticstack
  --powerline                   Uninstall Powerline
  "
}

ARG_NUM=$#
TEMP=`getopt -o hvVq --long help,version,quiet,all,web,mysql,postgresql,mongodb,redis,rabbitmq,fastdfs,proxysql,kong,python,elasticstack,powerline -- "$@" 2>/dev/null`
[ $? != 0 ] && echo "${CWARNING}ERROR: unknown argument! ${CEND}" && Show_Help && exit 1
eval set -- "${TEMP}"
while :; do
  [ -z "$1" ] && break;
  case "$1" in
    -h|--help)
      Show_Help; exit 0
      ;;
    -q|--quiet)
      quiet_flag=y
      uninstall_flag=y
      shift 1
      ;;
    --all)
      all_flag=y
      web_flag=y
      mysql_flag=y
      postgresql_flag=y
      mongodb_flag=y
      redis_flag=y
      rabbitmq_flag=y
      proxysql_flag=y
      kong_flag=y
      python_flag=y
      elasticstack_flag=y
      powerline_flag=y
      shift 1
      ;;
    --web)
      web_flag=y; shift 1
      ;;
    --mysql)
      mysql_flag=y; shift 1
      ;;
    --postgresql)
      postgresql_flag=y; shift 1
      ;;
    --mongodb)
      mongodb_flag=y; shift 1
      ;;
    --redis)
      redis_flag=y; shift 1
      ;;
    --rabbitmq)
      rabbitmq_flag=y; shift 1
      ;;
    --fastdfs)
      fastdfs_flag=y; shift 1
      ;;
    --proxysql)
      proxysql_flag=y; shift 1
      ;;
    --kong)
      kong_flag=y; shift 1
      ;;
    --python)
      python_flag=y; shift 1
      ;;
    --elasticstack)
      elasticstack_flag=y; shift 1
      ;;
    --powerline)
      powerline_flag=y; shift 1
      ;;
    --)
      shift
      ;;
    *)
      echo "${CWARNING}ERROR: unknown argument! ${CEND}" && Show_Help && exit 1
      ;;
  esac
done

Uninstall_status() {
  if [ "${quiet_flag}" != 'y' ]; then
    while :; do echo
      read -e -p "Do you want to uninstall? [y/n]: " uninstall_flag
      if [[ ! ${uninstall_flag} =~ ^[y,n]$ ]]; then
        echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
      else
        break
      fi
    done
  fi
}

Print_Warn() {
  echo
  echo "${CWARNING}You will uninstall EnvoyinStack, Please backup your configure files and DB data! ${CEND}"
}

Print_web() {
  [ -d "${nginx_install_dir}" ] && echo ${nginx_install_dir}
  [ -d "${openresty_install_dir}" ] && echo ${openresty_install_dir}
  [ -e "/etc/init.d/nginx" ] && echo /etc/init.d/nginx
  [ -e "/lib/systemd/system/nginx.service" ] && echo /lib/systemd/system/nginx.service
  [ -e "/etc/logrotate.d/nginx" ] && echo /etc/logrotate.d/nginx

  [ -d "${tomcat_install_dir}" ] && echo ${tomcat_install_dir}
  [ -e "/etc/init.d/tomcat" ] && echo /etc/init.d/tomcat
  [ -e "/etc/logrotate.d/tomcat" ] && echo /etc/logrotate.d/tomcat
  [ -d "/usr/java" ] && echo /usr/java
  [ -d "${apr_install_dir}" ] && echo ${apr_install_dir}
}

Uninstall_Web() {
  [ -d "${nginx_install_dir}" ] && { killall nginx > /dev/null 2>&1; rm -rf ${nginx_install_dir} /etc/init.d/nginx /etc/logrotate.d/nginx; sed -i "s@${nginx_install_dir}/sbin:@@" /etc/profile; echo "${CMSG}Nginx uninstall completed! ${CEND}"; }
  [ -d "${openresty_install_dir}" ] && { killall nginx > /dev/null 2>&1; rm -rf ${openresty_install_dir} /etc/init.d/nginx /etc/logrotate.d/nginx; sed -i "s@${openresty_install_dir}/nginx/sbin:@@" /etc/profile; echo "${CMSG}OpenResty uninstall completed! ${CEND}"; }
  [ -e "/lib/systemd/system/nginx.service" ] && { systemctl disable nginx > /dev/null 2>&1; rm -f /lib/systemd/system/nginx.service; }
  [ -d "${tomcat_install_dir}" ] && { killall java > /dev/null 2>&1; rm -rf ${tomcat_install_dir} /etc/init.d/tomcat /etc/logrotate.d/tomcat; echo "${CMSG}Tomcat uninstall completed! ${CEND}"; }
  [ -d "/usr/java" ] && { rm -rf /usr/java; sed -i '/export JAVA_HOME=/d' /etc/profile; sed -i '/export CLASSPATH=/d' /etc/profile; sed -i 's@\$JAVA_HOME/bin:@@' /etc/profile; }
  [ -e "${wwwroot_dir}" ] && /bin/mv ${wwwroot_dir}{,$(date +%Y%m%d%H)}
  sed -i 's@^website_name=.*@website_name=@' ./config/options.conf
  sed -i 's@^backup_content=.*@backup_content=@' ./config/options.conf
  [ -d "${apr_install_dir}" ] && rm -rf ${apr_install_dir}
}

Print_MySQL() {
  [ -e "${db_install_dir}" ] && echo ${db_install_dir}
  [ -e "/etc/init.d/mysqld" ] && echo /etc/init.d/mysqld
  [ -e "/etc/my.cnf" ] && echo /etc/my.cnf
}

Print_PostgreSQL() {
  [ -e "${pgsql_install_dir}" ] && echo ${pgsql_install_dir}
  [ -e "/etc/init.d/postgresql" ] && echo /etc/init.d/postgresql
  [ -e "/lib/systemd/system/postgresql.service" ] && echo /lib/systemd/system/postgresql.service
}

Print_MongoDB() {
  [ -e "${mongo_install_dir}" ] && echo ${mongo_install_dir}
  [ -e "/etc/init.d/mongod" ] && echo /etc/init.d/mongod
  [ -e "/lib/systemd/system/mongod.service" ] && echo /lib/systemd/system/mongod.service
  [ -e "/etc/mongod.conf" ] && echo /etc/mongod.conf
}

Uninstall_MySQL() {
  # uninstall mysql,mariadb
  if [ -d "${db_install_dir}/support-files" ]; then
    service mysqld stop > /dev/null 2>&1
    rm -rf ${db_install_dir} /etc/init.d/mysqld /etc/my.cnf* /etc/ld.so.conf.d/*{mysql,mariadb}*.conf
    id -u mysql >/dev/null 2>&1 ; [ $? -eq 0 ] && userdel mysql
    [ -e "${db_data_dir}" ] && /bin/mv ${db_data_dir}{,$(date +%Y%m%d%H)}
    sed -i 's@^dbrootpwd=.*@dbrootpwd=@' ./config/options.conf
    sed -i "s@${db_install_dir}/bin:@@" /etc/profile
    echo "${CMSG}MySQL uninstall completed! ${CEND}"
  fi
}

Uninstall_PostgreSQL() {
  # uninstall postgresql
  if [ -e "${pgsql_install_dir}/bin/psql" ]; then
    service postgresql stop > /dev/null 2>&1
    rm -rf ${pgsql_install_dir} /etc/init.d/postgresql
    [ -e "/lib/systemd/system/postgresql.service" ] && { systemctl disable postgresql > /dev/null 2>&1; rm -f /lib/systemd/system/postgresql.service; }
    id -u postgres >/dev/null 2>&1 ; [ $? -eq 0 ] && userdel postgres
    [ -e "${pgsql_data_dir}" ] && /bin/mv ${pgsql_data_dir}{,$(date +%Y%m%d%H)}
    sed -i 's@^dbpostgrespwd=.*@dbpostgrespwd=@' ./config/options.conf
    sed -i "s@${pgsql_install_dir}/bin:@@" /etc/profile
    echo "${CMSG}PostgreSQL uninstall completed! ${CEND}"
  fi
}

Uninstall_MongoDB() {
  # uninstall mongodb
  if [ -e "${mongo_install_dir}/bin/mongo" ]; then
    service mongod stop > /dev/null 2>&1
    rm -rf ${mongo_install_dir} /etc/mongod.conf /etc/init.d/mongod /tmp/mongo*.sock
    [ -e "/lib/systemd/system/mongod.service" ] && { systemctl disable mongod > /dev/null 2>&1; rm -f /lib/systemd/system/mongod.service; }
    id -u mongod > /dev/null 2>&1 ; [ $? -eq 0 ] && userdel mongod
    [ -e "${mongo_data_dir}" ] && /bin/mv ${mongo_data_dir}{,$(date +%Y%m%d%H)}
    sed -i 's@^dbmongopwd=.*@dbmongopwd=@' ./config/options.conf
    sed -i "s@${mongo_install_dir}/bin:@@" /etc/profile
    echo "${CMSG}MongoDB uninstall completed! ${CEND}"
  fi
}

Print_Redis_server() {
  [ -e "${redis_install_dir}" ] && echo ${redis_install_dir}
  [ -e "/etc/init.d/redis-server" ] && echo /etc/init.d/redis-server
  [ -e "/lib/systemd/system/redis-server.service" ] && echo /lib/systemd/system/redis-server.service
}

Uninstall_Redis_server() {
  [ -e "${redis_install_dir}" ] && { service redis-server stop > /dev/null 2>&1; rm -rf ${redis_install_dir} /etc/init.d/redis-server /usr/local/bin/redis-*; echo "${CMSG}Redis uninstall completed! ${CEND}"; }
  [ -e "/lib/systemd/system/redis-server.service" ] && { systemctl disable redis-server > /dev/null 2>&1; rm -f /lib/systemd/system/redis-server.service; }
}

Print_Rabbitmq_server() {
  [ -e "${rabbitmq_install_dir}" ] && echo ${rabbitmq_install_dir}
  [ -e "/etc/init.d/rabbitmq-server" ] && echo /etc/init.d/rabbitmq-server
  [ -e "/lib/systemd/system/rabbitmq-server.service" ] && echo /lib/systemd/system/rabbitmq-server.service
}

Uninstall_Rabbitmq_server() {
  [ -e "/root/.erlang.cookie" ] && { rm -rf /root/.erlang.cookie; }
  [ -e "${rabbitmq_install_dir}" ] && { service rabbitmq-server stop > /dev/null 2>&1; rm -rf ${rabbitmq_install_dir} /etc/init.d/rabbitmq-server /home/rabbitmq /data/rabbitmq /usr/sbin/rabbitmq* /usr/sbin/cuttlefish /etc/rabbitmq* /var/lib/rabbitmq*; echo "${CMSG}Rabbitmq uninstall completed! ${CEND}"; }
  [ -e "/lib/systemd/system/rabbitmq-server.service" ] && { systemctl disable rabbitmq-server > /dev/null 2>&1; rm -f /lib/systemd/system/rabbitmq-server.service; }
}

Print_Fastdfs(){
 [ -e "/etc/init.d/fdfs_trackerd" ] && echo /etc/init.d/fdfs_trackerd
 [ -e "/etc/init.d/fdfs_storaged" ] && echo /etc/init.d/fdfs_storaged
 [ -e "/usr/local/bin/fdhtd" ] && echo /usr/local/bin/fdhtd
 [ -e "/usr/local/berkeleydb" ] && echo /usr/local/berkeleydb
 [ -d "/data/fastDFS/" ] && echo /data/fastDFS
}
Uninstall_Fastdfs() {
  [ -e "/etc/init.d/fdfs_trackerd" ] && { killall fdfs_trackerd > /dev/null 2>&1; rm -f /etc/init.d/fdfs_trackerd; }
  [ -e "/etc/init.d/fdfs_storaged" ] && { killall fdfs_storaged > /dev/null 2>&1; rm -f /etc/init.d/fdfs_storaged; }
  [ -e "/usr/local/bin/fdhtd" ] && { killall fdhtd > /dev/null 2>&1; rm -f /etc/init.d/fdhtd /usr/local/bin/fdhtd; echo "${CMSG}FastDHT uninstall completed! ${CEND}"; }
  [ -d "/usr/local/berkeleydb" ] && { rm -rf /usr/local/berkeleydb; echo "${CMSG}Berkeleydb uninstall completed! ${CEND}"; }
  [ -d "${nginx_install_dir}" ] && { killall nginx > /dev/null 2>&1; rm -rf ${nginx_install_dir} /etc/init.d/nginx /etc/logrotate.d/nginx; sed -i "s@${nginx_install_dir}/sbin:@@" /etc/profile; echo "${CMSG}Nginx uninstall completed! ${CEND}"; }
  [ -d "/data/fastDFS/" ] && { rm -rf /usr/include/fast* /etc/fdfs* /etc/fdht* /usr/local/include/fast* /usr/local/lib/libfdht* /usr/lib/libfdht* /usr/lib/libdb-18.1.so; echo "${CMSG}FastDFS uninstall completed! ${CEND}"; }
}

Print_Proxysql(){
 [ -e "/data/proxysql" ] && echo /data/proxysql
 [ -e "/etc/proxysql.cnf" ] && echo /etc/proxysql.cnf
}

Uninstall_Proxysql(){
 [ -e "/etc/proxysql.cnf" ] && { rpm -qa|grep proxysql|xargs rpm -e >/dev/null 2>&1; rm -f /etc/proxysql.cnf* /usr/bin/proxysql /etc/logrotate.d/proxysql; }
 [ -e "/data/proxysql" ] && { killall proxysql > /dev/null 2>&1; rm -rf /data/proxysql /usr/share/proxysql /var/lib/proxysql /run/proxysql;echo "${CMSG}ProxySql uninstall completed! ${CEND}"; }
}

Print_Kong() {
  [ -e "${pgsql_install_dir}" ] && echo ${pgsql_install_dir}
  [ -e "${node_install_dir}" ] && echo ${node_install_dir}
  [ -e "/usr/local/konga" ] && echo /usr/local/konga
  [ -e "/usr/local/kong" ] && echo /usr/local/kong
  [ -e "/etc/kong/kong.conf" ] && echo /etc/kong/kong.conf
}

Uninstall_Kong() {
  # uninstall postgresql
  if [ -e "${pgsql_install_dir}/bin/psql" ]; then
    service postgresql stop > /dev/null 2>&1
    rm -rf ${pgsql_install_dir} /etc/init.d/postgresql /data/pgsql*
    [ -e "/lib/systemd/system/postgresql.service" ] && { systemctl disable postgresql > /dev/null 2>&1; rm -f /lib/systemd/system/postgresql.service; }
    id -u postgres >/dev/null 2>&1 ; [ $? -eq 0 ] && userdel postgres
    [ -e "${pgsql_data_dir}" ] && /bin/mv ${pgsql_data_dir}{,$(date +%Y%m%d%H)}
    sed -i 's@^dbpostgrespwd=.*@dbpostgrespwd=@' ./config/options.conf
    sed -i "s@${pgsql_install_dir}/bin:@@" /etc/profile
    echo "${CMSG}PostgreSQL uninstall completed! ${CEND}"
  fi
  
  # uninstall kong
  if [ -e "/usr/local/kong" ];then
    systemctl stop kong.service > /dev/null 2>&1
    yum -y remove kong > /dev/null 2>&1
    [ -e "/usr/local/kong" ] && rm -rf /usr/local/kong /usr/local/openresty /etc/kong > /dev/null 2>&1
    echo "${CMSG}Kong uninstall completed! ${CEND}"
  fi
  
  # uninstall konga
  if [ -e "/usr/local/konga" ];then
     ${node_install_dir}/bin/pm2 stop app.js --name konga > /dev/null 2>&1
     ${node_install_dir}/bin/pm2 delete konga > /dev/null 2>&1
     rm -rf /usr/local/konga
     echo "${CMSG}Konga uninstall completed! ${CEND}"
  fi
  
  # uninstall node
  if [ -e "${node_install_dir}" ];then
     rm -rf ${node_install_dir}
     echo "${CMSG}Node uninstall completed! ${CEND}"
  fi
}

Print_openssl() {
  [ -d "${openssl_install_dir}" ] && echo ${openssl_install_dir}
}

Uninstall_openssl() {
  [ -d "${openssl_install_dir}" ] && rm -rf ${openssl_install_dir}
}

Print_Python() {
  [ -d "${python_install_dir}" ] && echo ${python_install_dir}
}

Print_Elasticstack() {
  [ -f "/usr/local/elasticsearch/bin/elasticsearch" ] && echo "/usr/local/elasticsearch/bin/elasticsearch"
  [ -f "/usr/local/kibana/bin/kibana" ] && echo "/usr/local/kibana/bin/kibana"
}

Print_Powerline() {
    [ -e "/usr/local/bin/powerline" ] && echo "/usr/local/bin/powerline"
}

Menu() {
while :; do
  printf "
What Are You Doing?
\t${CMSG} 0${CEND}. Uninstall All
\t${CMSG} 1${CEND}. Uninstall Nginx/OpenResty/Tomcat
\t${CMSG} 2${CEND}. Uninstall MySQL/MariaDB
\t${CMSG} 3${CEND}. Uninstall PostgreSQL
\t${CMSG} 4${CEND}. Uninstall MongoDB
\t${CMSG} 5${CEND}. Uninstall Redis
\t${CMSG} 6${CEND}. Uninstall Rabbitmq
\t${CMSG} 7${CEND}. Uninstall Fastdfs
\t${CMSG} 8${CEND}. Uninstall Proxysql
\t${CMSG} 9${CEND}. Uninstall Kong/Konga
\t${CMSG} 10${CEND}. Uninstall Python (PATH: ${python_install_dir})
\t${CMSG} 11${CEND}. Uninstall Elasticstack 
\t${CMSG} 12${CEND}. Uninstall Powerline 
\t${CMSG} q${CEND}. Exit
"
  echo
  read -e -p "Please input the correct option: " Number
  if [[ ! "${Number}" =~ ^[0-9,q]$|^1[0-2]$ ]]; then
    echo "${CWARNING}input error! Please only input 0~12 and q${CEND}"
  else
    case "$Number" in
    0)
      Print_Warn
      Print_web
      Print_MySQL
      Print_PostgreSQL
      Print_MongoDB
      Print_Redis_server
      Print_Rabbitmq_server
      Print_Fastdfs
      Print_Proxysql
      Print_Kong
      Print_openssl
      Print_Python
      Print_Elasticstack
      Print_Powerline
      Uninstall_status
      if [ "${uninstall_flag}" == 'y' ]; then
        Uninstall_Web
        Uninstall_MySQL
        Uninstall_PostgreSQL
        Uninstall_MongoDB
        Uninstall_Redis_server
        Uninstall_Rabbitmq_server
        Uninstall_Fastdfs
        Uninstall_Proxysql
        Uninstall_Kong
        Uninstall_openssl
        . include/python.sh; Uninstall_Python
      else
        exit
      fi
      ;;
    1)
      Print_Warn
      Print_web
      Uninstall_status
      [ "${uninstall_flag}" == 'y' ] && Uninstall_Web || exit
      ;;
    2)
      Print_Warn
      Print_MySQL
      Uninstall_status
      [ "${uninstall_flag}" == 'y' ] && Uninstall_MySQL || exit
      ;;
    3)
      Print_Warn
      Print_PostgreSQL
      Uninstall_status
      [ "${uninstall_flag}" == 'y' ] && Uninstall_PostgreSQL || exit
      ;;
    4)
      Print_Warn
      Print_MongoDB
      Uninstall_status
      [ "${uninstall_flag}" == 'y' ] && Uninstall_MongoDB || exit
      ;;
    5)
      Print_Redis_server
      Uninstall_status
      [ "${uninstall_flag}" == 'y' ] && Uninstall_Redis_server || exit
      ;;
    6)
      Print_Rabbitmq_server
      Uninstall_status
      [ "${uninstall_flag}" == 'y' ] && Uninstall_Rabbitmq_server || exit
      ;;
    7)
      Print_Fastdfs
      Uninstall_status
      [ "${uninstall_flag}" == 'y' ] && Uninstall_Fastdfs || exit
      ;;
    8)
      Print_Proxysql
      Uninstall_status
      [ "${uninstall_flag}" == 'y' ] && Uninstall_Proxysql || exit
      ;;
    9)Print_Kong
      Uninstall_status
      [ "${uninstall_flag}" == 'y' ] && Uninstall_Kong || exit
     ;;
    10)
      Print_Python
      Uninstall_status
      [ "${uninstall_flag}" == 'y' ] && { . include/python.sh; Uninstall_Python; } || exit
      ;;
    11)
      Print_Elasticstack
      Uninstall_status
      [ "${uninstall_flag}" == 'y' ] && { . include/elasticstack.sh; Uninstall_Elasticstack; } || exit
      ;;
    12)
      Print_Powerline
      Uninstall_status
      [ "${uninstall_flag}" == 'y' ] && { . include/powerline.sh; Uninstall_Powerline; } || exit
      ;;
    q)
      exit
      ;;
    esac
  fi
done
}

if [ ${ARG_NUM} == 0 ]; then
  Menu
else
  [ "${web_flag}" == 'y' ] && Print_web
  [ "${mysql_flag}" == 'y' ] && Print_MySQL
  [ "${postgresql_flag}" == 'y' ] && Print_PostgreSQL
  [ "${mongodb_flag}" == 'y' ] && Print_MongoDB
  [ "${redis_flag}" == 'y' ] && Print_Redis_server
  [ "${rabbitmq_flag}" == 'y' ] && Print_Rabbitmq_server
  [ "${fastdfs_flag}" == 'y' ] && Print_Fastdfs
  [ "${proxysql_flag}" == 'y' ] && Print_Proxysql
  [ "${kong_flag}" == 'y' ] && Print_Kong
  [ "${python_flag}" == 'y' ] && Print_Python
  [ "${elasticstack_flag}" == 'y' ] && Print_Elasticstack
  [ "${powerline_flag}" == 'y' ] && Print_Powerline
  [ "${all_flag}" == 'y' ] && Print_openssl
  Uninstall_status
  if [ "${uninstall_flag}" == 'y' ]; then
    [ "${web_flag}" == 'y' ] && Uninstall_Web
    [ "${mysql_flag}" == 'y' ] && Uninstall_MySQL
    [ "${postgresql_flag}" == 'y' ] && Uninstall_PostgreSQL
    [ "${mongodb_flag}" == 'y' ] && Uninstall_MongoDB
    [ "${redis_flag}" == 'y' ] && Uninstall_Redis_server
    [ "${rabbitmq_flag}" == 'y' ] && Uninstall_Rabbitmq_server
    [ "${fastdfs_flag}" == 'y' ] && Uninstall_Fastdfs
    [ "${proxysql_flag}" == 'y' ] && Uninstall_Proxysql
    [ "${kong_flag}" == 'y' ] && Uninstall_Kong
    [ "${python_flag}" == 'y' ] && { . include/python.sh; Uninstall_Python; }
    [ "${elasticstack_flag}" == 'y' ] && { . include/elasticstack.sh; Uninstall_Python; }
    [ "${powerline_flag}" == 'y' ] && { . include/powerline.sh; Uninstall_Powerline; } 
    [ "${all_flag}" == 'y' ] && Uninstall_openssl
  fi
fi
