From c2d49d86b32ce668f87eee3943dffe35fd0de1f4 Mon Sep 17 00:00:00 2001
From: christian <christian.steinhaus@rwth-aachen.de>
Date: Fri, 16 Oct 2015 15:10:59 +0200
Subject: [PATCH] added Firewall chooser

chooseFirewall will ask the user if he wants to enable the Firewall an will enable it if the answer is yes, no action are taken if the answer is no
---
 scripts/linuxparty.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/scripts/linuxparty.py b/scripts/linuxparty.py
index 108bb4b..1e42a1f 100755
--- a/scripts/linuxparty.py
+++ b/scripts/linuxparty.py
@@ -142,6 +142,15 @@ def showErrorBox(errorstring):
     errorBox.setIcon(3)
     sys.exit(errorBox.exec_())
 
+def chooseFirewall():
+    askBox = QtWidgets.QMessageBox()
+    askBox.setText("Netzwerk: Soll die Ubuntu Firewall (ufw/gufw) aktiviert werden?")
+    askBox.setIcon(4)
+    askBox.setStandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
+    result = askBox.exec_()
+    if result == QtWidgets.QMessageBox.Yes:
+        enableFirewall()
+
 def checkIfRoot():
     if os.getuid() != 0:
         errorBox = QtWidgets.QMessageBox()
@@ -167,6 +176,10 @@ def installPackages(strlist):
     except Exception as ex:
         print("Error during install",ex)
 
+def enableFirewall():
+    command=['ufw', 'enable']
+    subprocess_wrap(command)
+
 def mountStick():
     command=[basedir+"/infuse_offline_repo.sh"]
     subprocess_wrap(command)
@@ -246,6 +259,7 @@ if __name__ == '__main__':
     basepath=os.path.realpath(__file__)
     basedir=os.path.dirname(basepath)
     checkIfRoot()
+    chooseFirewall()
     mountStick()
     window = Main()
     window.setWindowTitle("Linux Install Party Software Installer")
-- 
GitLab