55NGINX_CHANGED=0
66FILE=/etc/nginx/nginx.conf
77if grep -q " SAMEORIGIN" " ${FILE} " > /dev/null 2>&1 ; then
8- cp " $FILE " " $FILE -"
8+ cp -p " $FILE " " $FILE -"
99 OLD=" add_header X-Frame-Options 'SAMEORIGIN';"
1010 NEW=" add_header Content-Security-Policy \" frame-ancestors 'self' https://connect.myunraid.net/\" ;"
11- sed -i " s/ ${OLD} / ${NEW} / " " ${FILE} "
11+ sed -i " s| ${OLD} | ${NEW} | " " ${FILE} "
1212 NGINX_CHANGED=1
1313fi
1414
1515# Patch robots.txt handling
1616FILE=/etc/rc.d/rc.nginx
1717if ! grep -q " #robots.txt any origin" " ${FILE} " > /dev/null 2>&1 ; then
18- cp " $FILE " " $FILE -"
18+ cp -p " $FILE " " $FILE -"
1919 FIND=" location = \/robots.txt {"
2020 # escape tabs and spaces
2121 ADD=" \t add_header Access-Control-Allow-Origin *; #robots.txt any origin"
3232# Fix update.htm to work in an iframe
3333FILE=/usr/local/emhttp/update.htm
3434if [ -f " ${FILE} " ] && grep -q " top.document" " ${FILE} " > /dev/null 2>&1 ; then
35- cp -f " $FILE " " $FILE -"
36- sed -i ' s/ top.document/ parent.document/ gm' " ${FILE} "
35+ cp -p " $FILE " " $FILE -"
36+ sed -i ' s| top.document| parent.document| gm' " ${FILE} "
3737fi
3838
3939# Fix logging.htm to work in an iframe
4040FILE=/usr/local/emhttp/logging.htm
4141if [ -f " ${FILE} " ] && grep -q " top.Shadowbox" " ${FILE} " > /dev/null 2>&1 ; then
42- cp -f " $FILE " " $FILE -"
43- sed -i ' s/ top.Shadowbox/ parent.Shadowbox/ gm' " ${FILE} "
42+ cp -p " $FILE " " $FILE -"
43+ sed -i ' s| top.Shadowbox| parent.Shadowbox| gm' " ${FILE} "
4444fi
4545
4646# Relax restrictions on built-in Firefox
@@ -53,7 +53,7 @@ if [ -z "$PROFILE_DIR" ]; then
5353else
5454 FILE=" $PROFILE_DIR /user.js"
5555 if [ -f " $FILE " ]; then
56- cp -f " $FILE " " $FILE -"
56+ cp -p " $FILE " " $FILE -"
5757 # Append settings if they don't exist
5858 grep -q " privacy.firstparty.isolate" " $FILE " || echo ' user_pref("privacy.firstparty.isolate", false);' >> " $FILE "
5959 grep -q " javascript.options.asmjs" " $FILE " || echo ' user_pref("javascript.options.asmjs", true);' >> " $FILE "
0 commit comments