summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg/datamgr.cpp
Unidiff
Diffstat (limited to 'noncore/settings/aqpkg/datamgr.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/datamgr.cpp53
1 files changed, 45 insertions, 8 deletions
diff --git a/noncore/settings/aqpkg/datamgr.cpp b/noncore/settings/aqpkg/datamgr.cpp
index b9ce227..b6e6e37 100644
--- a/noncore/settings/aqpkg/datamgr.cpp
+++ b/noncore/settings/aqpkg/datamgr.cpp
@@ -83,14 +83,29 @@ void DataManager :: loadServers()
83 } 83 }
84 else 84 else
85 { 85 {
86 {
87 cout << "Before ipkg.conf read" << endl;
88 vector<Server>::iterator it;
89 for ( it = serverList.begin() ; it != serverList.end() ; ++it )
90 cout << "servername - " << it->getServerName() << endl;
91 }
92
86 while ( fgets( line, sizeof line, fp) != NULL ) 93 while ( fgets( line, sizeof line, fp) != NULL )
87 { 94 {
88 lineStr = line; 95 lineStr = line;
89 if ( lineStr.startsWith( "src" ) || lineStr.startsWith( "#src" ) ) 96 if ( lineStr.startsWith( "src" ) || lineStr.startsWith( "#src" ) || lineStr.startsWith( "# src" ) )
90 { 97 {
91 char alias[20]; 98 char alias[20];
92 char url[100]; 99 char url[100];
93 sscanf( lineStr, "%*[^ ] %s %s", alias, url ); 100
101
102 // Looks a little wierd but read up to the r of src (throwing it away),
103 // then read up to the next space and throw that away, the alias
104 // is next.
105 // Should Handle #src, # src, src, and combinations of
106 sscanf( lineStr, "%*[^r]%*[^ ] %s %s", alias, url );
107 cout << "Adding alias " << alias << " to list" << endl;
108 cout << lineStr << endl;
94 Server s( alias, url ); 109 Server s( alias, url );
95 serverList.push_back( s ); 110 serverList.push_back( s );
96 111
@@ -106,16 +121,23 @@ void DataManager :: loadServers()
106 destList.push_back( d ); 121 destList.push_back( d );
107 } 122 }
108 } 123 }
124 {
125 cout << "After ipkg.conf read" << endl;
126 vector<Server>::iterator it;
127 for ( it = serverList.begin() ; it != serverList.end() ; ++it )
128 cout << "servername - " << it->getServerName() << endl;
129 }
130
109 } 131 }
110 fclose( fp ); 132 fclose( fp );
111 133
112 // Go through the server destination list and add root, cf and card if they 134 // Go through the server destination list and add root, cf and card if they
113 // don't already exist 135 // don't already exist
114 /* AQ - commented out as if you don't have a CF or SD card in then 136/* AQ - commented out as if you don't have a CF or SD card in then
115 * this causes IPKG to try to create directories on non existant devices 137 * this causes IPKG to try to create directories on non existant devices
116 * (which of course fails), gives a nasty error message and can cause ipkg 138 * (which of course fails), gives a nasty error message and can cause ipkg
117 * to seg fault. 139 * to seg fault.
118 * 140 *
119 vector<Destination>::iterator dit; 141 vector<Destination>::iterator dit;
120 bool foundRoot = false; 142 bool foundRoot = false;
121 bool foundCF = false; 143 bool foundCF = false;
@@ -170,7 +192,20 @@ void DataManager :: writeOutIpkgConf()
170 QString ipkg_conf = IPKG_CONF; 192 QString ipkg_conf = IPKG_CONF;
171 ofstream out( ipkg_conf ); 193 ofstream out( ipkg_conf );
172 194
173 out << "# Written by NetworkPackageManager Package Manager" << endl; 195 out << "# Written by AQPkg" << endl;
196 out << "# Must have one or more source entries of the form:" << endl;
197 out << "#" << endl;
198 out << "# src <src-name> <source-url>" << endl;
199 out << "#" << endl;
200 out << "# and one or more destination entries of the form:" << endl;
201 out << "#" << endl;
202 out << "# dest <dest-name> <target-path>" << endl;
203 out << "#" << endl;
204 out << "# where <src-name> and <dest-names> are identifiers that" << endl;
205 out << "# should match [a-zA-Z0-9._-]+, <source-url> should be a" << endl;
206 out << "# URL that points to a directory containing a Familiar" << endl;
207 out << "# Packages file, and <target-path> should be a directory" << endl;
208 out << "# that exists on the target system." << endl << endl;
174 209
175 // Write out servers 210 // Write out servers
176 vector<Server>::iterator it = serverList.begin(); 211 vector<Server>::iterator it = serverList.begin();
@@ -190,6 +225,8 @@ void DataManager :: writeOutIpkgConf()
190 it++; 225 it++;
191 } 226 }
192 227
228 out << endl;
229
193 // Write out destinations 230 // Write out destinations
194 vector<Destination>::iterator it2 = destList.begin(); 231 vector<Destination>::iterator it2 = destList.begin();
195 while ( it2 != destList.end() ) 232 while ( it2 != destList.end() )