diff --git a/src/main/server/enable_ssl.sh b/src/main/server/enable_ssl.sh index f2bb9481d..e618bc377 100755 --- a/src/main/server/enable_ssl.sh +++ b/src/main/server/enable_ssl.sh @@ -65,7 +65,7 @@ usage() { } ipt_remove() { - iptab=`iptables -t nat -n -L PREROUTING | grep -E "REDIRECT.*dpt:80.*5080"` + iptab=`iptables -t nat -n -L PREROUTING 2>/dev/null | grep -E "REDIRECT.*dpt:80.*5080"` if [ "$iptab" ]; then iptables-save > /tmp/iptables_save iptables -t nat -D PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 5080 @@ -104,24 +104,22 @@ get_password() { install_pkgs() { if [ -f /etc/debian_version ]; then - sudo apt update -qq - sudo apt install -y jq dnsutils iptables + $SUDO apt update -qq + $SUDO apt install -y jq dnsutils iptables elif [ -f /etc/redhat-release ]; then OS_VERSION=$(rpm -E %rhel) pkgs="jq bind-utils iptables" if [[ "$OS_VERSION" == "8" ]]; then - yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm + $SUDO yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm elif [[ "$OS_VERSION" == "9" ]]; then - yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm + $SUDO yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm else exit 1 fi - sudo yum install -y $pkgs || sudo dnf install -y $pkgs + $SUDO yum install -y $pkgs || sudo dnf install -y $pkgs fi } -install_pkgs - # Check if there is a Container and install necessary packages is_docker_container() { if [ -f /.dockerenv ]; then @@ -140,6 +138,7 @@ if is_docker_container; then SUDO="" fi +install_pkgs output() { OUT=$? @@ -205,6 +204,8 @@ generate_jwt get_freedomain(){ hostname="ams-$RANDOM" + #Refactor: It seems that result_marketplace is not used. On the other hand, JWT_KEY is a variable in generate_jwt + #it's better to return JWT_KEY in generate_jwt and don't use any variable other script result_marketplace=$(generate_jwt) get_license_key=`cat $INSTALL_DIRECTORY/conf/red5.properties | grep "server.licence_key=*" | cut -d "=" -f 2` ip=`curl -s http://checkip.amazonaws.com`