]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
core185: Fix update.sh syntax issues
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 26 Mar 2024 14:43:39 +0000 (14:43 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 26 Mar 2024 14:43:39 +0000 (14:43 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/rootfiles/core/185/update.sh

index 002f92bbbcab56bd49eb6f0b01dee27e59ebecd9..f86013c0d4f6dac41026f9e448b73a53cf69cde7 100644 (file)
@@ -117,19 +117,17 @@ chown nobody:nobody /var/ipfire/ovpn/ovpnconfig
 
 # Check if the drop hostile in and out logging options need to be added
 # into the optionsfw settings file and apply to firewall
-optionsfw=""
-if ! [ $(grep "^LOGDROPHOSTILEIN=" /var/ipfire/optionsfw/settings) ]; then
-    sed -i '$ a\LOGDROPHOSTILEIN=on' /var/ipfire/optionsfw/settings
-    optionsfw="updated"
+if ! grep -q "^LOGDROPHOSTILEIN=" /var/ipfire/optionsfw/settings; then
+       echo "LOGDROPHOSTILEIN=on" >> /var/ipfire/optionsfw/settings
 fi
-if ! [ $(grep "^LOGDROPHOSTILEOUT=" /var/ipfire/optionsfw/settings) ]; then
-    sed -i '$ a\LOGDROPHOSTILEOUT=on' /var/ipfire/optionsfw/settings
-    optionsfw="updated"
-fi
-if ! [ -z "$optionsfw" ]; then
-    /usr/local/bin/firewallctrl
+
+if ! grep -q "^LOGDROPHOSTILEOUT=" /var/ipfire/optionsfw/settings; then
+       echo "LOGDROPHOSTILEOUT=on" >> /var/ipfire/optionsfw/settings
 fi
 
+# Reload all firewall rules
+/usr/local/bin/firewallctrl
+
 # Rebuild initial ramdisks
 dracut --regenerate-all --force
 KVER="xxxKVERxxx"