mirror of
https://github.com/outbackdingo/sysadm.git
synced 2026-01-27 02:20:17 +00:00
When making changes to the update manager repo/url - clear out the last check for updates so the next ping will re-check using the new settings.
Also remove some old comments from the service manager.
This commit is contained in:
@@ -234,37 +234,4 @@ void ServiceManager::loadRCdata(){
|
||||
rcdata.insert( info[i].section(": ",0,0), info[i].section(": ",1,-1) );
|
||||
}
|
||||
}
|
||||
|
||||
/*QDir dir("/etc");
|
||||
QStringList confs = dir.entryList(QStringList() << "rc.conf*", QDir::Files, QDir::Name | QDir::Reversed);
|
||||
//qDebug() << "Conf file order:" << confs;
|
||||
for(int i=0; i<confs.length(); i++){
|
||||
QFile file(dir.absoluteFilePath(confs[i]));
|
||||
if( file.open(QIODevice::ReadOnly) ){
|
||||
//qDebug() << "Read File:" << confs[i];
|
||||
bool insection = true;
|
||||
QTextStream stream(&file);
|
||||
while(!stream.atEnd()){
|
||||
QString info = stream.readLine();
|
||||
//qDebug() << "Read Line:" << info;
|
||||
if(info.contains("=") && insection){
|
||||
rcdata.insert(info.section("=",0,0).simplified(), info.section("=",1,-1));
|
||||
//qDebug() << "Got data entry:" << info;
|
||||
}else if(info.simplified()=="fi"){
|
||||
insection= true;
|
||||
}else if(info.simplified().startsWith("if [ ") ){
|
||||
QStringList args = info.section("]",0,0).section("[",1,-1).split("\""); //odd numbers are files, even are arguments
|
||||
for(int j=0; j<args.length()-1; j+=2){
|
||||
//qDebug() << "Check if arguments:" << args[j] << args[j+1] << insection;
|
||||
if(!args[j].contains("-e")){ insection = false; break; } //don't know how to handle this - skip section
|
||||
if(args[j].contains("-o")){ insection == insection || QFile::exists(args[j+1]); }
|
||||
else if(args[j].contains("-a")){ insection == insection && QFile::exists(args[j+1]); }
|
||||
else{ insection = QFile::exists(args[j+1]); } //typically the first argument check
|
||||
//qDebug() << " - Now:" << insection;
|
||||
} //end loop over existance arguments
|
||||
}
|
||||
}//end loop over lines
|
||||
file.close();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -259,8 +259,10 @@ QJsonObject Update::writeSettings(QJsonObject obj){
|
||||
knownsettings << "PACKAGE_SET" << "PACKAGE_URL" << "AUTO_UPDATE" << "MAXBE";// << "CDN_TYPE";
|
||||
QStringList keys = obj.keys();
|
||||
QStringList vals;
|
||||
bool clearlastCheck = false;
|
||||
for(int i=0; i<keys.length(); i++){
|
||||
if(knownsettings.contains(keys[i].toUpper())){
|
||||
if(keys[i].toUpper().startsWith("PACKAGE_")){ clearlastCheck = true; }
|
||||
vals << obj.value(keys[i]).toString();
|
||||
keys[i] = keys[i].toUpper();
|
||||
}else{
|
||||
@@ -289,8 +291,12 @@ QJsonObject Update::writeSettings(QJsonObject obj){
|
||||
if( General::writeTextFile(UP_CONFFILE, info, true) ){
|
||||
QProcess::startDetached("pc-updatemanager syncconf"); //sync up the config files as needed
|
||||
ret.insert("result","success");
|
||||
if(clearlastCheck){
|
||||
if(QFile::exists(UP_UPFILE)){ QFile::remove(UP_UPFILE); } //ensure the next fast update does a full check
|
||||
}
|
||||
}else{
|
||||
ret.insert("result","error");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user