[PC-BSD Commits] r17447 - pcbsd/current/src-qt4/warden-gui
svn at pcbsd.org
svn at pcbsd.org
Tue Jun 26 06:37:28 PDT 2012
Author: kris
Date: 2012-06-26 13:37:28 +0000 (Tue, 26 Jun 2012)
New Revision: 17447
Modified:
pcbsd/current/src-qt4/warden-gui/dialogdisplayoutput.cpp
pcbsd/current/src-qt4/warden-gui/dialogwarden.cpp
pcbsd/current/src-qt4/warden-gui/dialogwarden.h
pcbsd/current/src-qt4/warden-gui/wizardNewJail.cpp
pcbsd/current/src-qt4/warden-gui/wizardNewJail.h
Log:
Enable creating, removing and running Linux jails via the Warden GUI.
Modified: pcbsd/current/src-qt4/warden-gui/dialogdisplayoutput.cpp
===================================================================
--- pcbsd/current/src-qt4/warden-gui/dialogdisplayoutput.cpp 2012-06-26 13:13:34 UTC (rev 17446)
+++ pcbsd/current/src-qt4/warden-gui/dialogdisplayoutput.cpp 2012-06-26 13:37:28 UTC (rev 17447)
@@ -24,38 +24,27 @@
}
-
void dialogDisplayOutput::setDialogCaption( const QString &text )
{
setWindowTitle(text);
}
-
void dialogDisplayOutput::setDialogText( const QString &text )
{
lineDisplay->setText(text);
}
-
void dialogDisplayOutput::appendDialogText( const QString &text )
{
- QString oldText, newText;
- oldText = lineDisplay->toPlainText();
- newText = oldText + "\n" + text;
- lineDisplay->setText(newText);
+ lineDisplay->insertPlainText(text);
+ lineDisplay->moveCursor(QTextCursor::End);
}
-
-
-
-
-
void dialogDisplayOutput::slotPushClose()
{
accept();
}
-
void dialogDisplayOutput::setCloseHide( bool status )
{
if(status) {
@@ -66,7 +55,6 @@
}
-
void dialogDisplayOutput::closeEvent( QCloseEvent *e )
{
// Ignore a close event until finished
Modified: pcbsd/current/src-qt4/warden-gui/dialogwarden.cpp
===================================================================
--- pcbsd/current/src-qt4/warden-gui/dialogwarden.cpp 2012-06-26 13:13:34 UTC (rev 17446)
+++ pcbsd/current/src-qt4/warden-gui/dialogwarden.cpp 2012-06-26 13:37:28 UTC (rev 17447)
@@ -136,12 +136,6 @@
jD.clear();
- // Check if this jail is created on ZFS
- jZFS="NO";
- for (int z = 0; z < mountOut.size(); ++z)
- if ( mountOut.at(z).indexOf("on " + JailDir + "/" + d[i]) != -1 && mountOut.at(z).indexOf("(zfs,") != -1 )
- jZFS="YES";
-
qDebug() << "Checking:" << d[i];
// Check for the IP of this jail
@@ -156,6 +150,13 @@
jIP = streamip.readLine(); // line of text excluding '\n'
fileIP.close();
+ // Check if this jail is created on ZFS
+ jZFS="NO";
+ for (int z = 0; z < mountOut.size(); ++z)
+ if ( mountOut.at(z).indexOf("on " + JailDir + "/" + jIP) != -1 && mountOut.at(z).indexOf("(zfs,") != -1 )
+ jZFS="YES";
+
+
// Check for the hostname of this jail
QFile file( JailDir + "/" + d[i] + "/host" );
if ( ! file.exists() )
@@ -181,10 +182,13 @@
}
// Check the type of jail
- jType = tr("Standard");
+ jType = "Standard";
QFile file3(JailDir + "/" + d[i] + "/xjail" );
if ( file3.exists() )
- jType = tr("X Jail");
+ jType = "X Jail";
+ QFile filelin(JailDir + "/" + d[i] + "/linuxjail" );
+ if ( filelin.exists() )
+ jType = "Linux Jail";
// Display the jail in the tree widget now
QStringList cols;
@@ -840,14 +844,14 @@
newJailWizard->setModal(true);
newJailWizard->programInit();
- connect( newJailWizard, SIGNAL(create(const QString &, const QString &, bool, const QString &, bool, bool, bool)), this, SLOT(slotCreateNewJail(const QString &, const QString &, bool, const QString &, bool, bool, bool) ) );
+ connect( newJailWizard, SIGNAL(create(const QString &, const QString &, bool, const QString &, bool, bool, bool, bool, const QString &)), this, SLOT(slotCreateNewJail(const QString &, const QString &, bool, const QString &, bool, bool, bool, bool, const QString &) ) );
newJailWizard->show();
}
-void dialogWarden::slotCreateNewJail( const QString &IP, const QString &host, bool tradjail, const QString &rootpw, bool src, bool ports, bool autostart )
+void dialogWarden::slotCreateNewJail( const QString &IP, const QString &host, bool tradjail, const QString &rootpw, bool src, bool ports, bool autostart, bool linuxJail, const QString &linuxScript )
{
- if ( tradjail )
+ if ( tradjail || linuxJail )
newRootPW=rootpw;
else
newRootPW="";
@@ -872,15 +876,18 @@
args << "create" << IP << host;
// Set our optional flags
- if ( ! tradjail )
+ if ( ! tradjail && ! linuxJail )
args << "--portjail";
- if ( src )
+ if ( src && ! linuxJail)
args << "--src";
- if ( ports )
+ if ( ports && ! linuxJail )
args << "--ports";
+ if ( linuxJail )
+ args << "--linuxjail" << linuxScript ;
+
if ( autostart )
args << "--startauto";
@@ -1125,6 +1132,19 @@
if ( jailDetails.at(i).at(0) != listJails->currentItem()->text(0) )
continue;
+ // Depending upon the type of jail, we may need to hide stuff
+ if ( jailDetails.at(i).at(2) == "Linux Jail" ) {
+ pushServiceGUI->setHidden(true);
+ pushUserAdmin->setHidden(true);
+ pushUpdate->setHidden(true);
+ tabJail->setTabEnabled(3, false);
+ } else {
+ pushServiceGUI->setHidden(false);
+ pushUserAdmin->setHidden(false);
+ pushUpdate->setHidden(false);
+ tabJail->setTabEnabled(3, true);
+ }
+
// Load the details now
labelType->setText(jailDetails.at(i).at(2));
labelIPs->setText(jailDetails.at(i).at(3));
@@ -1303,7 +1323,7 @@
{
if ( ! listJails->currentItem() )
return;
- QString cmd = "xterm -e warden chroot " + listJails->currentItem()->text(0) + " &";
+ QString cmd = "xterm -T \"Jail: " + listJails->currentItem()->text(0) + "\" -e warden chroot " + listJails->currentItem()->text(0) + " &";
system(cmd.toLatin1());
}
Modified: pcbsd/current/src-qt4/warden-gui/dialogwarden.h
===================================================================
--- pcbsd/current/src-qt4/warden-gui/dialogwarden.h 2012-06-26 13:13:34 UTC (rev 17446)
+++ pcbsd/current/src-qt4/warden-gui/dialogwarden.h 2012-06-26 13:37:28 UTC (rev 17447)
@@ -51,7 +51,7 @@
void slotFinishedOutput();
void slotReadPkgsOutput();
void slotClickedNewJail();
- void slotCreateNewJail( const QString &, const QString &, bool, const QString &, bool, bool, bool );
+ void slotCreateNewJail( const QString &, const QString &, bool, const QString &, bool, bool, bool, bool, const QString & );
void slotReadCreateOutput();
void slotFinishedJailCreate();
void slotReadUserAddOutput();
Modified: pcbsd/current/src-qt4/warden-gui/wizardNewJail.cpp
===================================================================
--- pcbsd/current/src-qt4/warden-gui/wizardNewJail.cpp 2012-06-26 13:13:34 UTC (rev 17446)
+++ pcbsd/current/src-qt4/warden-gui/wizardNewJail.cpp 2012-06-26 13:37:28 UTC (rev 17447)
@@ -22,6 +22,7 @@
connect(lineHost, SIGNAL(textChanged ( const QString & )), this, SLOT(slotCheckComplete() ) );
connect(lineLinuxScript, SIGNAL(textChanged ( const QString & )), this, SLOT(slotCheckComplete() ) );
connect(pushLinuxScript, SIGNAL(clicked()), this, SLOT(slotSelectLinuxScript()) );
+ connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotCheckComplete()) );
}
@@ -30,7 +31,7 @@
emit create(lineIP->text(), lineHost->text(), radioTraditionalJail->isChecked(),
lineRoot->text(), checkSystemSource->isChecked(), checkPortsTree->isChecked(),
- checkAutostart->isChecked());
+ checkAutostart->isChecked(), radioLinuxJail->isChecked(), lineLinuxScript->text());
close();
}
@@ -49,10 +50,12 @@
button(QWizard::NextButton)->setEnabled(true);
return true;
case Page_Root:
- if ( lineRoot->text() != lineRoot2->text() )
+ if ( lineRoot->text().isEmpty() || lineRoot->text() != lineRoot2->text() ) {
button(QWizard::NextButton)->setEnabled(false);
- else
+ return false;
+ } else {
button(QWizard::NextButton)->setEnabled(true);
+ }
return true;
case Page_Linux:
if ( lineLinuxScript->text().isEmpty() ) {
Modified: pcbsd/current/src-qt4/warden-gui/wizardNewJail.h
===================================================================
--- pcbsd/current/src-qt4/warden-gui/wizardNewJail.h 2012-06-26 13:13:34 UTC (rev 17446)
+++ pcbsd/current/src-qt4/warden-gui/wizardNewJail.h 2012-06-26 13:37:28 UTC (rev 17447)
@@ -30,6 +30,6 @@
enum { Page_IP, Page_Type, Page_Root, Page_Linux, Page_Opts };
signals:
- void create(const QString &, const QString &, bool, const QString &, bool, bool, bool);
+ void create(const QString &, const QString &, bool, const QString &, bool, bool, bool, bool, const QString &);
} ;
#endif // WIZARDCREATEJAIL_H
More information about the Commits
mailing list