Compare commits

..

No commits in common. "61c847102d09fd4af8a56384bcc0377bc7061c1e" and "528b74549a7dc9019018413c6220fd5fbd62f385" have entirely different histories.

2 changed files with 13 additions and 40 deletions

View File

@ -98,7 +98,6 @@ int main(int argc, char *argv[]) {
// -d: only update device-controller firmware // -d: only update device-controller firmware
// -j: only update json-files // -j: only update json-files
// -o: only execute opkg-commnds // -o: only execute opkg-commnds
// -f: force. update_psa shall always perform a 'git pull'
// 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);

View File

@ -92,55 +92,31 @@ Update::Update(hwinf *hw,
, m_maintenanceMode(maintenanceMode) , m_maintenanceMode(maintenanceMode)
, m_init(true) { , m_init(true) {
// make sure the files are empty execUpdateScript();
if (m_update_ctrl_file.exists()) {
if (m_update_ctrl_file.open(QIODevice::ReadWrite | if (!m_update_ctrl_file.exists()) {
QIODevice::Truncate |
QIODevice::Text)) {
m_update_ctrl_file.close();
}
} else {
qCritical() << "Update-file" << m_update_ctrl_file.fileName() qCritical() << "Update-file" << m_update_ctrl_file.fileName()
<< "does not exist"; << "does not exist";
m_init = false; m_init = false;
} }
if (m_update_ctrl_file_copy.exists()) { if (!m_update_ctrl_file_copy.exists()) {
if (m_update_ctrl_file_copy.open(QIODevice::ReadWrite |
QIODevice::Truncate |
QIODevice::Text)) {
m_update_ctrl_file_copy.close();
}
} else {
qCritical() << "Update-file-copy" << m_update_ctrl_file_copy.fileName() qCritical() << "Update-file-copy" << m_update_ctrl_file_copy.fileName()
<< "does not exist"; << "does not exist";
m_init = false; m_init = false;
} }
if (!m_update_ctrl_file.open(QIODevice::ReadWrite | QIODevice::Text)) {
// execute update_psa-script qCritical() << "can not open " << m_update_ctrl_file.fileName();
if (m_init) { m_init = false;
if ((m_init = execUpdateScript()) == false) {
qCritical() << "UPDATE_SCRIPT FAILED";
} else {
if (!m_update_ctrl_file.open(QIODevice::ReadWrite | QIODevice::Text)) {
qCritical() << "CAN NOT OPEN" << m_update_ctrl_file.fileName();
m_init = false;
} else {
qDebug() << "OPENED" << m_update_ctrl_file.fileName();
}
if (!m_update_ctrl_file_copy.open(QIODevice::ReadWrite | QIODevice::Text)) {
qCritical() << "CAN NOT OPEN" << m_update_ctrl_file_copy.fileName();
m_init = false;
} else {
qDebug() << "OPENED" << m_update_ctrl_file_copy.fileName();
}
}
} }
qDebug() << "Opened" << m_update_ctrl_file.fileName();
if (!m_update_ctrl_file_copy.open(QIODevice::ReadWrite | QIODevice::Text)) {
qCritical() << "can not open " << m_update_ctrl_file_copy.fileName();
m_init = false;
}
qDebug() << "Opened" << m_update_ctrl_file_copy.fileName();
} }
Update::~Update() { Update::~Update() {
// make sure the files are closed
m_update_ctrl_file.close();
m_update_ctrl_file_copy.close();
} }
bool Update::execUpdateScript() { bool Update::execUpdateScript() {
@ -626,7 +602,6 @@ bool Update::doUpdate() {
*/ */
if (!m_init) { if (!m_init) {
qCritical() << "DO UPDATE: INITIALIZATION OR UPDATE-SCRIPT FAILED";
return false; return false;
} }
@ -637,7 +612,6 @@ bool Update::doUpdate() {
qCritical() << "No lines to handle in" << m_update_ctrl_file.fileName(); qCritical() << "No lines to handle in" << m_update_ctrl_file.fileName();
return true; return true;
} }
qDebug() << "open lines..."; qDebug() << "open lines...";
for (int i=0; i< linesToWorkOn.size(); ++i) { for (int i=0; i< linesToWorkOn.size(); ++i) {
qDebug() << "line" << i << ":" << linesToWorkOn.at(i).trimmed(); qDebug() << "line" << i << ":" << linesToWorkOn.at(i).trimmed();