Browse Source

fix ifs err 20.01.25:17.06

root 2 months ago
parent
commit
4bcc70131b
1 changed files with 10 additions and 10 deletions
  1. 10 10
      avto4certbot.dev/avto4certbot.sh

+ 10 - 10
avto4certbot.dev/avto4certbot.sh

@@ -86,12 +86,12 @@ if [ ! -d $conf_dir ]; then
86
 fi
86
 fi
87
 
87
 
88
 ##
88
 ##
89
-if [[ $opt != "nginx" ]] || [[ "$opt" == "apache" ]]; then
89
+if [[ "$opt" != "" ]] && [[ $opt != "nginx" ]] && [[ "$opt" == "apache" ]]; then
90
   find $sites_apache/* -maxdepth 0 -type l -printf '%f\n' >$tmp_dir/active_sites.inf 2>/dev/null;
90
   find $sites_apache/* -maxdepth 0 -type l -printf '%f\n' >$tmp_dir/active_sites.inf 2>/dev/null;
91
   get_tools[${#get_tools[@]}]="apache2";
91
   get_tools[${#get_tools[@]}]="apache2";
92
   service="apache2";
92
   service="apache2";
93
 fi
93
 fi
94
-if [[ $opt != "apache" ]] || [[ "$opt" == "nginx" ]]; then
94
+if [[ "$opt" != "" ]] && [[ $opt != "apache" ]] && [[ "$opt" == "nginx" ]]; then
95
   find $sites_nginx/* -maxdepth 0 -type l -printf '%f\n' >$tmp_dir/active_sites.inf 2>/dev/null;
95
   find $sites_nginx/* -maxdepth 0 -type l -printf '%f\n' >$tmp_dir/active_sites.inf 2>/dev/null;
96
   get_tools[${#get_tools[@]}]="nginx";
96
   get_tools[${#get_tools[@]}]="nginx";
97
   service="nginx";
97
   service="nginx";
@@ -129,12 +129,12 @@ function swSites(){
129
 if [ "$event_key" = "1" ]; then
129
 if [ "$event_key" = "1" ]; then
130
 active_sites=( $(cat $tmp_dir/active_sites.inf) );
130
 active_sites=( $(cat $tmp_dir/active_sites.inf) );
131
   for ((xd=0; xd != ${#active_sites[@]}; xd++)); do
131
   for ((xd=0; xd != ${#active_sites[@]}; xd++)); do
132
-    if [[ $opt != "nginx" ]] || [[ "$opt" == "apache" ]] && [[ "$opt" != "" ]]; then
132
+    if [[ "$opt" != "" ]] && [[ $opt != "nginx" ]] && [[ "$opt" == "apache" ]]; then
133
       if [ -f $sites_apache/${active_sites[$xd]} ]; then
133
       if [ -f $sites_apache/${active_sites[$xd]} ]; then
134
         rm $sites_apache/${active_sites[$xd]}
134
         rm $sites_apache/${active_sites[$xd]}
135
       fi
135
       fi
136
     fi
136
     fi
137
-    if [[ $opt != "apache" ]] || [[ "$opt" == "nginx" ]] && [[ "$opt" != "" ]]; then
137
+    if [[ "$opt" != "" ]] && [[ $opt != "apache" ]] && [[ "$opt" == "nginx" ]]; then
138
       if [ -f $sites_nginx/${active_sites[$xd]} ]; then
138
       if [ -f $sites_nginx/${active_sites[$xd]} ]; then
139
         rm $sites_nginx/${active_sites[$xd]}
139
         rm $sites_nginx/${active_sites[$xd]}
140
       fi
140
       fi
@@ -144,21 +144,21 @@ fi
144
 ## restore active sites
144
 ## restore active sites
145
 if [ "$event_key" = "0" ]; then
145
 if [ "$event_key" = "0" ]; then
146
   # clear tmp configs
146
   # clear tmp configs
147
-  if [[ $opt != "nginx" ]] || [[ "$opt" == "apache" ]] && [[ "$opt" != "" ]]; then
147
+  if [[ "$opt" != "" ]] && [[ $opt != "nginx" ]] && [[ "$opt" == "apache" ]]; then
148
     rm $available_apache/*.conf
148
     rm $available_apache/*.conf
149
   fi
149
   fi
150
-  if [[ $opt != "apache" ]] || [[ "$opt" == "nginx" ]] && [[ "$opt" != "" ]]; then
150
+  if [[ "$opt" != "" ]] && [[ $opt != "apache" ]] && [[ "$opt" == "nginx" ]]; then
151
     rm $available_nginx/*.conf
151
     rm $available_nginx/*.conf
152
   fi
152
   fi
153
   # restore active links
153
   # restore active links
154
   active_sites=( $(cat $tmp_dir/active_sites.inf) );
154
   active_sites=( $(cat $tmp_dir/active_sites.inf) );
155
   for ((xd=0; xd != ${#active_sites[@]}; xd++)); do
155
   for ((xd=0; xd != ${#active_sites[@]}; xd++)); do
156
-    if [[ $opt != "nginx" ]] || [[ "$opt" == "apache" ]] && [[ "$opt" != "" ]]; then
156
+    if [[ "$opt" != "" ]] && [[ $opt != "nginx" ]] && [[ "$opt" == "apache" ]]; then
157
       if [ ! -f $sites_apache/${active_sites[$xd]} ]; then
157
       if [ ! -f $sites_apache/${active_sites[$xd]} ]; then
158
         ln -s $available_apache/${active_sites[$xd]} $sites_apache/${active_sites[$xd]}
158
         ln -s $available_apache/${active_sites[$xd]} $sites_apache/${active_sites[$xd]}
159
       fi
159
       fi
160
     fi
160
     fi
161
-    if [[ $opt != "apache" ]] || [[ "$opt" == "nginx" ]] && [[ "$opt" != "" ]]; then
161
+    if [[ "$opt" != "" ]] && [[ $opt != "apache" ]] && [[ "$opt" == "nginx" ]]; then
162
       if [ ! -f $sites_nginx/${active_sites[$xd]} ]; then
162
       if [ ! -f $sites_nginx/${active_sites[$xd]} ]; then
163
         ln -s $available_nginx/${active_sites[$xd]} $sites_apache/${active_sites[$xd]}
163
         ln -s $available_nginx/${active_sites[$xd]} $sites_apache/${active_sites[$xd]}
164
       fi
164
       fi
@@ -237,7 +237,7 @@ for ((xd=0; xd != ${#domains[@]}; xd++)); do
237
   site_owner="${site_data[1]}";
237
   site_owner="${site_data[1]}";
238
   site_port="${site_data[2]}";
238
   site_port="${site_data[2]}";
239
   ## apache2 config
239
   ## apache2 config
240
-  if [[ $opt != "nginx" ]] || [[ "$opt" == "apache" ]] && [[ "$opt" != "" ]] ; then
240
+  if [[ "$opt" != "" ]] && [[ $opt != "nginx" ]] && [[ "$opt" == "apache" ]]; then
241
     echo >$conf_dir/$site_name.conf;
241
     echo >$conf_dir/$site_name.conf;
242
     echo -e '<VirtualHost *:'"$site_port"'>' >>$conf_dir/$site_name.conf;
242
     echo -e '<VirtualHost *:'"$site_port"'>' >>$conf_dir/$site_name.conf;
243
     echo -e '  ServerName '"$site_name"'' >>$conf_dir/$site_name.conf;
243
     echo -e '  ServerName '"$site_name"'' >>$conf_dir/$site_name.conf;
@@ -260,7 +260,7 @@ for ((xd=0; xd != ${#domains[@]}; xd++)); do
260
   fi
260
   fi
261
 
261
 
262
   ## nginx config
262
   ## nginx config
263
-  if [[ $opt != "apache" ]] || [[ "$opt" == "nginx" ]] && [[ "$opt" != "" ]]; then
263
+  if [[ "$opt" != "" ]] && [[ $opt != "apache" ]] && [[ "$opt" == "nginx" ]]; then
264
     echo >$conf_dir/$site_name.conf;
264
     echo >$conf_dir/$site_name.conf;
265
     echo -e 'server { listen 0.0.0.0:'"$site_port"';' >>$conf_dir/$site_name.conf;
265
     echo -e 'server { listen 0.0.0.0:'"$site_port"';' >>$conf_dir/$site_name.conf;
266
     echo -e '  server_name '"$site_name"';' >>$conf_dir/$site_name.conf;
266
     echo -e '  server_name '"$site_name"';' >>$conf_dir/$site_name.conf;