Ispravljena greska u debian/prerm. Modificiran debian/postinst.
[mod-security-cn.git] / debian / postinst
index 96bf5f7..44f707c 100644 (file)
@@ -106,7 +106,7 @@ if [ -e "$CONF" ]; then
 fi
 
 
-# Generate ModSecurity configuration file and activate RBL lookup
+# Generate ModSecurity configuration files and activate RBL lookup
 # for ModSecurity if needed.
 #
 chk_conf_tag "$MODSECCONF"
@@ -126,7 +126,6 @@ if [ $RET -eq 0 ] || [ $RET -eq 1 ]; then
 
         out=$(mktemp $MODSECCONF.XXXXXX)
         temp_files="${temp_files} ${out}"
-        cp "$MODSECTPL/$(basename $MODSECCONF)" "$out"
 
         db_get mod-security-cn/rbl || true
         if [ "$RET" = "true" ]; then
@@ -136,7 +135,7 @@ if [ $RET -eq 0 ] || [ $RET -eq 1 ]; then
             if [ $RET -eq 0 ] || [ $RET -eq 1 ]; then
 
                 if [ $RET -eq 1 ]; then
-                    cp_echo "CN: Creating new configuration file $MODSECRBL"
+                    cp_echo "CN: Creating configuration file $MODSECRBL"
                     cp "$MODSECTPL/$(basename $MODSECRBL)" "$MODSECRBL"
                     need_restart=1
                 else
@@ -148,9 +147,8 @@ if [ $RET -eq 0 ] || [ $RET -eq 1 ]; then
                 fi
             fi
 
-            cp_check_and_sed '#RBLLOOKUP#' \
-                "s,#RBLLOOKUP#,Include $MODSECRBL,g" \
-                "$out" || true
+            sed "s,#RBLLOOKUP#,Include $MODSECRBL,g" \
+                "$MODSECTPL/$(basename $MODSECCONF)" > "$out"
 
             if [ -e "$MODSECCONF" ]; then
                 if ! cmp -s "$MODSECCONF" "$out"; then
@@ -160,7 +158,7 @@ if [ $RET -eq 0 ] || [ $RET -eq 1 ]; then
                     need_restart=1
                 fi
             else
-                cp_echo "CN: Creating new configuration file $MODSECCONF"
+                cp_echo "CN: Creating configuration file $MODSECCONF"
                 mv "$out" "$MODSECCONF"
                 cp_echo "CN: Enabled ModSecurity RBL lookup."
                 need_restart=1
@@ -168,9 +166,8 @@ if [ $RET -eq 0 ] || [ $RET -eq 1 ]; then
         else
 
             # Remove RBL configuration.
-            cp_check_and_sed '#RBLLOOKUP#' \
-                "s,#RBLLOOKUP#,# DISABLED,g" \
-                "$out" || true
+            sed "s,#RBLLOOKUP#,# DISABLED,g" \
+                "$MODSECTPL/$(basename $MODSECCONF)" > "$out"
 
             if [ -e "$MODSECCONF" ]; then
                 if ! cmp -s "$MODSECCONF" "$out"; then
@@ -180,7 +177,7 @@ if [ $RET -eq 0 ] || [ $RET -eq 1 ]; then
                     need_restart=1
                 fi
             else
-                cp_echo "CN: Creating new configuration file $MODSECCONF"
+                cp_echo "CN: Creating configuration file $MODSECCONF"
                 mv "$out" "$MODSECCONF"
                 cp_echo "CN: Disabled ModSecurity RBL lookup."
                 need_restart=1