From 5b3160267d889337564f7cd3b58ede55a9a85823 Mon Sep 17 00:00:00 2001 From: Vadim Kurland Date: Thu, 24 Feb 2011 17:28:57 -0800 Subject: [PATCH] * configlets/freebsd/installer_commands_root: see #2143 "installer should run /etc/rc.d/pf script to reload PF rules on FreeBSD when generated script is in rc.conf format" --- doc/ChangeLog | 6 +++++- src/libgui/FirewallInstaller.cpp | 12 ++++++++++++ .../configlets/freebsd/installer_commands_reg_user | 11 ++++++++++- src/res/configlets/freebsd/installer_commands_root | 8 ++++++++ 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 20e471cf5..dbab63f52 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,8 @@ -2011-02-24 vadim +2011-02-24 Vadim Kurland + + * configlets/freebsd/installer_commands_root: see #2143 "installer + should run /etc/rc.d/pf script to reload PF rules on FreeBSD when + generated script is in rc.conf format" * AddressTableDialog.cpp (browse): see #2140 "Attempting to create new Address Table file results in read-only error". Implemented diff --git a/src/libgui/FirewallInstaller.cpp b/src/libgui/FirewallInstaller.cpp index d40469751..ccab92616 100644 --- a/src/libgui/FirewallInstaller.cpp +++ b/src/libgui/FirewallInstaller.cpp @@ -690,6 +690,8 @@ QString FirewallInstaller::getActivationCmd() return cnf->activationCmd; } + FWOptions *fwopt = cnf->fwobj->getOptionsObject(); + QString configlet_name = "installer_commands_"; if (cnf->user=="root") configlet_name += "root"; else configlet_name += "reg_user"; @@ -720,6 +722,16 @@ QString FirewallInstaller::getActivationCmd() configlet.setVariable("with_compression", cnf->compressScript); configlet.setVariable("no_compression", ! cnf->compressScript); + // On FreeBSD where we can generate either shell script or rc.conf + // file, installation commands differ. + // + // TODO: find more generic way to do this so that GUI installer does not + // have to be aware of the differences in generated file format. + configlet.setVariable("rc_conf_format", + fwopt->getBool("generate_rc_conf_file")); + configlet.setVariable("shell_script_format", + ! fwopt->getBool("generate_rc_conf_file")); + replaceMacrosInCommand(&configlet); return configlet.expand().trimmed(); diff --git a/src/res/configlets/freebsd/installer_commands_reg_user b/src/res/configlets/freebsd/installer_commands_reg_user index c46ddee57..7cb0b4d6e 100644 --- a/src/res/configlets/freebsd/installer_commands_reg_user +++ b/src/res/configlets/freebsd/installer_commands_reg_user @@ -28,6 +28,15 @@ ## on the input of sudo and other commands. This creates difficult to catch ## race condition which breaks installation process. +{{if shell_script_format}} +echo '{{$fwbprompt}}'; +chmod +x {{$fwdir}}/{{$fwscript}}; +sudo -S {{$fwdir}}/{{$fwscript}} && ( echo 'Policy activated'; sleep 2; echo) +{{endif}} + +{{if rc_conf_format}} +echo '{{$fwbprompt}}'; +sudo -S /etc/rc.d/pf reload && ( echo 'Policy activated'; sleep 2; echo) +{{endif}} -echo '{{$fwbprompt}}'; chmod +x {{$fwdir}}/{{$fwscript}}; sudo -S {{$fwdir}}/{{$fwscript}} && ( echo 'Policy activated'; sleep 2; echo) diff --git a/src/res/configlets/freebsd/installer_commands_root b/src/res/configlets/freebsd/installer_commands_root index f0305696d..01cdb4657 100644 --- a/src/res/configlets/freebsd/installer_commands_root +++ b/src/res/configlets/freebsd/installer_commands_root @@ -25,7 +25,15 @@ ## See #1368 for the explanation of the need for the "sleep2; echo" commands +{{if shell_script_format}} echo '{{$fwbprompt}}'; chmod +x {{$fwdir}}/{{$fwscript}}; sh {{$fwdir}}/{{$fwscript}} && ( echo 'Policy activated'; sleep 2; echo) +{{endif}} + +{{if rc_conf_format}} +echo '{{$fwbprompt}}'; +/etc/rc.d/pf reload && ( echo 'Policy activated'; sleep 2; echo) +{{endif}} +