summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg/ipkg.cpp
Unidiff
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
@@ -38,13 +38,13 @@ Ipkg :: Ipkg()
38} 38}
39 39
40Ipkg :: ~Ipkg() 40Ipkg :: ~Ipkg()
41{ 41{
42} 42}
43 43
44// Option is what we are going to do - install, upgrade, download 44// Option is what we are going to do - install, upgrade, download, reinstall
45// package is the package name to install - either a fully qualified path and ipk 45// package is the package name to install - either a fully qualified path and ipk
46// file (if stored locally) or just the name of the package (for a network package) 46// file (if stored locally) or just the name of the package (for a network package)
47// packageName is the package name - (for a network package this will be the same as 47// packageName is the package name - (for a network package this will be the same as
48// package parameter) 48// package parameter)
49// dest is the destination alias (from ipk.conf) 49// dest is the destination alias (from ipk.conf)
50// destDir is the dir that the destination alias points to (used to link to root) 50// destDir is the dir that the destination alias points to (used to link to root)
@@ -86,30 +86,36 @@ bool Ipkg :: runIpkg( )
86 { 86 {
87 // If destDir == / turn off make links as package is being insalled 87 // If destDir == / turn off make links as package is being insalled
88 // to root already. 88 // to root already.
89 if ( destDir == "/" ) 89 if ( destDir == "/" )
90 flags ^= MAKE_LINKS; 90 flags ^= MAKE_LINKS;
91 } 91 }
92
93 } 92 }
94 93
95#ifdef X86 94#ifdef X86
96 cmd += " -f "; 95 cmd += " -f ";
97 cmd += IPKG_CONF; 96 cmd += IPKG_CONF;
98#endif 97#endif
99 98
100 cmd += " " + option; 99
100 if ( option == "reinstall" )
101 cmd += " install";
102 else
103 cmd += " " + option;
101 if ( option != "upgrade" ) 104 if ( option != "upgrade" )
102 cmd += " " + package; 105 cmd += " " + package;
103 cmd += " 2>&1"; 106 cmd += " 2>&1";
104 107
108
109 emit outputText( QString( "Dealing with package " ) + package );
110
105 qApp->processEvents(); 111 qApp->processEvents();
106 112
107 // If we are removing packages and make links option is selected 113 // If we are removing packages and make links option is selected
108 // create the links 114 // create the links
109 if ( option == "remove" ) 115 if ( option == "remove" || option == "reinstall" )
110 { 116 {
111 createLinks = false; 117 createLinks = false;
112 if ( flags & MAKE_LINKS ) 118 if ( flags & MAKE_LINKS )
113 { 119 {
114 emit outputText( QString( "Removing symbolic links...\n" ) ); 120 emit outputText( QString( "Removing symbolic links...\n" ) );
115 linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir ); 121 linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir );
@@ -122,13 +128,13 @@ bool Ipkg :: runIpkg( )
122 // Execute command 128 // Execute command
123 dependantPackages = new QList<QString>; 129 dependantPackages = new QList<QString>;
124 dependantPackages->setAutoDelete( true ); 130 dependantPackages->setAutoDelete( true );
125 131
126 ret = executeIpkgCommand( cmd, option ); 132 ret = executeIpkgCommand( cmd, option );
127 133
128 if ( option == "install" ) 134 if ( option == "install" || option == "reinstall" )
129 { 135 {
130 // If we are not removing packages and make links option is selected 136 // If we are not removing packages and make links option is selected
131 // create the links 137 // create the links
132 createLinks = true; 138 createLinks = true;
133 if ( flags & MAKE_LINKS ) 139 if ( flags & MAKE_LINKS )
134 { 140 {
@@ -150,12 +156,13 @@ bool Ipkg :: runIpkg( )
150 } 156 }
151 } 157 }
152 158
153 delete dependantPackages; 159 delete dependantPackages;
154 160
155 emit outputText( QString( "Finished - status=" ) + (ret ? "success" : "failure") ); 161 emit outputText( QString( "Finished - status=" ) + (ret ? "success" : "failure") );
162 emit outputText( "" );
156 return ret; 163 return ret;
157} 164}
158 165
159 166
160int Ipkg :: executeIpkgCommand( QString &cmd, const QString option ) 167int Ipkg :: executeIpkgCommand( QString &cmd, const QString option )
161{ 168{
@@ -179,13 +186,13 @@ int Ipkg :: executeIpkgCommand( QString &cmd, const QString option )
179 lineStr = line; 186 lineStr = line;
180 lineStr=lineStr.left( lineStr.length()-1 ); 187 lineStr=lineStr.left( lineStr.length()-1 );
181 188
182 if ( lineStr != lineStrOld ) 189 if ( lineStr != lineStrOld )
183 { 190 {
184 //See if we're finished 191 //See if we're finished
185 if ( option == "install" ) 192 if ( option == "install" || option == "reinstall" )
186 { 193 {
187 // Need to keep track of any dependant packages that get installed 194 // Need to keep track of any dependant packages that get installed
188 // so that we can create links to them as necessary 195 // so that we can create links to them as necessary
189 if ( lineStr.startsWith( "Installing " ) ) 196 if ( lineStr.startsWith( "Installing " ) )
190 { 197 {
191 cout << "LineStr = " << lineStr << endl; 198 cout << "LineStr = " << lineStr << endl;
@@ -239,17 +246,17 @@ void Ipkg :: linkPackage( const QString &packFileName, const QString &dest, cons
239 246
240QStringList* Ipkg :: getList( const QString &packageFilename, const QString &destDir ) 247QStringList* Ipkg :: getList( const QString &packageFilename, const QString &destDir )
241{ 248{
242 QString packageFileDir = destDir+"/usr/lib/ipkg/info/"+packageFilename+".list"; 249 QString packageFileDir = destDir+"/usr/lib/ipkg/info/"+packageFilename+".list";
243 QFile f( packageFileDir ); 250 QFile f( packageFileDir );
244 251
245 cout << "Try to open " << packageFileDir.latin1() << endl; 252 cout << "Try to open " << packageFileDir << endl;
246 if ( !f.open(IO_ReadOnly) ) 253 if ( !f.open(IO_ReadOnly) )
247 { 254 {
248 // Couldn't open from dest, try from / 255 // Couldn't open from dest, try from /
249// cout << "Could not open:" << packageFileDir << endl; 256 cout << "Could not open:" << packageFileDir << endl;
250 f.close(); 257 f.close();
251 258
252 packageFileDir = "/usr/lib/ipkg/info/"+packageFilename+".list"; 259 packageFileDir = "/usr/lib/ipkg/info/"+packageFilename+".list";
253 f.setName( packageFileDir ); 260 f.setName( packageFileDir );
254// cout << "Try to open " << packageFileDir.latin1() << endl; 261// cout << "Try to open " << packageFileDir.latin1() << endl;
255 if ( ! f.open(IO_ReadOnly) ) 262 if ( ! f.open(IO_ReadOnly) )