|  | @ -3,7 +3,7 @@ | 
			
		
	
		
		
			
				
					|  |  | # =============================================== |  |  | # =============================================== | 
			
		
	
		
		
			
				
					|  |  | # Esse script foi desenvolvido por Lucas F. |  |  | # Esse script foi desenvolvido por Lucas F. | 
			
		
	
		
		
			
				
					|  |  | # This script was developed by Lucas F. |  |  | # This script was developed by Lucas F. | 
			
		
	
		
		
			
				
					
					|  |  | #  |  |  | # | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  | # Novembro de 2019 |  |  | # Novembro de 2019 | 
			
		
	
		
		
			
				
					|  |  | # 2019, November |  |  | # 2019, November | 
			
		
	
		
		
			
				
					|  |  | # |  |  | # | 
			
		
	
	
		
		
			
				
					|  | @ -110,7 +110,7 @@ SCRIPT_STEP_FILE="$SCRIPT_PATH/centos_django.step" | 
			
		
	
		
		
			
				
					|  |  | CHARS="abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)" |  |  | CHARS="abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)" | 
			
		
	
		
		
			
				
					|  |  | for ((i=0;i<${#CHARS};i++)); do ARRAY[$i]="${CHARS:i:1}"; done |  |  | for ((i=0;i<${#CHARS};i++)); do ARRAY[$i]="${CHARS:i:1}"; done | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  | # Cria uma sequência de 50 caracteres aleatórios  |  |  | # Cria uma sequência de 50 caracteres aleatórios | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  | # Create 50 random chars |  |  | # Create 50 random chars | 
			
		
	
		
		
			
				
					|  |  | key_gen() { |  |  | key_gen() { | 
			
		
	
		
		
			
				
					|  |  |     for ((c=1; c<=50; c++)); do |  |  |     for ((c=1; c<=50; c++)); do | 
			
		
	
	
		
		
			
				
					|  | @ -167,11 +167,7 @@ fi | 
			
		
	
		
		
			
				
					|  |  | # Obtém o IP |  |  | # Obtém o IP | 
			
		
	
		
		
			
				
					|  |  | # Get IP address |  |  | # Get IP address | 
			
		
	
		
		
			
				
					|  |  | if [[ ! -n $PUB_IP ]]; then |  |  | if [[ ! -n $PUB_IP ]]; then | 
			
		
	
		
		
			
				
					
					|  |  | 	if [[ -n $(man hostname | awk '{RS="";FS="\n"} /-i,/ {print}') ]]; then |  |  | 	PUB_IP=$(hostname -I | cut -d" " -f1) | 
			
				
				
			
		
	
		
		
			
				
					|  |  | 		PUB_IP=$(hostname -i | cut -d" " -f1) |  |  |  | 
			
		
	
		
		
			
				
					|  |  | 	else |  |  |  | 
			
		
	
		
		
			
				
					|  |  | 		PUB_IP=$(hostname -I | cut -d" " -f1) |  |  |  | 
			
		
	
		
		
			
				
					|  |  | 	fi |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					|  |  | fi |  |  | fi | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | update_step_error() { |  |  | update_step_error() { | 
			
		
	
	
		
		
			
				
					|  | @ -286,6 +282,7 @@ update_debug() { | 
			
		
	
		
		
			
				
					|  |  | # Instala pacotes necessários |  |  | # Instala pacotes necessários | 
			
		
	
		
		
			
				
					|  |  | # Install required packages |  |  | # Install required packages | 
			
		
	
		
		
			
				
					|  |  | install_packages() { |  |  | install_packages() { | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 	dnf update && | 
			
		
	
		
		
			
				
					|  |  | 	yum -y install vim && |  |  | 	yum -y install vim && | 
			
		
	
		
		
			
				
					|  |  | 	yum -y install epel-release && |  |  | 	yum -y install epel-release && | 
			
		
	
		
		
			
				
					|  |  | 	yum -y install bind-utils && |  |  | 	yum -y install bind-utils && | 
			
		
	
	
		
		
			
				
					|  | @ -296,7 +293,6 @@ install_packages() { | 
			
		
	
		
		
			
				
					|  |  | 	yum -y install nginx && |  |  | 	yum -y install nginx && | 
			
		
	
		
		
			
				
					|  |  | 	yum -y install net-tools && |  |  | 	yum -y install net-tools && | 
			
		
	
		
		
			
				
					|  |  | 	yum -y install policycoreutils-python-utils.noarch && |  |  | 	yum -y install policycoreutils-python-utils.noarch && | 
			
		
	
		
		
			
				
					|  |  | 	dnf update |  |  |  | 
			
		
	
		
		
			
				
					|  |  | 	if [[ $? -ge 1 ]]; then |  |  | 	if [[ $? -ge 1 ]]; then | 
			
		
	
		
		
			
				
					|  |  | 		update_step_error "$x" |  |  | 		update_step_error "$x" | 
			
		
	
		
		
			
				
					|  |  | 	fi |  |  | 	fi | 
			
		
	
	
		
		
			
				
					|  | @ -325,12 +321,9 @@ install_dependencies() { | 
			
		
	
		
		
			
				
					|  |  | # Coletar arquivos estáticos, criar tabelas e criar super usuário |  |  | # Coletar arquivos estáticos, criar tabelas e criar super usuário | 
			
		
	
		
		
			
				
					|  |  | # Perform collectstatic, migrate and createsuperuser |  |  | # Perform collectstatic, migrate and createsuperuser | 
			
		
	
		
		
			
				
					|  |  | execute_collec_mig_createsup() { |  |  | execute_collec_mig_createsup() { | 
			
		
	
		
		
			
				
					
					|  |  | 	if [[ -d /home/$USERNAME/$APP/staticfiles ]]; then |  |  | 	mkdir -p /home/$USERNAME/$APP/staticfiles && | 
			
				
				
			
		
	
		
		
			
				
					|  |  | 		mkdir -p /home/$USERNAME/$APP/staticfiles |  |  |  | 
			
		
	
		
		
			
				
					|  |  | 	fi |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					|  |  | 	/home/$USERNAME/$APP/$VENV/bin/python3 /manage.py collectstatic --noinput && |  |  | 	/home/$USERNAME/$APP/$VENV/bin/python3 /manage.py collectstatic --noinput && | 
			
		
	
		
		
			
				
					|  |  | 	/home/$USERNAME/$APP/$VENV/bin/python3 /manage.py migrate && |  |  | 	/home/$USERNAME/$APP/$VENV/bin/python3 /manage.py migrate && | 
			
		
	
		
		
			
				
					|  |  | 	/home/$USERNAME/$APP/$VENV/bin/python3 /manage.py createsuperuser |  |  |  | 
			
		
	
		
		
			
				
					|  |  | } |  |  | } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | # Instala o firewall |  |  | # Instala o firewall | 
			
		
	
	
		
		
			
				
					|  | @ -547,6 +540,7 @@ declare -a commands=( | 
			
		
	
		
		
			
				
					|  |  | 	"install_packages" |  |  | 	"install_packages" | 
			
		
	
		
		
			
				
					|  |  | 	"create_venv" |  |  | 	"create_venv" | 
			
		
	
		
		
			
				
					|  |  | 	"install_dependencies" |  |  | 	"install_dependencies" | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 	"execute_collec_mig_createsup", | 
			
		
	
		
		
			
				
					|  |  | 	"install_firewall" |  |  | 	"install_firewall" | 
			
		
	
		
		
			
				
					|  |  | 	"enable_ports" |  |  | 	"enable_ports" | 
			
		
	
		
		
			
				
					|  |  | 	"manage_default_nginx_file" |  |  | 	"manage_default_nginx_file" | 
			
		
	
	
		
		
			
				
					|  | 
 |