Check if opkg_command failed, and if this is the case, stop the
update-process without showing a wrong UPDATE-SUCCESS.
This commit is contained in:
		
							
								
								
									
										16
									
								
								worker.cpp
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								worker.cpp
									
									
									
									
									
								
							@@ -795,16 +795,17 @@ bool Worker::updateFiles(quint8 percent) {
 | 
				
			|||||||
                if (f.exists()) {
 | 
					                if (f.exists()) {
 | 
				
			||||||
                    if (f.open(QIODevice::ReadOnly)) {
 | 
					                    if (f.open(QIODevice::ReadOnly)) {
 | 
				
			||||||
                        QTextStream in(&f);
 | 
					                        QTextStream in(&f);
 | 
				
			||||||
                        int cmdCount = 0;
 | 
					 | 
				
			||||||
                        QStringList opkgCommands;
 | 
					                        QStringList opkgCommands;
 | 
				
			||||||
 | 
					                        bool executeOpkgCommandFailed = false;
 | 
				
			||||||
                        while (!in.atEnd()) {
 | 
					                        while (!in.atEnd()) {
 | 
				
			||||||
                            QString line = in.readLine();
 | 
					                            QString line = in.readLine();
 | 
				
			||||||
                            static const QRegularExpression comment("^\\s*#.*$");
 | 
					                            static const QRegularExpression comment("^\\s*#.*$");
 | 
				
			||||||
                            if (line.indexOf(comment, 0) == -1) {
 | 
					                            if (line.indexOf(comment, 0) == -1) {
 | 
				
			||||||
                                // found opkg command
 | 
					                                // found opkg command
 | 
				
			||||||
                                QString opkgCommand = line.trimmed();
 | 
					                                QString opkgCommand = line.trimmed();
 | 
				
			||||||
                                ++cmdCount;
 | 
					                                if (!executeOpkgCommand(opkgCommand)) {
 | 
				
			||||||
                                executeOpkgCommand(opkgCommand);
 | 
					                                    executeOpkgCommandFailed = true;
 | 
				
			||||||
 | 
					                                } else {
 | 
				
			||||||
                                    QString cmd = "\n  " + opkgCommand;
 | 
					                                    QString cmd = "\n  " + opkgCommand;
 | 
				
			||||||
                                    emit appendText(cmd);
 | 
					                                    emit appendText(cmd);
 | 
				
			||||||
                                    opkgCommands << cmd;
 | 
					                                    opkgCommands << cmd;
 | 
				
			||||||
@@ -817,17 +818,24 @@ bool Worker::updateFiles(quint8 percent) {
 | 
				
			|||||||
                                                m_ismasClient.execOpkgCommand(m_updateStatus.m_statusDescription, ""));
 | 
					                                                m_ismasClient.execOpkgCommand(m_updateStatus.m_statusDescription, ""));
 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                        f.close();
 | 
					                        f.close();
 | 
				
			||||||
                        if (cmdCount > 0) {
 | 
					                        if (!executeOpkgCommandFailed) {
 | 
				
			||||||
 | 
					                            if (opkgCommands.size() > 0) {
 | 
				
			||||||
                                m_displayIndex = 1;
 | 
					                                m_displayIndex = 1;
 | 
				
			||||||
                                QString prepend = QString("(") + QString("%1").arg(m_displayIndex).rightJustified(3, ' ') + QString(")")
 | 
					                                QString prepend = QString("(") + QString("%1").arg(m_displayIndex).rightJustified(3, ' ') + QString(")")
 | 
				
			||||||
                                                    + QString(" Update opkg pakets ... ");
 | 
					                                                    + QString(" Update opkg pakets ... ");
 | 
				
			||||||
                                opkgCommands.prepend(prepend);
 | 
					                                opkgCommands.prepend(prepend);
 | 
				
			||||||
                                emit replaceLast(opkgCommands, UPDATE_STEP_DONE);
 | 
					                                emit replaceLast(opkgCommands, UPDATE_STEP_DONE);
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
                        } else {
 | 
					                        } else {
 | 
				
			||||||
                            m_displayIndex = 1;
 | 
					                            m_displayIndex = 1;
 | 
				
			||||||
                            emit replaceLast(QString("(") + QString("%1").arg(m_displayIndex).rightJustified(3, ' ') + QString(")")
 | 
					                            emit replaceLast(QString("(") + QString("%1").arg(m_displayIndex).rightJustified(3, ' ') + QString(")")
 | 
				
			||||||
                                          + QString(" Update opkg pakets ... "), UPDATE_STEP_FAIL);
 | 
					                                          + QString(" Update opkg pakets ... "), UPDATE_STEP_FAIL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                            stopProgressLoop();
 | 
				
			||||||
 | 
					                            setProgress(100);
 | 
				
			||||||
 | 
					                            return false;
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user