summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/ipkg.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp
index 731a336..c762633 100644
--- a/noncore/settings/aqpkg/ipkg.cpp
+++ b/noncore/settings/aqpkg/ipkg.cpp
@@ -96,129 +96,130 @@ bool Ipkg :: runIpkg( )
96 96
97 97
98 if ( option == "reinstall" ) 98 if ( option == "reinstall" )
99 cmd += " install"; 99 cmd += " install";
100 else 100 else
101 cmd += " " + option; 101 cmd += " " + option;
102 if ( package != "" ) 102 if ( package != "" )
103 cmd += " " + package; 103 cmd += " " + package;
104 cmd += " 2>&1"; 104 cmd += " 2>&1";
105 105
106 106
107 if ( package != "" ) 107 if ( package != "" )
108 emit outputText( QString( "Dealing with package " ) + package ); 108 emit outputText( QString( "Dealing with package " ) + package );
109 109
110 qApp->processEvents(); 110 qApp->processEvents();
111 111
112 // If we are removing packages and make links option is selected 112 // If we are removing packages and make links option is selected
113 // create the links 113 // create the links
114 if ( option == "remove" || option == "reinstall" ) 114 if ( option == "remove" || option == "reinstall" )
115 { 115 {
116 createLinks = false; 116 createLinks = false;
117 if ( flags & MAKE_LINKS ) 117 if ( flags & MAKE_LINKS )
118 { 118 {
119 emit outputText( QString( "Removing symbolic links...\n" ) ); 119 emit outputText( QString( "Removing symbolic links...\n" ) );
120 linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir ); 120 linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir );
121 emit outputText( QString( " " ) ); 121 emit outputText( QString( " " ) );
122 } 122 }
123 } 123 }
124 124
125 emit outputText( cmd ); 125 emit outputText( cmd );
126 126
127 // Execute command 127 // Execute command
128 dependantPackages = new QList<QString>; 128 dependantPackages = new QList<QString>;
129 dependantPackages->setAutoDelete( true ); 129 dependantPackages->setAutoDelete( true );
130 130
131 ret = executeIpkgCommand( cmd, option ); 131 ret = executeIpkgCommand( cmd, option );
132 132
133 if ( option == "install" || option == "reinstall" ) 133 if ( option == "install" || option == "reinstall" )
134 { 134 {
135 // If we are not removing packages and make links option is selected 135 // If we are not removing packages and make links option is selected
136 // create the links 136 // create the links
137 createLinks = true; 137 createLinks = true;
138 if ( flags & MAKE_LINKS ) 138 if ( flags & MAKE_LINKS )
139 { 139 {
140 emit outputText( " " ); 140 emit outputText( " " );
141 emit outputText( QString( "Creating symbolic links for " )+ package ); 141 emit outputText( QString( "Creating symbolic links for " )+ package );
142 142
143 linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir ); 143 linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir );
144 144
145 // link dependant packages that were installed with this release 145 // link dependant packages that were installed with this release
146 QString *pkg; 146 QString *pkg;
147 for ( pkg = dependantPackages->first(); pkg != 0; pkg = dependantPackages->next() ) 147 for ( pkg = dependantPackages->first(); pkg != 0; pkg = dependantPackages->next() )
148 { 148 {
149 if ( *pkg == package ) 149 if ( *pkg == package )
150 continue; 150 continue;
151 emit outputText( " " ); 151 emit outputText( " " );
152 emit outputText( QString( "Creating symbolic links for " )+ (*pkg) ); 152 emit outputText( QString( "Creating symbolic links for " )+ (*pkg) );
153 linkPackage( Utils::getPackageNameFromIpkFilename( *pkg ), destination, destDir ); 153 linkPackage( Utils::getPackageNameFromIpkFilename( *pkg ), destination, destDir );
154 } 154 }
155 } 155 }
156 } 156 }
157 157
158 delete dependantPackages; 158 delete dependantPackages;
159 159
160 emit outputText( QString( "Finished - status=" ) + (ret ? "success" : "failure") ); 160// emit outputText( QString( "Finished - status=" ) + (ret ? "success" : "failure") );
161 emit outputText( "Finished" );
161 emit outputText( "" ); 162 emit outputText( "" );
162 return ret; 163 return ret;
163} 164}
164 165
165 166
166int Ipkg :: executeIpkgCommand( QString &cmd, const QString option ) 167int Ipkg :: executeIpkgCommand( QString &cmd, const QString option )
167{ 168{
168 FILE *fp = NULL; 169 FILE *fp = NULL;
169 char line[130]; 170 char line[130];
170 QString lineStr, lineStrOld; 171 QString lineStr, lineStrOld;
171 int ret = false; 172 int ret = false;
172 173
173 fp = popen( (const char *) cmd, "r"); 174 fp = popen( (const char *) cmd, "r");
174 if ( fp == NULL ) 175 if ( fp == NULL )
175 { 176 {
176 cout << "Couldn't execute " << cmd << "! err = " << fp << endl; 177 cout << "Couldn't execute " << cmd << "! err = " << fp << endl;
177 QString text; 178 QString text;
178 text.sprintf( "Couldn't execute %s! See stdout for error code", (const char *)cmd ); 179 text.sprintf( "Couldn't execute %s! See stdout for error code", (const char *)cmd );
179 emit outputText( text ); 180 emit outputText( text );
180 } 181 }
181 else 182 else
182 { 183 {
183 while ( fgets( line, sizeof line, fp) != NULL ) 184 while ( fgets( line, sizeof line, fp) != NULL )
184 { 185 {
185 lineStr = line; 186 lineStr = line;
186 lineStr=lineStr.left( lineStr.length()-1 ); 187 lineStr=lineStr.left( lineStr.length()-1 );
187 188
188 if ( lineStr != lineStrOld ) 189 if ( lineStr != lineStrOld )
189 { 190 {
190 //See if we're finished 191 //See if we're finished
191 if ( option == "install" || option == "reinstall" ) 192 if ( option == "install" || option == "reinstall" )
192 { 193 {
193 // Need to keep track of any dependant packages that get installed 194 // Need to keep track of any dependant packages that get installed
194 // so that we can create links to them as necessary 195 // so that we can create links to them as necessary
195 if ( lineStr.startsWith( "Installing " ) ) 196 if ( lineStr.startsWith( "Installing " ) )
196 { 197 {
197 int start = lineStr.find( " " ) + 1; 198 int start = lineStr.find( " " ) + 1;
198 int end = lineStr.find( " ", start ); 199 int end = lineStr.find( " ", start );
199 QString *package = new QString( lineStr.mid( start, end-start ) ); 200 QString *package = new QString( lineStr.mid( start, end-start ) );
200 dependantPackages->append( package ); 201 dependantPackages->append( package );
201 } 202 }
202 } 203 }
203 204
204 if ( option == "update" ) 205 if ( option == "update" )
205 { 206 {
206 if (lineStr.contains("Updated list")) 207 if (lineStr.contains("Updated list"))
207 ret = true; 208 ret = true;
208 } 209 }
209 else if ( option == "download" ) 210 else if ( option == "download" )
210 { 211 {
211 if (lineStr.contains("Downloaded")) 212 if (lineStr.contains("Downloaded"))
212 ret = true; 213 ret = true;
213 } 214 }
214 else 215 else
215 { 216 {
216 if (lineStr.contains("Done")) 217 if (lineStr.contains("Done"))
217 ret = true; 218 ret = true;
218 } 219 }
219 220
220 emit outputText( lineStr ); 221 emit outputText( lineStr );
221 } 222 }
222 lineStrOld = lineStr; 223 lineStrOld = lineStr;
223 qApp->processEvents(); 224 qApp->processEvents();
224 } 225 }