Browse Source

ariang: fix nginx support script logic

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>
lilik-openwrt-22.03
Ansuel Smith 6 years ago
parent
commit
8245d6f071
No known key found for this signature in database GPG Key ID: AC001D09ADBFEAD7
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      net/ariang/files/80_ariang-nginx-support

+ 3
- 1
net/ariang/files/80_ariang-nginx-support View File

@ -2,7 +2,8 @@
if [ -f "/etc/nginx/nginx.conf" ] && [ -f "/etc/nginx/ariang.conf" ]; then 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 sed -i '/server_name localhost;/a \\t\tinclude ariang.conf;' /etc/nginx/nginx.conf
if [ -f /var/run/nginx.pid ]; then if [ -f /var/run/nginx.pid ]; then
/etc/init.d/nginx restart /etc/init.d/nginx restart
@ -11,3 +12,4 @@ if [ -f "/etc/nginx/nginx.conf" ] && [ -f "/etc/nginx/ariang.conf" ]; then
fi fi
exit 0 exit 0

Loading…
Cancel
Save