This commit is contained in:
BoHung Chiu 2023-04-20 14:16:39 +08:00
parent c2a0f46cb7
commit 07721eaa30
3 changed files with 10 additions and 8 deletions

View File

@ -247,8 +247,8 @@ if [[ "$ubuntu_version" > '21' ]]; then
mime_type=`file -b --mime-type "$file_path"`
if [[ $mime_type == "application/pgp-keys" ]]; then
new_file_path=`echo "$file_path"| sed -E 's/(\.[^.]+$|$)/\.gpg/g'`
cat $file_path|sudo gpg --dearmor -o $new_file_path
rm -f $file_path
cat $file_path|sudo gpg --batch --yes --dearmor -o $new_file_path
sudo rm -f $file_path
file_path="$new_file_path"
fi
fi

View File

@ -46,8 +46,8 @@ else
use_local_command=""
fi
nginx_file=`$ssh_command "grep -e $'\s''$domain_escape' /etc/nginx/orbit_sites/* -l"|xargs|awk '{print $1}'`;
remote_sudo_command="echo $pass|sudo -S -p ' '"
alias sudo_command="echo $user_pass|sudo -S -p ' '"
remote_sudo_command="echo '$pass'|sudo -S -p ' '"
alias sudo_command="echo '$user_pass'|sudo -S -p ' '"
if [ -z "$(which sshpass)" ]; then
sudo_command apt install sshpass -y;
fi
@ -128,7 +128,7 @@ else
sudo_command mkdir -p $org_ssl_dir
sudo_command mkdir -p /etc/letsencrypt/renewal
sudo_command cp -r $new_ssl_dir/* $org_ssl_dir/.
if [[ "$(dirname $org_ssl_dir)" == "/etc/letsencrypt/live" ]] && [[ ! -z "$(ls $org_ssl_dir/*.pem 2>>/dev/null || echo '')" ]]; then
if [[ "$(dirname $org_ssl_dir)" == "/etc/letsencrypt/live" ]] && [[ ! -z "$(sudo_command find $org_ssl_dir -name '*.pem' 2>>/dev/null || echo '')" ]]; then
sudo_command mkdir -p /etc/letsencrypt/archive/$real_domain
sudo_command rm -f /etc/letsencrypt/archive/$real_domain/*.pem
sudo_command mv $org_ssl_dir/*.pem /etc/letsencrypt/archive/$real_domain/.
@ -183,6 +183,7 @@ else
sudo_command sed "s/\(return\s\+30\(1\|2\)\s\+https:\/\/\)$domain_escape/\1$new_server_name/g" -i $new_nginx_file
fi
fi
sudo_command sed "s/$(echo $ip|sed 's/\./\\\./g')/$(echo $local_ip|sed 's/\./\\\./g')/g" -i $new_nginx_file
sudo_command nginx -t
if [ "$?" == "0" ];then
sudo_command service nginx restart;

View File

@ -50,8 +50,8 @@ else
use_local_command=""
fi
nginx_file=`$ssh_command "grep -e $'\s''$domain_escape' /etc/nginx/orbit_sites/* -l"|xargs|awk '{print $1}'`;
remote_sudo_command="echo $pass|sudo -S -p ' '"
alias sudo_command="echo $user_pass|sudo -S -p ' '"
remote_sudo_command="echo '$pass'|sudo -S -p ' '"
alias sudo_command="echo '$user_pass'|sudo -S -p ' '"
if [ -z "$(which sshpass)" ]; then
sudo_command apt install sshpass -y;
fi
@ -132,7 +132,7 @@ else
sudo_command mkdir -p $org_ssl_dir
sudo_command mkdir -p /etc/letsencrypt/renewal
sudo_command cp -r $new_ssl_dir/* $org_ssl_dir/.
if [[ "$(dirname $org_ssl_dir)" == "/etc/letsencrypt/live" ]] && [[ ! -z "$(ls $org_ssl_dir/*.pem 2>>/dev/null || echo '')" ]]; then
if [[ "$(dirname $org_ssl_dir)" == "/etc/letsencrypt/live" ]] && [[ ! -z "$(sudo_command find $org_ssl_dir -name '*.pem' 2>>/dev/null || echo '')" ]]; then
sudo_command mkdir -p /etc/letsencrypt/archive/$real_domain
sudo_command rm -f /etc/letsencrypt/archive/$real_domain/*.pem
sudo_command mv $org_ssl_dir/*.pem /etc/letsencrypt/archive/$real_domain/.
@ -187,6 +187,7 @@ else
sudo_command sed "s/\(return\s\+30\(1\|2\)\s\+https:\/\/\)$domain_escape/\1$new_server_name/g" -i $new_nginx_file
fi
fi
sudo_command sed "s/$(echo $ip|sed 's/\./\\\./g')/$(echo $local_ip|sed 's/\./\\\./g')/g" -i $new_nginx_file
sudo_command nginx -t
if [ "$?" == "0" ];then
sudo_command service nginx restart;