Diffstat (limited to 'noncore/unsupported/oipkg/pmipkg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 0ae74da..5996e63 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -30,30 +30,31 @@ PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlag | |||
30 | : QObject ( p ) | 30 | : QObject ( p ) |
31 | { | 31 | { |
32 | settings = s; | 32 | settings = s; |
33 | runwindow = new RunWindow( p, name, true, f ); | 33 | runwindow = new RunWindow( p, name, true, f ); |
34 | } | 34 | } |
35 | 35 | ||
36 | PmIpkg::~PmIpkg() | 36 | PmIpkg::~PmIpkg() |
37 | { | 37 | { |
38 | } | 38 | } |
39 | 39 | ||
40 | //#define PROC | 40 | //#define PROC |
41 | #define SYSTEM | 41 | #define SYSTEM |
42 | #define QT_QPROCESS_DEBUG | ||
42 | int PmIpkg::runIpkg(const QString& args, const QString& dest ) | 43 | int PmIpkg::runIpkg(const QString& args, const QString& dest ) |
43 | { | 44 | { |
44 | pvDebug(2,"PmIpkg::runIpkg "+args); | 45 | pvDebug(2,"PmIpkg::runIpkg "+args); |
45 | 46 | QDir::setCurrent("/tmp"); | |
46 | #ifdef PROC | 47 | #ifdef PROC |
47 | QStringList cmd = "ipkg "; | 48 | QString cmd; |
48 | #endif | 49 | #endif |
49 | #ifdef SYSTEM | 50 | #ifdef SYSTEM |
50 | QString cmd = "/usr/bin/ipkg "; | 51 | QString cmd = "/usr/bin/ipkg "; |
51 | #endif | 52 | #endif |
52 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); | 53 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); |
53 | if ( dest == "" ) | 54 | if ( dest == "" ) |
54 | cmd += " -dest "+settings->getDestinationName(); | 55 | cmd += " -dest "+settings->getDestinationName(); |
55 | else | 56 | else |
56 | cmd += " -dest "+ dest; | 57 | cmd += " -dest "+ dest; |
57 | 58 | ||
58 | cmd += " -force-defaults "; | 59 | cmd += " -force-defaults "; |
59 | 60 | ||
@@ -63,25 +64,25 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) | |||
63 | cmd += " -force-depends "; | 64 | cmd += " -force-depends "; |
64 | if (installDialog->_force_reinstall->isChecked()) | 65 | if (installDialog->_force_reinstall->isChecked()) |
65 | cmd += " -force-reinstall "; | 66 | cmd += " -force-reinstall "; |
66 | if (installDialog->_force_remove->isChecked()) | 67 | if (installDialog->_force_remove->isChecked()) |
67 | cmd += " -force-removal-of-essential-packages "; | 68 | cmd += " -force-removal-of-essential-packages "; |
68 | } | 69 | } |
69 | 70 | ||
70 | out( "<hr><br>Starting to "+ args+"<br>\n"); | 71 | out( "<hr><br>Starting to "+ args+"<br>\n"); |
71 | cmd += args; | 72 | cmd += args; |
72 | int r = 0; | 73 | int r = 0; |
73 | #ifdef PROC | 74 | #ifdef PROC |
74 | QString o = "start"; | 75 | QString o = "start"; |
75 | Process *ipkg = new Process( cmd ); | 76 | Process *ipkg = new Process(QStringList() << "ipkg" << cmd ); |
76 | out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" ); | 77 | out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" ); |
77 | QString description; | 78 | QString description; |
78 | r = ipkg->exec("",o); | 79 | r = ipkg->exec("",o); |
79 | out( o ); | 80 | out( o ); |
80 | #endif | 81 | #endif |
81 | #ifdef SYSTEM | 82 | #ifdef SYSTEM |
82 | out( "running:<br>\n"+cmd+"<br>\n" ); | 83 | out( "running:<br>\n"+cmd+"<br>\n" ); |
83 | QString redirect = "/tmp/oipkg.pipe"; | 84 | QString redirect = "/tmp/oipkg.pipe"; |
84 | cmd += " 2>&1 | tee "+redirect+" 2>&1"; | 85 | cmd += " 2>&1 | tee "+redirect+" 2>&1"; |
85 | pvDebug(2, "running >"+cmd+"<"); | 86 | pvDebug(2, "running >"+cmd+"<"); |
86 | r = system(cmd.latin1()); | 87 | r = system(cmd.latin1()); |
87 | QFile f( redirect ); | 88 | QFile f( redirect ); |
@@ -288,25 +289,25 @@ void PmIpkg::remove() | |||
288 | out("<br>"); | 289 | out("<br>"); |
289 | } | 290 | } |
290 | 291 | ||
291 | 292 | ||
292 | void PmIpkg::install() | 293 | void PmIpkg::install() |
293 | { | 294 | { |
294 | if ( to_install.count() == 0 ) return; | 295 | if ( to_install.count() == 0 ) return; |
295 | out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); | 296 | out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); |
296 | for (uint i=0; i < to_install.count(); i++) | 297 | for (uint i=0; i < to_install.count(); i++) |
297 | { | 298 | { |
298 | if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() ) == 0 ) | 299 | if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() ) == 0 ) |
299 | { | 300 | { |
300 | runwindow->progress->setProgress( to_install.at(i)->size().toInt() ); | 301 | runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); |
301 | linkOpp = createLink; | 302 | linkOpp = createLink; |
302 | if ( to_install.at(i)->link() ) | 303 | if ( to_install.at(i)->link() ) |
303 | { | 304 | { |
304 | out( "<br>creating links<br>" ); | 305 | out( "<br>creating links<br>" ); |
305 | out( "for package "+to_install.at(i)->name()+" in "+to_install.at(i)->dest()+"<br>" ); | 306 | out( "for package "+to_install.at(i)->name()+" in "+to_install.at(i)->dest()+"<br>" ); |
306 | makeLinks( to_install.at(i) ); | 307 | makeLinks( to_install.at(i) ); |
307 | } | 308 | } |
308 | to_install.at(i)->processed(); | 309 | to_install.at(i)->processed(); |
309 | to_install.take( i ); | 310 | to_install.take( i ); |
310 | out("<br><hr>"); | 311 | out("<br><hr>"); |
311 | }else{ | 312 | }else{ |
312 | out("<b>"+tr("Error while installing")+"</b><hr>"+to_install.at(i)->name()); | 313 | out("<b>"+tr("Error while installing")+"</b><hr>"+to_install.at(i)->name()); |