ariang: fix nginx support script logic 6929/head
authorAnsuel Smith <ansuelsmth@gmail.com>
Sun, 2 Sep 2018 13:04:14 +0000 (15:04 +0200)
committerAnsuel Smith <ansuelsmth@gmail.com>
Mon, 3 Sep 2018 19:09:59 +0000 (21:09 +0200)
Currently the uci-defaults script doesn't check if the rule is already present. This prevent any problem related by this.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
net/ariang/files/80_ariang-nginx-support

index bfe8862b2f51d9e0cb38333ddb7c9aada30005fb..a9762e09bef0ac512bf63bf72d1d9da85a5ce61c 100644 (file)
@@ -2,7 +2,8 @@
 
 
 if [ -f "/etc/nginx/nginx.conf" ] && [ -f "/etc/nginx/ariang.conf" ]; then
-       if [ ! "$(cat '/etc/nginx/nginx.conf' | grep -q 'server_name  localhost;')" ]; then
+       if [ "$( grep 'server_name  localhost;' < /etc/nginx/nginx.conf)" ] && 
+       [ ! "$( grep 'include ariang.conf;' < /etc/nginx/nginx.conf)" ]; then
                sed -i '/server_name  localhost;/a \\t\tinclude ariang.conf;' /etc/nginx/nginx.conf
                if [ -f /var/run/nginx.pid ]; then
                        /etc/init.d/nginx restart
@@ -11,3 +12,4 @@ if [ -f "/etc/nginx/nginx.conf" ] && [ -f "/etc/nginx/ariang.conf" ]; then
 fi
 
 exit 0
+