Add command-parameters yoctoVersionOption (yocto-version of
ATBUpdateTool as reported by opkg), and yoctoInstallStatusOption (info if ATBUpdateTool is installed as reported by opkg).
This commit is contained in:
		
							
								
								
									
										33
									
								
								main.cpp
									
									
									
									
									
								
							
							
						
						
									
										33
									
								
								main.cpp
									
									
									
									
									
								
							@@ -116,12 +116,22 @@ int main(int argc, char *argv[]) {
 | 
				
			|||||||
        QCoreApplication::translate("main", "Show extended version (including last git commit)."));
 | 
					        QCoreApplication::translate("main", "Show extended version (including last git commit)."));
 | 
				
			||||||
    parser.addOption(extendedVersionOption);
 | 
					    parser.addOption(extendedVersionOption);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    QCommandLineOption yoctoVersionOption(QStringList() << "y" << "yocto-version",
 | 
				
			||||||
 | 
					        QCoreApplication::translate("main", "Show yocto version of ATBUpdateTool."));
 | 
				
			||||||
 | 
					    parser.addOption(yoctoVersionOption);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    QCommandLineOption yoctoInstallStatusOption(QStringList() << "Y" << "yocto-install",
 | 
				
			||||||
 | 
					        QCoreApplication::translate("main", "Show yocto install status of ATBUpdateTool."));
 | 
				
			||||||
 | 
					    parser.addOption(yoctoInstallStatusOption);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Process the actual command line arguments given by the user
 | 
					    // Process the actual command line arguments given by the user
 | 
				
			||||||
    parser.process(a);
 | 
					    parser.process(a);
 | 
				
			||||||
    QString plugInDir = parser.value(pluginDirectoryOption);
 | 
					    QString plugInDir = parser.value(pluginDirectoryOption);
 | 
				
			||||||
    QString plugInName = parser.value(pluginNameOption);
 | 
					    QString plugInName = parser.value(pluginNameOption);
 | 
				
			||||||
    QString workingDir = parser.value(workingDirectoryOption);
 | 
					    QString workingDir = parser.value(workingDirectoryOption);
 | 
				
			||||||
    bool const dryRun = parser.isSet(dryRunOption);
 | 
					    bool const dryRun = parser.isSet(dryRunOption);
 | 
				
			||||||
 | 
					    bool const showYoctoVersion = parser.isSet(yoctoVersionOption);
 | 
				
			||||||
 | 
					    bool const showYoctoInstallStatus = parser.isSet(yoctoInstallStatusOption);
 | 
				
			||||||
    bool const showExtendedVersion = parser.isSet(extendedVersionOption);
 | 
					    bool const showExtendedVersion = parser.isSet(extendedVersionOption);
 | 
				
			||||||
    QString const rtPath = QCoreApplication::applicationDirPath();
 | 
					    QString const rtPath = QCoreApplication::applicationDirPath();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -130,17 +140,30 @@ int main(int argc, char *argv[]) {
 | 
				
			|||||||
        return 0;
 | 
					        return 0;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (showYoctoVersion) {
 | 
				
			||||||
 | 
					        printf("%s\n", Worker::getATBUpdateToolYoctoVersion().toStdString().c_str());
 | 
				
			||||||
 | 
					        return 0;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (showYoctoInstallStatus) {
 | 
				
			||||||
 | 
					        printf("%s\n", Worker::getATBUpdateToolYoctoInstallationStatus().toStdString().c_str());
 | 
				
			||||||
 | 
					        return 0;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!QDir(plugInDir).exists()) {
 | 
					    if (!QDir(plugInDir).exists()) {
 | 
				
			||||||
        qCritical() << plugInDir
 | 
					        qCritical() << plugInDir
 | 
				
			||||||
                    << "does not exists, but has to contain dc-library";
 | 
					                    << "does not exists, but has to contain dc-library";
 | 
				
			||||||
        exit(-1);
 | 
					        exit(-1);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    qInfo() << "pwd ..............." << rtPath;
 | 
					    qInfo() << "pwd ......................" << rtPath;
 | 
				
			||||||
    qInfo() << "plugInDir ........." << plugInDir;
 | 
					    qInfo() << "plugInDir ................" << plugInDir;
 | 
				
			||||||
    qInfo() << "plugInName ........" << plugInName;
 | 
					    qInfo() << "plugInName ..............." << plugInName;
 | 
				
			||||||
    qInfo() << "workingDir ........" << workingDir;
 | 
					    qInfo() << "workingDir ..............." << workingDir;
 | 
				
			||||||
    qInfo() << "dryRun ............" << dryRun;
 | 
					    qInfo() << "dryRun ..................." << dryRun;
 | 
				
			||||||
 | 
					    qInfo() << "extended-version ........." << APP_EXTENDED_VERSION;
 | 
				
			||||||
 | 
					    //qInfo() << "yocto-version ............" << Worker::getATBUpdateToolYoctoVersion();
 | 
				
			||||||
 | 
					    //qInfo() << "yocto-install-status ....." << Worker::getATBUpdateToolYoctoInstallationStatus();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // before loading the library, delete all possible shared memory segments
 | 
					    // before loading the library, delete all possible shared memory segments
 | 
				
			||||||
#if defined Q_OS_LINUX || defined Q_OS_UNIX
 | 
					#if defined Q_OS_LINUX || defined Q_OS_UNIX
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user