[PC-BSD Commits] r15688 - pcbsd/current/src-qt4/pc-softwaremanager
svn at pcbsd.org
svn at pcbsd.org
Mon Mar 5 11:54:11 PST 2012
Author: kris
Date: 2012-03-05 19:54:10 +0000 (Mon, 05 Mar 2012)
New Revision: 15688
Modified:
pcbsd/current/src-qt4/pc-softwaremanager/main.cpp
pcbsd/current/src-qt4/pc-softwaremanager/softconfigwidget.cpp
pcbsd/current/src-qt4/pc-softwaremanager/softconfigwidget.h
pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp
pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.h
pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbibrowser.cpp
pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbiupdate.cpp
Log:
Make the AppCafe "Warden" aware
Modified: pcbsd/current/src-qt4/pc-softwaremanager/main.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/main.cpp 2012-03-05 19:33:52 UTC (rev 15687)
+++ pcbsd/current/src-qt4/pc-softwaremanager/main.cpp 2012-03-05 19:54:10 UTC (rev 15688)
@@ -24,14 +24,23 @@
PBM w;
- w.ProgramInit();
-
- if ( argc == 2)
+ if ( argc >= 2)
{
QString chkarg = argv[1];
+ // Running in a warden jail?
+ if ( chkarg == "-warden" )
+ if ( argc == 4 )
+ w.setWardenMode(QString(argv[2]), QString(argv[3]));
+ else {
+ qDebug() << "Usage: -warden <directory> <ip>";
+ exit(1);
+ }
+ // Show the installed tab?
if ( chkarg == "-installed" )
- w.showInstalledTab();
+ w.showInstalledTab();
}
+
+ w.ProgramInit();
w.show();
Modified: pcbsd/current/src-qt4/pc-softwaremanager/softconfigwidget.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softconfigwidget.cpp 2012-03-05 19:33:52 UTC (rev 15687)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softconfigwidget.cpp 2012-03-05 19:54:10 UTC (rev 15688)
@@ -20,9 +20,11 @@
#include "softmanager-main.h"
#include "ui_softconfigwidget.h"
-void softwareConfigWidget::programInit()
+void softwareConfigWidget::programInit(QString wDir, QString wIP)
{
displayRepos();
+ wardenDir = wDir;
+ wardenIP = wIP;
// Our buttons / slots
connect( pushSave, SIGNAL( clicked() ), this, SLOT( slotSaveClicked() ) );
@@ -65,7 +67,10 @@
qDebug() << "Updating mirrors...";
QProcess rpocmd;
- rpocmd.start(QString("pc-su"), QStringList() << "pbi_listrepo --mirror " + mirrors.join(",") + " " + pbiRepos.getID(curRepo) );
+ if ( wardenDir.isEmpty() )
+ rpocmd.start(QString("pc-su"), QStringList() << "pbi_listrepo --mirror " + mirrors.join(",") + " " + pbiRepos.getID(curRepo) );
+ else
+ rpocmd.start(QString("warden"), QStringList() << "chroot" << wardenIP << "pbi_listrepo --mirror " + mirrors.join(",") + " " + pbiRepos.getID(curRepo) );
setEnabled(false);
rpocmd.waitForFinished(1000);
while ( rpocmd.state() != QProcess::NotRunning ) {
Modified: pcbsd/current/src-qt4/pc-softwaremanager/softconfigwidget.h
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softconfigwidget.h 2012-03-05 19:33:52 UTC (rev 15687)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softconfigwidget.h 2012-03-05 19:54:10 UTC (rev 15688)
@@ -16,7 +16,7 @@
setupUi(this);
}
- void programInit();
+ void programInit(QString, QString);
void loadRepos(Repo tmpRepos, int editRepo);
public slots:
@@ -38,6 +38,8 @@
void displayRepos();
void loadSettings();
void saveSettings();
+ QString wardenDir;
+ QString wardenIP;
signals:
void saved();
Modified: pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp 2012-03-05 19:33:52 UTC (rev 15687)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp 2012-03-05 19:54:10 UTC (rev 15688)
@@ -90,7 +90,10 @@
// Setup the filewatcher and PopulateList
fileWatcher = new QFileSystemWatcher();
- fileWatcher->addPath("/var/db/pbi/installed");
+ if ( wardenDir.isEmpty() )
+ fileWatcher->addPath("/var/db/pbi/installed");
+ else
+ fileWatcher->addPath(wardenDir + "/var/db/pbi/installed");
connect(fileWatcher, SIGNAL(directoryChanged(const QString&)), this, SLOT(PopulateList()));
// Load any saved states for PBIs
@@ -189,7 +192,11 @@
QApplication::processEvents();
// Add the repo
- QString cmd = "pc-su pbi_addrepo " + fileName;
+ QString cmd;
+ if ( wardenDir.isEmpty() )
+ cmd = "pc-su pbi_addrepo " + fileName;
+ else
+ cmd = getPBICmd(QString("pbi_addrepo " + fileName));
system(cmd.toLatin1());
// Refresh the browser
@@ -207,7 +214,7 @@
// Create the repo config dialog
softConfig = new softwareConfigWidget();
softConfig->loadRepos(tmpRepo, curRepo);
- softConfig->programInit();
+ softConfig->programInit(wardenDir, wardenIP);
softConfig->setModal(true);
connect( softConfig, SIGNAL( saved() ), this, SLOT( slotRepoSaved() ) );
softConfig->show();
@@ -223,7 +230,10 @@
void PBM::RemoveButtonSlot()
{
//Stop the scanner from interfering
- fileWatcher->removePath("/var/db/pbi/installed");
+ if ( wardenDir.isEmpty() )
+ fileWatcher->removePath("/var/db/pbi/installed");
+ else
+ fileWatcher->removePath(wardenDir + "/var/db/pbi/installed");
QTreeWidgetItemIterator it(SoftwareListBox);
while (*it) {
@@ -269,7 +279,10 @@
qDebug() << "Done after cancel/remove";
//Restart scanner
- fileWatcher->addPath("/var/db/pbi/installed");
+ if ( wardenDir.isEmpty() )
+ fileWatcher->addPath("/var/db/pbi/installed");
+ else
+ fileWatcher->addPath( wardenDir + "/var/db/pbi/installed");
tabPBM->setEnabled(TRUE);
return;
@@ -303,25 +316,37 @@
/********************/
QProcess pbiicondel;
- pbiicondel.start(QString("pbi_icon"), QStringList() << "del-desktop" << pbi->getProgIndexName() );
+ if ( wardenDir.isEmpty() )
+ pbiicondel.start(QString("pbi_icon"), QStringList() << "del-desktop" << pbi->getProgIndexName());
+ else
+ pbiicondel.start(QString("warden"), QStringList() << "chroot" << wardenIP << "pbi_icon del-desktop " + pbi->getProgIndexName());
while ( pbiicondel.state() != QProcess::NotRunning ) {
pbiicondel.waitForFinished(50);
QCoreApplication::processEvents();
}
- pbiicondel.start(QString("pbi_icon"), QStringList() << "del-menu" << pbi->getProgIndexName() );
+ if ( wardenDir.isEmpty() )
+ pbiicondel.start(QString("pbi_icon"), QStringList() << "del-menu" << pbi->getProgIndexName());
+ else
+ pbiicondel.start(QString("warden"), QStringList() << "chroot" << wardenIP << "pbi_icon del-menu " + pbi->getProgIndexName());
while ( pbiicondel.state() != QProcess::NotRunning ) {
pbiicondel.waitForFinished(50);
QCoreApplication::processEvents();
}
- pbiicondel.start(QString("pbi_icon"), QStringList() << "del-mime" << pbi->getProgIndexName() );
+ if ( wardenDir.isEmpty() )
+ pbiicondel.start(QString("pbi_icon"), QStringList() << "del-mime" << pbi->getProgIndexName());
+ else
+ pbiicondel.start(QString("warden"), QStringList() << "chroot" << wardenIP << "pbi_icon del-mime " + pbi->getProgIndexName());
while ( pbiicondel.state() != QProcess::NotRunning ) {
pbiicondel.waitForFinished(50);
QCoreApplication::processEvents();
}
- pbiicondel.start(QString("pbi_icon"), QStringList() << "del-pathlnk" << pbi->getProgIndexName() );
+ if ( wardenDir.isEmpty() )
+ pbiicondel.start(QString("pbi_icon"), QStringList() << "del-pathlnk" << pbi->getProgIndexName());
+ else
+ pbiicondel.start(QString("warden"), QStringList() << "chroot" << wardenIP << "pbi_icon del-pathlnk " + pbi->getProgIndexName());
while ( pbiicondel.state() != QProcess::NotRunning ) {
pbiicondel.waitForFinished(50);
QCoreApplication::processEvents();
@@ -331,10 +356,15 @@
// Do the delete now
QProcess pbicmd;
- if ( pbi->getInstallBy() == "root" || pbi->getInstallBy() != RealUserName)
- pbicmd.start(QString("pc-su"), QStringList() << "pbi_delete" << pbi->getProgIndexName() );
- else
- pbicmd.start(QString("pbi_delete"), QStringList() << pbi->getProgIndexName() );
+ if ( wardenDir.isEmpty() ) {
+ if ( pbi->getInstallBy() == "root" || pbi->getInstallBy() != RealUserName)
+ pbicmd.start(QString("pc-su"), QStringList() << "pbi_delete" << pbi->getProgIndexName() );
+ else
+ pbicmd.start(QString("pbi_delete"), QStringList() << pbi->getProgIndexName() );
+ } else {
+ // Using warden
+ pbicmd.start(QString("warden"), QStringList() << "chroot" << wardenIP << "pbi_delete " + pbi->getProgIndexName() );
+ }
while ( pbicmd.state() != QProcess::NotRunning ) {
pbicmd.waitForFinished(50);
QCoreApplication::processEvents();
@@ -456,7 +486,10 @@
loadPBIs = new QProcess();
loadPBIs->setProcessChannelMode(QProcess::MergedChannels);
- loadPBIs->start(QString("pbi_info"), QStringList() << "-v");
+ if ( wardenDir.isEmpty() )
+ loadPBIs->start(QString("pbi_info"), QStringList() << "-v");
+ else
+ loadPBIs->start(QString("warden"), QStringList() << "chroot" << wardenIP << "pbi_info -v");
loadPBIs->waitForFinished(-1);
repoID="-1";
@@ -480,7 +513,10 @@
installBy = line.replace("InstalledBy: ", "");
if ( line.indexOf("Icon:") == 0)
- icon = line.replace("Icon: ", "");
+ if ( wardenDir.isEmpty() )
+ icon = line.replace("Icon: ", "");
+ else
+ icon = wardenDir + line.replace("Icon: ", "");
if ( line.indexOf("Author:") == 0)
author = line.replace("Author: ", "");
@@ -712,3 +748,25 @@
{
tabPBM->setCurrentIndex(1);
}
+
+void PBM::setWardenMode(QString wdir, QString wip)
+{
+ QDir testDir(wdir);
+ if ( ! testDir.exists() ) {
+ QMessageBox::critical(this, tr("AppCafe"),
+ tr("Invalid warden directory:") + " " + wdir,
+ QMessageBox::Ok, QMessageBox::Ok);
+ exit(1);
+ }
+ wardenDir = wdir;
+ wardenIP = wip;
+ setWindowTitle(tr("AppCafe - Warden") + " " + wardenIP );
+}
+
+QString PBM::getPBICmd(QString cmd)
+{
+ if ( wardenDir.isEmpty() )
+ return cmd;
+
+ return QString("warden chroot " + wardenIP + " \"" + cmd + "\"");
+}
Modified: pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.h
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.h 2012-03-05 19:33:52 UTC (rev 15687)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.h 2012-03-05 19:54:10 UTC (rev 15688)
@@ -49,6 +49,7 @@
void ProgramInit();
void showInstalledTab();
+ void setWardenMode(QString, QString);
public slots:
@@ -128,6 +129,9 @@
void setupMenuBar();
void startPBIDirLoad();
+ // Function to return right pbi command to use
+ QString getPBICmd(QString cmd);
+
// PBI Browser
AvailPBI *pbiAvail;
Category *pbiCats;
@@ -188,6 +192,8 @@
QString Version;
QString Arch;
QString Lang;
+ QString wardenDir;
+ QString wardenIP;
QProcess *checkPBIProc;
QProcess *upgradePBIProc;
Modified: pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbibrowser.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbibrowser.cpp 2012-03-05 19:33:52 UTC (rev 15687)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbibrowser.cpp 2012-03-05 19:54:10 UTC (rev 15688)
@@ -582,11 +582,14 @@
// Make sure we have a meta-file
if ( pbiRepos->getMeta(i).isEmpty() || ! QFile::exists(pbiRepos->getMeta(i) ) )
continue;
- QFile mFile(pbiRepos->getMeta(i));
+ QFile mFile;
+ if ( wardenDir.isEmpty() )
+ mFile.setFileName(pbiRepos->getMeta(i));
+ else
+ mFile.setFileName(wardenDir + pbiRepos->getMeta(i));
if ( ! mFile.open(QIODevice::ReadOnly | QIODevice::Text))
continue;
-
if ( Lang.section("_", 0, 0).toUpper() == Lang.section("_", 1, 1).toUpper() )
langkey=Lang.section("_", 0, 0);
else
@@ -642,14 +645,24 @@
qDebug() << "Getting PBIs for repo:" << repoID;
// Make sure we have a meta-file and index file
- if ( pbiRepos->getMeta(r).isEmpty() || ! QFile::exists(pbiRepos->getMeta(r)) || pbiRepos->getIndex(r).isEmpty() || ! QFile::exists(pbiRepos->getIndex(r)) ) {
- QMessageBox::warning( this, tr("Warning!"), tr("Missing meta-files for RepoID:") + " " + repoID + ". " + tr("This is normally due to the internet connection being offline or mis-configured.") );
- continue;
-
- }
+ if ( wardenDir.isEmpty() ) {
+ if ( pbiRepos->getMeta(r).isEmpty() || ! QFile::exists(pbiRepos->getMeta(r)) || pbiRepos->getIndex(r).isEmpty() || ! QFile::exists(pbiRepos->getIndex(r)) ) {
+ QMessageBox::warning( this, tr("Warning!"), tr("Missing meta-files for RepoID:") + " " + repoID + ". " + tr("This is normally due to the internet connection being offline or mis-configured.") );
+ continue;
+ }
+ } else {
+ if ( pbiRepos->getMeta(r).isEmpty() || ! QFile::exists(wardenDir + pbiRepos->getMeta(r)) || pbiRepos->getIndex(r).isEmpty() || ! QFile::exists(wardenDir + pbiRepos->getIndex(r)) ) {
+ QMessageBox::warning( this, tr("Warning!"), tr("Missing meta-files for RepoID:") + " " + repoID + ". " + tr("This is normally due to the internet connection being offline or mis-configured.") );
+ continue;
+ }
+ } // End of warden check
// Start by loading index file into memory
- QFile iFile(pbiRepos->getIndex(r));
+ QFile iFile;
+ if ( wardenDir.isEmpty() )
+ iFile.setFileName(pbiRepos->getIndex(r));
+ else
+ iFile.setFileName(wardenDir + pbiRepos->getIndex(r));
if ( ! iFile.open(QIODevice::ReadOnly | QIODevice::Text))
continue;
@@ -665,7 +678,11 @@
iFile.close();
// Now lets read the meta-file for applications
- QFile mFile(pbiRepos->getMeta(r));
+ QFile mFile;
+ if ( wardenDir.isEmpty() )
+ mFile.setFileName(pbiRepos->getMeta(r));
+ else
+ mFile.setFileName(wardenDir + pbiRepos->getMeta(r));
if ( ! mFile.open(QIODevice::ReadOnly | QIODevice::Text))
continue;
@@ -718,7 +735,10 @@
icon = tmp.section(';', 2, 2);
tmpicon = icon;
tmpicon.remove(0, icon.lastIndexOf("."));
- icon = "/var/db/pbi/repo-icons/" + pbiRepos->getMd5(r) + "-" + name + tmpicon;
+ if ( wardenDir.isEmpty() )
+ icon = "/var/db/pbi/repo-icons/" + pbiRepos->getMd5(r) + "-" + name + tmpicon;
+ else
+ icon = wardenDir + "/var/db/pbi/repo-icons/" + pbiRepos->getMd5(r) + "-" + name + tmpicon;
auth = tmp.section(';', 3, 3);
url = tmp.section(';', 4, 4);
lic = tmp.section(';', 5, 5);
@@ -771,9 +791,18 @@
qDebug() << "Adding Categories for repoID:" << pbiRepos->getID(i);
// Make sure we have a meta-file
- if ( pbiRepos->getMeta(i).isEmpty() || ! QFile::exists(pbiRepos->getMeta(i) ) )
- continue;
- QFile mFile(pbiRepos->getMeta(i));
+ if ( wardenDir.isEmpty() )
+ if ( pbiRepos->getMeta(i).isEmpty() || ! QFile::exists(pbiRepos->getMeta(i) ) )
+ continue;
+ else
+ if ( pbiRepos->getMeta(i).isEmpty() || ! QFile::exists(wardenDir + pbiRepos->getMeta(i) ) )
+ continue;
+
+ QFile mFile;
+ if ( wardenDir.isEmpty() )
+ mFile.setFileName(pbiRepos->getMeta(i));
+ else
+ mFile.setFileName(wardenDir + pbiRepos->getMeta(i));
if ( ! mFile.open(QIODevice::ReadOnly | QIODevice::Text))
continue;
@@ -797,7 +826,10 @@
// Get the local filename for this icon
icontmp = icon;
icontmp.remove(0, icon.lastIndexOf("."));
- icon = "/var/db/pbi/repo-icons/" + pbiRepos->getMd5(i) + "-" + name + icontmp;
+ if ( wardenDir.isEmpty() )
+ icon = "/var/db/pbi/repo-icons/" + pbiRepos->getMd5(i) + "-" + name + icontmp;
+ else
+ icon = wardenDir + "/var/db/pbi/repo-icons/" + pbiRepos->getMd5(i) + "-" + name + icontmp;
desc = tmp.section(';', 2, 2).simplified();
desc = getTranslation(pbiRepos->getID(i), "Cat", name, desc);
@@ -816,7 +848,10 @@
qDebug() << "Adding Repos...";
QProcess rpocmd;
- rpocmd.start(QString("pbi_listrepo"), QStringList() );
+ if ( wardenDir.isEmpty() )
+ rpocmd.start(QString("pbi_listrepo"), QStringList() );
+ else
+ rpocmd.start(QString("warden"), QStringList() << "chroot" << wardenIP << "pbi_listrepo" );
while ( rpocmd.state() != QProcess::NotRunning ) {
rpocmd.waitForFinished(50);
@@ -840,7 +875,10 @@
// Get the details for this ID
qDebug() << "Getting details for repoID: " << id;
QProcess rpocmd2;
- rpocmd2.start(QString("pbi_listrepo"), QStringList() << id );
+ if ( wardenDir.isEmpty() )
+ rpocmd2.start(QString("pbi_listrepo"), QStringList() << id );
+ else
+ rpocmd2.start(QString("warden"), QStringList() << "chroot" << wardenIP << "pbi_listrepo " + id );
rpocmd2.waitForFinished();
while(rpocmd2.canReadLine() ) {
tmp2 = rpocmd2.readLine().simplified();
@@ -1010,10 +1048,13 @@
QCoreApplication::processEvents();
QString sCmd;
- if ( pbiItem->getInstallBy() == "root" || pbiItem->getInstallBy() != RealUserName)
- sCmd="pc-su \"pbi_update " + arg + " " + pbiItem->getNameCLI() + "\"";
- else
- sCmd="pbi_update " + arg + " " + pbiItem->getNameCLI();
+ if (wardenDir.isEmpty() ) {
+ if ( pbiItem->getInstallBy() == "root" || pbiItem->getInstallBy() != RealUserName)
+ sCmd="pc-su \"pbi_update " + arg + " " + pbiItem->getNameCLI() + "\"";
+ else
+ sCmd="pbi_update " + arg + " " + pbiItem->getNameCLI();
+ } else
+ sCmd=getPBICmd("pbi_update " + arg + " " + pbiItem->getNameCLI());
system(sCmd.toLatin1());
Modified: pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbiupdate.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbiupdate.cpp 2012-03-05 19:33:52 UTC (rev 15687)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbiupdate.cpp 2012-03-05 19:54:10 UTC (rev 15688)
@@ -57,7 +57,10 @@
checkPBIProc = new QProcess();
checkPBIProc->setProcessChannelMode(QProcess::MergedChannels);
connect(checkPBIProc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(slotPBIUpdateCheckDone()) );
- checkPBIProc->start(QString("pbi_update"), QStringList() << "-c" << item->getProgIndexName() );
+ if ( wardenDir.isEmpty() )
+ checkPBIProc->start(QString("pbi_update"), QStringList() << "-c" << item->getProgIndexName() );
+ else
+ checkPBIProc->start(QString("warden"), QStringList() << "chroot" << wardenIP << "pbi_update -c " + item->getProgIndexName() );
}
@@ -237,7 +240,10 @@
return;
}
- fileWatcher->removePath("/var/db/pbi/installed");
+ if ( wardenDir.isEmpty() )
+ fileWatcher->removePath("/var/db/pbi/installed");
+ else
+ fileWatcher->removePath( wardenDir + "/var/db/pbi/installed");
// Update the status if the attempted download worked
if ( item->getDownloadAttempts() >= 1)
@@ -261,17 +267,28 @@
// Doing a new download
if ( item->getWorkingStatus() == PBINEWDOWNLOAD ) {
+ if ( wardenDir.isEmpty() ) {
if (item->getInstallBy() == "root" )
- upgradePBIProc->start(QString("/usr/local/bin/pc-su"), QStringList() << "pbi_add" << "-f" << "--repo" << item->getDownloadRepo() << "--rArch" << item->getDownloadArch() << "--rVer" << item->getDownloadVersion() << "-r" << item->getName());
+ upgradePBIProc->start(QString("/usr/local/bin/pc-su"), QStringList() << "pbi_add" << "-f" << "--repo" << item->getDownloadRepo() << "--rArch" << item->getDownloadArch() << "--rVer" << item->getDownloadVersion() << "-r" << item->getName());
else
- upgradePBIProc->start(QString("pbi_add"), QStringList() << "-f" << "--repo" << item->getDownloadRepo() << "--rArch" << item->getDownloadArch() << "--rVer" << item->getDownloadVersion() << "-r" << item->getName());
+ upgradePBIProc->start(QString("pbi_add"), QStringList() << "-f" << "--repo" << item->getDownloadRepo() << "--rArch" << item->getDownloadArch() << "--rVer" << item->getDownloadVersion() << "-r" << item->getName());
+ } else {
+ // Using warden jail
+ upgradePBIProc->start(QString("warden"), QStringList() << "chroot" << wardenIP << "pbi_add -f --repo " + item->getDownloadRepo() + " --rArch " + item->getDownloadArch() + " --rVer " + item->getDownloadVersion() + " -r " + item->getName());
+ qDebug() << QString("warden") << "chroot" << wardenIP << "pbi_add -f --repo " + item->getDownloadRepo() + " --rArch " + item->getDownloadArch() + " --rVer " + item->getDownloadVersion() + " -r " + item->getName();
+ }
// Doing an upgrade
} else {
+ if ( wardenDir.isEmpty() ) {
if (item->getInstallBy() == "root" )
- upgradePBIProc->start(QString("/usr/local/bin/pc-su"), QStringList() << "pbi_update" << item->getProgIndexName());
+ upgradePBIProc->start(QString("/usr/local/bin/pc-su"), QStringList() << "pbi_update" << item->getProgIndexName());
else
- upgradePBIProc->start(QString("pbi_update"), QStringList() << item->getProgIndexName());
+ upgradePBIProc->start(QString("pbi_update"), QStringList() << item->getProgIndexName());
+ } else {
+ // Doing warden update
+ upgradePBIProc->start(QString("warden"), QStringList() << "chroot" << wardenIP << "pbi_update " + item->getProgIndexName());
+ }
}
// Set the flag that we are working on this PBI
@@ -360,7 +377,10 @@
//saveStatePBI();
// Restart the PBI file watcher
- fileWatcher->addPath("/var/db/pbi/installed");
+ if ( wardenDir.isEmpty() )
+ fileWatcher->addPath("/var/db/pbi/installed");
+ else
+ fileWatcher->addPath( wardenDir + "/var/db/pbi/installed");
// Mark this PBI as finished
isWorkingOnPBI = false;
@@ -611,19 +631,22 @@
void PBM::installMenuIcon(PBI *pbi, bool asRoot)
{
installPBIDesktopIcon = new QProcess();
- if ( asRoot ) {
- QString cmd = "pbi_icon add-menu " + pbi->getProgIndexName();
- // + " ; pbi_icon add-mime " + pbi->getProgIndexName();
- installPBIDesktopIcon->start(QString("pc-su"), QStringList() << cmd );
- } else {
- installPBIDesktopIcon->start(QString("pbi_icon"), QStringList() << "add-menu " + pbi->getProgIndexName() + "; pbi_icon add mime " + pbi->getProgIndexName() );
- }
+ if ( wardenDir.isEmpty() ) {
+ if ( asRoot ) {
+ QString cmd = "pbi_icon add-menu " + pbi->getProgIndexName();
+ // + " ; pbi_icon add-mime " + pbi->getProgIndexName();
+ installPBIDesktopIcon->start(QString("pc-su"), QStringList() << cmd );
+ } else {
+ installPBIDesktopIcon->start(QString("pbi_icon"), QStringList() << "add-menu " + pbi->getProgIndexName() + "; pbi_icon add mime " + pbi->getProgIndexName() );
+ }
+ } else
+ installPBIDesktopIcon->start(QString("warden"), QStringList() << "chroot" << wardenIP << "pbi_icon add-menu " + pbi->getProgIndexName() + "; pbi_icon add mime " + pbi->getProgIndexName() );
}
// Installs desktop icons for this PBI
void PBM::installDesktopIcon(PBI *pbi)
{
- QString cmd = "pbi_icon add-desktop " + pbi->getProgIndexName();
+ QString cmd = getPBICmd("pbi_icon add-desktop " + pbi->getProgIndexName());
qDebug() << "Running:" << cmd;
system(cmd.toLatin1());
}
More information about the Commits
mailing list