mirror of
https://github.com/fwbuilder/fwbuilder
synced 2025-10-16 07:28:25 +02:00
merging -r887:HEAD from branch v3
This commit is contained in:
parent
56db618e57
commit
00d1562d36
27
autogen.sh
27
autogen.sh
@ -7,10 +7,10 @@ if test ! -x "$MAKE" ; then MAKE=`which make` ; fi
|
||||
HAVE_GNU_MAKE=`$MAKE --version|grep -c "Free Software Foundation"`
|
||||
|
||||
if test "$HAVE_GNU_MAKE" != "1"; then
|
||||
echo "Could not find GNU make on this system, can not proceed with build."
|
||||
echo Could not find GNU make on this system, can not proceed with build.
|
||||
exit 1
|
||||
else
|
||||
echo "Found GNU Make at $MAKE ... good."
|
||||
echo Found GNU Make at $MAKE ... good.
|
||||
fi
|
||||
|
||||
if test ! -x "`which aclocal`"
|
||||
@ -20,25 +20,32 @@ then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test ! -x "`which libtoolize`"
|
||||
if test -x "`which libtoolize`"
|
||||
then
|
||||
if test ! -x "`which glibtoolize`"
|
||||
LIBTOOLIZE="libtoolize"
|
||||
else
|
||||
if test -x "`which glibtoolize`"
|
||||
then
|
||||
LIBTOOLIZE="glibtoolize"
|
||||
else
|
||||
echo "You need libtoolize to generate autoconf and libtool scripts."
|
||||
echo "Please install libtool package."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "This script runs configure ..."
|
||||
$LIBTOOLIZE --dry-run --install > /dev/null 2>&1 && {
|
||||
LIBTOOLIZE_ARGS="--force --copy --install"
|
||||
} || {
|
||||
LIBTOOLIZE_ARGS="--force --copy"
|
||||
}
|
||||
|
||||
ACLOCALARG=""
|
||||
test -d /sw/share/ && ACLOCALARG=" -I /sw/share/aclocal"
|
||||
echo This script runs configure ...
|
||||
|
||||
$LIBTOOLIZE $LIBTOOLIZE_ARGS
|
||||
|
||||
which libtoolize >/dev/null 2>&1 && libtoolize --force --copy
|
||||
which glibtoolize >/dev/null 2>&1 && glibtoolize --force --copy
|
||||
which acinclude >/dev/null 2>&1 && acinclude
|
||||
which aclocal >/dev/null 2>&1 && aclocal ${ACLOCALARG}
|
||||
which aclocal >/dev/null 2>&1 && aclocal
|
||||
autoconf
|
||||
|
||||
./configure ${CFGARGS} $*
|
||||
|
@ -1,3 +1,14 @@
|
||||
2009-05-06 vadim <vadim@vk.crocodile.org>
|
||||
|
||||
* FirewallInstallerCisco.cpp (FirewallInstallerCisco::activatePolicy):
|
||||
fixed bug #2787932 "External install script is not supported for
|
||||
PIX".
|
||||
|
||||
* fixed bug #2787857: "b847 crashes on Start". v3.0.5 build 847
|
||||
links with QtDBus framework as part of the future development but
|
||||
the framework file was not included in the bundle. This caused
|
||||
crash on Mac OS X.
|
||||
|
||||
2009-05-02 vadim <vadim@vk.crocodile.org>
|
||||
|
||||
* DiscoveryDruid.cpp (DiscoveryDruid::DiscoveryDruid): fixed bug
|
||||
|
@ -221,9 +221,54 @@ void FirewallInstaller::copyFile(const QString &file_name)
|
||||
{
|
||||
}
|
||||
|
||||
void FirewallInstaller::executeInstallScript()
|
||||
{
|
||||
Management *mgmt = cnf->fwobj->getManagementObject();
|
||||
assert(mgmt!=NULL);
|
||||
PolicyInstallScript *pis = mgmt->getPolicyInstallScript();
|
||||
QString command = pis->getCommand().c_str();
|
||||
QString wdir = getFileDir( mw->getRCS()->getFileName() );
|
||||
QStringList args;
|
||||
//args.push_back(command.trimmed());
|
||||
|
||||
QString qs = pis->getArguments().c_str();
|
||||
args += qs.trimmed().split(" ", QString::SkipEmptyParts);
|
||||
|
||||
args.push_back("-f");
|
||||
args.push_back(mw->db()->getFileName().c_str());
|
||||
|
||||
if (wdir!="")
|
||||
{
|
||||
args.push_back("-d");
|
||||
args.push_back(wdir);
|
||||
}
|
||||
args.push_back(cnf->fwobj->getName().c_str());
|
||||
|
||||
if (cnf->verbose) inst_dlg->displayCommand(args);
|
||||
qApp->processEvents();
|
||||
|
||||
inst_dlg->setUpProcessToInstall();
|
||||
if (!inst_dlg->executeCommand(command.trimmed(), args))
|
||||
QTimer::singleShot( 0, this, SLOT(mainLoopInstall()));
|
||||
}
|
||||
|
||||
void FirewallInstaller::executeCommand(const QString &cmd)
|
||||
{
|
||||
}
|
||||
QStringList args;
|
||||
packSSHArgs(args);
|
||||
args.push_back( cmd );
|
||||
if (cnf->verbose) inst_dlg->displayCommand(args);
|
||||
qApp->processEvents();
|
||||
|
||||
QString path = args.at(0);
|
||||
args.pop_front();
|
||||
|
||||
inst_dlg->setUpProcessToInstall();
|
||||
if (!inst_dlg->executeCommand(path, args))
|
||||
QTimer::singleShot( 0, this, SLOT(mainLoopInstall()));
|
||||
}
|
||||
|
||||
// ************************************************************************
|
||||
|
||||
void FirewallInstaller::activatePolicy()
|
||||
{
|
||||
|
@ -71,7 +71,8 @@ protected:
|
||||
|
||||
instDialog *inst_dlg;
|
||||
instConf *cnf;
|
||||
// session is used when e run built-in installer
|
||||
QProcess proc;
|
||||
// session is used when we run built-in installer
|
||||
SSHSession *session;
|
||||
std::list<instJob> job_list;
|
||||
QString fwb_prompt;
|
||||
@ -79,6 +80,7 @@ protected:
|
||||
void runSSHSession(SSHSession *s, bool intermediate=false);
|
||||
QString getFullPath(const QString &file );
|
||||
|
||||
void executeInstallScript();
|
||||
|
||||
public:
|
||||
|
||||
|
@ -62,6 +62,17 @@ bool FirewallInstallerCisco::packInstallJobsList(Firewall*)
|
||||
|
||||
void FirewallInstallerCisco::activatePolicy()
|
||||
{
|
||||
// Someone may have external expect script to talk to PIX or a router
|
||||
// Let them run it too.
|
||||
Management *mgmt = cnf->fwobj->getManagementObject();
|
||||
assert(mgmt!=NULL);
|
||||
PolicyInstallScript *pis = mgmt->getPolicyInstallScript();
|
||||
if (pis->getCommand()!="" )
|
||||
{
|
||||
executeInstallScript();
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList args;
|
||||
|
||||
packSSHArgs(args);
|
||||
|
@ -165,35 +165,6 @@ void FirewallInstallerUnx::activatePolicy()
|
||||
executeInstallScript();
|
||||
}
|
||||
|
||||
void FirewallInstallerUnx::executeInstallScript()
|
||||
{
|
||||
Management *mgmt = cnf->fwobj->getManagementObject();
|
||||
assert(mgmt!=NULL);
|
||||
PolicyInstallScript *pis = mgmt->getPolicyInstallScript();
|
||||
QString command = pis->getCommand().c_str();
|
||||
QString wdir = getFileDir( mw->getRCS()->getFileName() );
|
||||
QStringList args;
|
||||
args.push_back(command.trimmed());
|
||||
|
||||
QString qs = pis->getArguments().c_str();
|
||||
args += qs.trimmed().split(" ", QString::SkipEmptyParts);
|
||||
|
||||
args.push_back("-f");
|
||||
args.push_back(mw->db()->getFileName().c_str());
|
||||
|
||||
if (wdir!="")
|
||||
{
|
||||
args.push_back("-d");
|
||||
args.push_back(wdir);
|
||||
}
|
||||
args.push_back(cnf->fwobj->getName().c_str());
|
||||
|
||||
if (cnf->verbose) inst_dlg->displayCommand(args);
|
||||
qApp->processEvents();
|
||||
|
||||
executeCommand(args);
|
||||
}
|
||||
|
||||
void FirewallInstallerUnx::executeSession(const QString &cmd)
|
||||
{
|
||||
QStringList args;
|
||||
@ -243,56 +214,3 @@ void FirewallInstallerUnx::copyFile(const QString &file_name)
|
||||
|
||||
// ************************************************************************
|
||||
|
||||
void FirewallInstallerUnx::executeCommand(const QString &cmd)
|
||||
{
|
||||
QStringList args;
|
||||
packSSHArgs(args);
|
||||
args.push_back( cmd );
|
||||
if (cnf->verbose) inst_dlg->displayCommand(args);
|
||||
qApp->processEvents();
|
||||
|
||||
executeCommand(args);
|
||||
}
|
||||
|
||||
// ************************************************************************
|
||||
|
||||
/*
|
||||
* All other methods operate with SSHSession objects because they are
|
||||
* interactive (even if only to enter password). We do not need
|
||||
* interactivity to run single command so here we use QProcess instead
|
||||
* of SSHSession.
|
||||
*/
|
||||
void FirewallInstallerUnx::executeCommand(QStringList &args)
|
||||
{
|
||||
connect(&proc, SIGNAL(readyReadStandardOutput()),
|
||||
inst_dlg, SLOT(readFromStdout()) );
|
||||
|
||||
// even though we set channel mode to "merged", QProcess
|
||||
// seems to not merge them on windows.
|
||||
proc.setProcessChannelMode(QProcess::MergedChannels);
|
||||
|
||||
// set codecs so that command line parameters can be encoded
|
||||
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("Utf8"));
|
||||
QTextCodec::setCodecForLocale(QTextCodec::codecForName("Utf8"));
|
||||
|
||||
QString path = args.at(0);
|
||||
args.pop_front();
|
||||
|
||||
proc.disconnect(SIGNAL(finished(int,QProcess::ExitStatus)));
|
||||
connect(&proc, SIGNAL(finished(int,QProcess::ExitStatus)),
|
||||
inst_dlg, SLOT(installerFinished(int,QProcess::ExitStatus)) );
|
||||
inst_dlg->enableStopButton();
|
||||
|
||||
proc.start(path, args);
|
||||
|
||||
if ( !proc.waitForStarted() )
|
||||
{
|
||||
inst_dlg->addToLog(tr("Error: Failed to start program:"));
|
||||
inst_dlg->addToLog(path);
|
||||
inst_dlg->opError(cnf->fwobj);
|
||||
QTimer::singleShot( 0, inst_dlg, SLOT(mainLoopInstall()));
|
||||
return;
|
||||
}
|
||||
args.push_front(path);
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,6 @@
|
||||
|
||||
#include <qstring.h>
|
||||
#include <qstringlist.h>
|
||||
#include <qprocess.h>
|
||||
#include <qobject.h>
|
||||
|
||||
namespace libfwbuilder
|
||||
@ -46,11 +45,7 @@ class FirewallInstallerUnx : public FirewallInstaller
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
QProcess proc;
|
||||
|
||||
void executeInstallScript();
|
||||
void executeSession(const QString &cmd);
|
||||
void executeCommand(QStringList &args);
|
||||
|
||||
public:
|
||||
|
||||
@ -59,7 +54,6 @@ public:
|
||||
|
||||
virtual bool packInstallJobsList(libfwbuilder::Firewall*);
|
||||
virtual void copyFile(const QString &file_name);
|
||||
virtual void executeCommand(const QString &cmd);
|
||||
virtual void activatePolicy();
|
||||
|
||||
|
||||
|
@ -99,7 +99,7 @@ instDialog::instDialog(QWidget* p,
|
||||
|
||||
installer = NULL;
|
||||
|
||||
page_1_op = COMPILE;
|
||||
page_1_op = INST_DLG_COMPILE;
|
||||
|
||||
showSelectedFlag = false;
|
||||
rejectDialogFlag = false;
|
||||
@ -218,7 +218,7 @@ void instDialog::mainLoopCompile()
|
||||
fillInstallOpList();
|
||||
if (install_fw_list.size() > 0)
|
||||
{
|
||||
page_1_op = INSTALL;
|
||||
page_1_op = INST_DLG_INSTALL;
|
||||
setNextEnabled(1, true);
|
||||
}
|
||||
}
|
||||
@ -294,7 +294,7 @@ void instDialog::showPage(const int page)
|
||||
// controlled by flag page_1_op
|
||||
switch (page_1_op)
|
||||
{
|
||||
case COMPILE:
|
||||
case INST_DLG_COMPILE:
|
||||
{
|
||||
if (fwbdebug) qDebug("Page 1 compile");
|
||||
if (compile_fw_list.size()==0)
|
||||
@ -304,7 +304,7 @@ void instDialog::showPage(const int page)
|
||||
showPage(0);
|
||||
return;
|
||||
}
|
||||
page_1_op = INSTALL;
|
||||
page_1_op = INST_DLG_INSTALL;
|
||||
showPage(1);
|
||||
return;
|
||||
}
|
||||
@ -320,7 +320,7 @@ void instDialog::showPage(const int page)
|
||||
break;
|
||||
}
|
||||
|
||||
case INSTALL:
|
||||
case INST_DLG_INSTALL:
|
||||
{
|
||||
if (fwbdebug) qDebug("Page 1 install");
|
||||
if (install_fw_list.size() > 0)
|
||||
@ -438,3 +438,53 @@ void instDialog::blockInstallForFirewall(Firewall *fw)
|
||||
installMapping[fw]->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
|
||||
void instDialog::setUpProcessToCompile()
|
||||
{
|
||||
connect(&proc, SIGNAL(readyReadStandardOutput()),
|
||||
this, SLOT(readFromStdout()) );
|
||||
|
||||
// even though we set channel mode to "merged", QProcess
|
||||
// seems to not merge them on windows.
|
||||
proc.setProcessChannelMode(QProcess::MergedChannels);
|
||||
|
||||
proc.disconnect(SIGNAL(finished(int,QProcess::ExitStatus)));
|
||||
connect(&proc, SIGNAL(finished(int,QProcess::ExitStatus)),
|
||||
this, SLOT(compilerFinished(int,QProcess::ExitStatus)) );
|
||||
}
|
||||
|
||||
void instDialog::setUpProcessToInstall()
|
||||
{
|
||||
connect(&proc, SIGNAL(readyReadStandardOutput()),
|
||||
this, SLOT(readFromStdout()) );
|
||||
|
||||
// even though we set channel mode to "merged", QProcess
|
||||
// seems to not merge them on windows.
|
||||
proc.setProcessChannelMode(QProcess::MergedChannels);
|
||||
|
||||
proc.disconnect(SIGNAL(finished(int,QProcess::ExitStatus)));
|
||||
connect(&proc, SIGNAL(finished(int,QProcess::ExitStatus)),
|
||||
this, SLOT(installerFinished(int,QProcess::ExitStatus)) );
|
||||
}
|
||||
|
||||
/*
|
||||
* This method is used to launch compiler AND user-defined external
|
||||
* installation script.
|
||||
*/
|
||||
bool instDialog::executeCommand(const QString &path, QStringList &args)
|
||||
{
|
||||
// set codecs so that command line parameters can be encoded
|
||||
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("Utf8"));
|
||||
QTextCodec::setCodecForLocale(QTextCodec::codecForName("Utf8"));
|
||||
enableStopButton();
|
||||
proc.start(path, args);
|
||||
if ( !proc.waitForStarted() )
|
||||
{
|
||||
opError(cnf.fwobj);
|
||||
addToLog( tr("Error: Failed to start program") );
|
||||
addToLog(path);
|
||||
//blockInstallForFirewall(cnf.fwobj);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ namespace libfwbuilder
|
||||
}
|
||||
|
||||
enum BatchOperation {BATCH_INSTALL, BATCH_COMPILE} ;
|
||||
enum Page1Operation {COMPILE, INSTALL};
|
||||
enum Page1Operation {INST_DLG_COMPILE, INST_DLG_INSTALL};
|
||||
|
||||
typedef std::map<libfwbuilder::Firewall *,QTableWidgetItem *> t_tableMap;
|
||||
typedef std::list<libfwbuilder::Firewall *> t_fwList;
|
||||
@ -171,9 +171,11 @@ class instDialog : public QDialog, public FakeWizard
|
||||
void enableStopButton();
|
||||
void disableStopButton();
|
||||
|
||||
void setUpProcessToCompile();
|
||||
void setUpProcessToInstall();
|
||||
bool executeCommand(const QString &path, QStringList &args);
|
||||
|
||||
protected:
|
||||
void executeCommand(QStringList &args);
|
||||
|
||||
virtual void showEvent( QShowEvent *ev);
|
||||
virtual void hideEvent( QHideEvent *ev);
|
||||
|
@ -109,24 +109,12 @@ bool instDialog::runCompiler(Firewall *fw)
|
||||
connect(currentStopButton, SIGNAL(clicked()),
|
||||
this, SLOT(stopCompile()));
|
||||
|
||||
proc.disconnect(SIGNAL(finished(int,QProcess::ExitStatus)));
|
||||
connect(&proc, SIGNAL(finished(int,QProcess::ExitStatus)),
|
||||
this, SLOT(compilerFinished(int,QProcess::ExitStatus)) );
|
||||
|
||||
proc.start(path, args);
|
||||
|
||||
currentStopButton->setText(tr("Stop"));
|
||||
currentStopButton->setEnabled(true);
|
||||
|
||||
if ( !proc.waitForStarted() )
|
||||
{
|
||||
opError(cnf.fwobj);
|
||||
addToLog( tr("Error: Failed to start program") );
|
||||
blockInstallForFirewall(cnf.fwobj);
|
||||
setUpProcessToCompile();
|
||||
if (!executeCommand(path, args))
|
||||
QTimer::singleShot( 0, this, SLOT(mainLoopCompile()));
|
||||
return false;
|
||||
}
|
||||
args.push_front(path);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -169,7 +169,13 @@ void instDialog::installerFinished(int ret_code, QProcess::ExitStatus status)
|
||||
if( fwbdebug) qDebug("instDialog::installerFinished "
|
||||
"exit code = %d exit_status=%d",
|
||||
ret_code, status);
|
||||
|
||||
// run readFromStdout() and processEvents() to make sure all
|
||||
// events that pass output from the external installer script have
|
||||
// been processed. Otherwise the output from the next installer
|
||||
// pass in batch install mixes with the tail of the output from
|
||||
// the previous one.
|
||||
readFromStdout();
|
||||
qApp->processEvents();
|
||||
if (ret_code==0 && status==QProcess::NormalExit)
|
||||
installerSuccess();
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user