Permalink
Browse files

Fix up exporting jails via the warden GUI.

While here, I made the export process a bit more "chatty" so the user
knows whats going on.
  • Loading branch information...
1 parent 0542f38 commit 4efda4d68210ffa0e0fa40f0aa7b423db7dd0b7e @kmoore134 kmoore134 committed Jan 16, 2014
@@ -734,7 +734,7 @@ void dialogWarden::slotExportJail()
exportFile = QFileDialog::getExistingDirectory(
this,
tr("Choose a directory to save the finished .wdn file:"),
- "/home",
+ "/root",
QFileDialog::ShowDirsOnly );
if ( exportFile.isEmpty() )
@@ -743,37 +743,32 @@ void dialogWarden::slotExportJail()
}
// Lauch the command output dialog
- /*
- dialogOutput = new dialogDisplayOutput(0, "Exporting Jail", Qt::WStyle_Customize | Qt::WShowModal);
+ dialogOutput = new dialogDisplayOutput();
+ dialogOutput->setModal(true);
dialogOutput->programInit(FALSE);
- dialogOutput->setDialogCaption("Exporting Jail: " + popupip);
+ dialogOutput->setDialogCaption(tr("Exporting Jail:") + " " + popupip);
dialogOutput->setDialogText("");
+ tmp = tr("Exporting Jail:") + " " + popupip + "\n";
+ dialogOutput->appendDialogText(tmp);
dialogOutput->show();
- */
-
- // Launch our working dialog to prevent further action until we are finished
- workingDialog = new dialogWorking();
- workingDialog->setModal(true);
- workingDialog->programInit();
- tmp = tr("Exporting Jail");
- workingDialog->setDialogTitle(tmp);
- tmp = tr("Exporting Jail:") + " " + popupip;
- workingDialog->setDialogText(tmp);
- workingDialog->show();
- // Now start the script to stop this jail
+ // Now start the script to stop this jail
exportJailProc = new QProcess( this );
QString program = "warden";
QStringList args;
args << "export" << popupip << "--dir=" + exportFile;
// Connect the exited signal and start the process
- // connect( exportJailProc, SIGNAL(readyReadStdout ()), this, SLOT(slotReadDisplayOutput() ) );
- connect( exportJailProc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(slotFinishedWorking() ) );
+ connect( exportJailProc, SIGNAL(readyReadStandardOutput()), this, SLOT(slotReadExportOutput() ) );
+ connect( exportJailProc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(slotFinishedExport() ) );
exportJailProc->start(program, args);
}
+void dialogWarden::slotFinishedExport()
+{
+ dialogOutput->setCloseHide( false );
+}
void dialogWarden::slotListJailPkgs()
{
@@ -859,14 +854,10 @@ void dialogWarden::runCommand( QString command )
}
-void dialogWarden::slotReadDisplayOutput()
+void dialogWarden::slotReadExportOutput()
{
-
while ( exportJailProc->canReadLine() )
- {
dialogOutput->appendDialogText(exportJailProc->readLine());
- }
-
}
@@ -50,7 +50,6 @@ private slots:
void slotListJailPkgs();
void slotDeleteJail();
void slotFinishedWorking();
- void slotReadDisplayOutput();
void slotFinishedOutput();
void slotReadPkgsOutput();
void slotClickedNewJail();
@@ -72,6 +71,8 @@ private slots:
void slotUpdate();
void slotShowDialogCloseButton();
void slotServiceGUI();
+ void slotReadExportOutput();
+ void slotFinishedExport();
void slotCheckForUpdates();
void slotCheckUpdateReturn();
@@ -12,6 +12,8 @@ EXPORTNAME="$1"
JAILNAME="$1"
OUTDIR="$2"
+if [ -z "${OUTDIR}" ]; then OUTDIR="$WTMP" ; fi
+
if [ -z "${EXPORTNAME}" ]
then
echo "ERROR: No jail specified to export!"
@@ -35,9 +37,11 @@ fi
set_warden_metadir
# First check if this jail is running, and stop it
+echo "Checking jail status..."
${PROGDIR}/scripts/backend/checkstatus.sh "${EXPORTNAME}"
if [ "$?" = "0" ]
then
+ echo "Stopping jail for export..."
${PROGDIR}/scripts/backend/stopjail.sh "${EXPORTNAME}"
fi
@@ -63,11 +67,12 @@ get_ip_and_netmask "${IP6}"
IP6="${JIP}"
MASK6="${JMASK}"
-echo "Creating compressed archive of ${EXPORTNAME}... Please Wait..." >&1
+echo "Creating compressed archive of ${EXPORTNAME}... Please Wait..."
tar cvJf "${WTMP}/${EXPORTNAME}.txz" -C "${JAILDIR}" . 2>${WTMP}/${EXPORTNAME}.files
cd ${WTMP}
+echo "Creating jail metadata..."
LINES="`wc -l ${EXPORTNAME}.files | sed -e 's, ,,g' | cut -d '.' -f 1`"
# Finished, now make the header info
@@ -108,13 +113,12 @@ do
rm $mFile
done
-if [ ! -z "${OUTDIR}" ]
-then
- mkdir -p ${OUTDIR} 2>/dev/null
+if [ ! -d "$OUTDIR" ] ; then
+ mkdir -p ${OUTDIR}
+fi
+if [ "$OUTDIR" != "$WTMP" ] ; then
mv ${EXPORTNAME}.wdn ${OUTDIR}/
- echo "Created ${EXPORTNAME}.wdn in ${OUTDIR}" >&1
-else
- echo "Created ${EXPORTNAME}.wdn in ${WTMP}" >&1
fi
+echo "Created ${EXPORTNAME}.wdn in ${OUTDIR}" >&1
exit 0

0 comments on commit 4efda4d

Please sign in to comment.