summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg/ipkg.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/aqpkg/ipkg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/ipkg.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp
index 6d0edad..02d4258 100644
--- a/noncore/settings/aqpkg/ipkg.cpp
+++ b/noncore/settings/aqpkg/ipkg.cpp
@@ -32,25 +32,25 @@ using namespace std;
#include "utils.h"
#include "ipkg.h"
#include "global.h"
Ipkg :: Ipkg()
{
}
Ipkg :: ~Ipkg()
{
}
-// Option is what we are going to do - install, upgrade, download
+// Option is what we are going to do - install, upgrade, download, reinstall
// package is the package name to install - either a fully qualified path and ipk
// file (if stored locally) or just the name of the package (for a network package)
// packageName is the package name - (for a network package this will be the same as
// package parameter)
// dest is the destination alias (from ipk.conf)
// destDir is the dir that the destination alias points to (used to link to root)
// flags is the ipkg options flags
// dir is the directory to run ipkg in (defaults to "")
bool Ipkg :: runIpkg( )
{
bool ret = false;
@@ -80,61 +80,67 @@ bool Ipkg :: runIpkg( )
cmd += " -force-overwrite";
// Handle make links
// Rules - If make links is switched on, create links to root
// if destDir is NOT /
if ( flags & MAKE_LINKS )
{
// If destDir == / turn off make links as package is being insalled
// to root already.
if ( destDir == "/" )
flags ^= MAKE_LINKS;
}
-
}
#ifdef X86
cmd += " -f ";
cmd += IPKG_CONF;
#endif
- cmd += " " + option;
+
+ if ( option == "reinstall" )
+ cmd += " install";
+ else
+ cmd += " " + option;
if ( option != "upgrade" )
cmd += " " + package;
cmd += " 2>&1";
+
+ emit outputText( QString( "Dealing with package " ) + package );
+
qApp->processEvents();
// If we are removing packages and make links option is selected
// create the links
- if ( option == "remove" )
+ if ( option == "remove" || option == "reinstall" )
{
createLinks = false;
if ( flags & MAKE_LINKS )
{
emit outputText( QString( "Removing symbolic links...\n" ) );
linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir );
emit outputText( QString( " " ) );
}
}
emit outputText( cmd );
// Execute command
dependantPackages = new QList<QString>;
dependantPackages->setAutoDelete( true );
ret = executeIpkgCommand( cmd, option );
- if ( option == "install" )
+ if ( option == "install" || option == "reinstall" )
{
// If we are not removing packages and make links option is selected
// create the links
createLinks = true;
if ( flags & MAKE_LINKS )
{
emit outputText( " " );
emit outputText( QString( "Creating symbolic links for " )+ package );
linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir );
// link dependant packages that were installed with this release
@@ -144,24 +150,25 @@ bool Ipkg :: runIpkg( )
if ( *pkg == package )
continue;
emit outputText( " " );
emit outputText( QString( "Creating symbolic links for " )+ (*pkg) );
linkPackage( Utils::getPackageNameFromIpkFilename( *pkg ), destination, destDir );
}
}
}
delete dependantPackages;
emit outputText( QString( "Finished - status=" ) + (ret ? "success" : "failure") );
+ emit outputText( "" );
return ret;
}
int Ipkg :: executeIpkgCommand( QString &cmd, const QString option )
{
FILE *fp = NULL;
char line[130];
QString lineStr, lineStrOld;
int ret = false;
fp = popen( (const char *) cmd, "r");
@@ -173,25 +180,25 @@ int Ipkg :: executeIpkgCommand( QString &cmd, const QString option )
emit outputText( text );
}
else
{
while ( fgets( line, sizeof line, fp) != NULL )
{
lineStr = line;
lineStr=lineStr.left( lineStr.length()-1 );
if ( lineStr != lineStrOld )
{
//See if we're finished
- if ( option == "install" )
+ if ( option == "install" || option == "reinstall" )
{
// Need to keep track of any dependant packages that get installed
// so that we can create links to them as necessary
if ( lineStr.startsWith( "Installing " ) )
{
cout << "LineStr = " << lineStr << endl;
int start = lineStr.find( " " ) + 1;
int end = lineStr.find( " ", start );
QString *package = new QString( lineStr.mid( start, end-start ) );
dependantPackages->append( package );
cout << "installing dependant package <" << *package << ">" << endl;
}
@@ -233,29 +240,29 @@ void Ipkg :: linkPackage( const QString &packFileName, const QString &dest, cons
qApp->processEvents();
QStringList *fileList = getList( packFileName, destDir );
qApp->processEvents();
processFileList( fileList, destDir );
delete fileList;
}
QStringList* Ipkg :: getList( const QString &packageFilename, const QString &destDir )
{
QString packageFileDir = destDir+"/usr/lib/ipkg/info/"+packageFilename+".list";
QFile f( packageFileDir );
- cout << "Try to open " << packageFileDir.latin1() << endl;
+ cout << "Try to open " << packageFileDir << endl;
if ( !f.open(IO_ReadOnly) )
{
// Couldn't open from dest, try from /
-// cout << "Could not open:" << packageFileDir << endl;
+ cout << "Could not open:" << packageFileDir << endl;
f.close();
packageFileDir = "/usr/lib/ipkg/info/"+packageFilename+".list";
f.setName( packageFileDir );
// cout << "Try to open " << packageFileDir.latin1() << endl;
if ( ! f.open(IO_ReadOnly) )
{
cout << "Could not open:" << packageFileDir << endl;
emit outputText( QString( "Could not open :" ) + packageFileDir );
return (QStringList*)0;
}
}