From 9eb4a33adb95b045e7f5d3654e9639d46bf8e168 Mon Sep 17 00:00:00 2001 From: Locutus73 Date: Wed, 6 Feb 2019 14:08:07 +0100 Subject: [PATCH] Version 1.1 Checking current Kernel release is 4.5.0-socfpga-r1 before updating it for firewalling/iptables support. --- security_fixes.sh | 59 +++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/security_fixes.sh b/security_fixes.sh index 617cbf6..8eb9315 100644 --- a/security_fixes.sh +++ b/security_fixes.sh @@ -18,6 +18,7 @@ # You can download the latest version of this script from: # https://github.com/MiSTer-devel/Scripts_MiSTer +# Version 1.1 - 2019-02-06 - Checking current Kernel release is 4.5.0-socfpga-r1 before updating it for firewalling/iptables support. # Version 1.0.1 - 2019-02-05 - Cosmetic changes. # Version 1.0 - 2019-02-02 - First commit @@ -244,34 +245,36 @@ then echo "" case "$REPLY" in y|Y) - - - curl -L "https://github.com/MiSTer-devel/Scripts_MiSTer/blob/master/firewall-kernel/zImage_dtb?raw=true" -o "/media/fat/linux/zImage_dtb.new" - case $? in - 0) - if md5sum /media/fat/linux/zImage_dtb.new | grep -q "^e8a1be0c17a0b6487f6291e5320fd410 " - then - mv /media/fat/linux/zImage_dtb /media/fat/linux/zImage_dtb.old - mv /media/fat/linux/zImage_dtb.new /media/fat/linux/zImage_dtb - sync - FIREWALL_KERNEL="true" - else - rm /media/fat/linux/zImage_dtb.new > /dev/null 2>&1 - echo "Something went wrong with the Kernel download so it was deleted." - fi - ;; - 60) - echo "===============================================================" - echo "CA certificates need to be fixed before downloading the Kernel." - echo "Please run this script again to fix this." - echo "===============================================================" - ;; - *) - rm /media/fat/linux/zImage_dtb.new > /dev/null 2>&1 - echo "No Internet connection, please try again later." - ;; - esac - + if [ "$(uname -r)" == "4.5.0-socfpga-r1" ] + then + curl -L "https://github.com/MiSTer-devel/Scripts_MiSTer/blob/master/firewall-kernel/zImage_dtb?raw=true" -o "/media/fat/linux/zImage_dtb.new" + case $? in + 0) + if md5sum /media/fat/linux/zImage_dtb.new | grep -q "^e8a1be0c17a0b6487f6291e5320fd410 " + then + mv /media/fat/linux/zImage_dtb /media/fat/linux/zImage_dtb.old + mv /media/fat/linux/zImage_dtb.new /media/fat/linux/zImage_dtb + sync + FIREWALL_KERNEL="true" + else + rm /media/fat/linux/zImage_dtb.new > /dev/null 2>&1 + echo "Something went wrong with the Kernel download so it was deleted." + fi + ;; + 60) + echo "===============================================================" + echo "CA certificates need to be fixed before downloading the Kernel." + echo "Please run this script again to fix this." + echo "===============================================================" + ;; + *) + rm /media/fat/linux/zImage_dtb.new > /dev/null 2>&1 + echo "No Internet connection, please try again later." + ;; + esac + else + echo "Current Kernel release is $(uname -r), only 4.5.0-socfpga-r1 is supported for now." + fi ;; *) echo "You can't enable the Firewall withouth a Kernel supporting it."