Compare commits
No commits in common. "61c847102d09fd4af8a56384bcc0377bc7061c1e" and "528b74549a7dc9019018413c6220fd5fbd62f385" have entirely different histories.
61c847102d
...
528b74549a
1
main.cpp
1
main.cpp
@ -98,7 +98,6 @@ int main(int argc, char *argv[]) {
|
||||
// -d: only update device-controller firmware
|
||||
// -j: only update json-files
|
||||
// -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
|
||||
parser.process(a);
|
||||
|
52
update.cpp
52
update.cpp
@ -92,55 +92,31 @@ Update::Update(hwinf *hw,
|
||||
, m_maintenanceMode(maintenanceMode)
|
||||
, m_init(true) {
|
||||
|
||||
// make sure the files are empty
|
||||
if (m_update_ctrl_file.exists()) {
|
||||
if (m_update_ctrl_file.open(QIODevice::ReadWrite |
|
||||
QIODevice::Truncate |
|
||||
QIODevice::Text)) {
|
||||
m_update_ctrl_file.close();
|
||||
}
|
||||
} else {
|
||||
execUpdateScript();
|
||||
|
||||
if (!m_update_ctrl_file.exists()) {
|
||||
qCritical() << "Update-file" << m_update_ctrl_file.fileName()
|
||||
<< "does not exist";
|
||||
m_init = false;
|
||||
}
|
||||
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 {
|
||||
if (!m_update_ctrl_file_copy.exists()) {
|
||||
qCritical() << "Update-file-copy" << m_update_ctrl_file_copy.fileName()
|
||||
<< "does not exist";
|
||||
m_init = false;
|
||||
}
|
||||
|
||||
// execute update_psa-script
|
||||
if (m_init) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
if (!m_update_ctrl_file.open(QIODevice::ReadWrite | QIODevice::Text)) {
|
||||
qCritical() << "can not open " << m_update_ctrl_file.fileName();
|
||||
m_init = false;
|
||||
}
|
||||
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() {
|
||||
// make sure the files are closed
|
||||
m_update_ctrl_file.close();
|
||||
m_update_ctrl_file_copy.close();
|
||||
}
|
||||
|
||||
bool Update::execUpdateScript() {
|
||||
@ -626,7 +602,6 @@ bool Update::doUpdate() {
|
||||
*/
|
||||
|
||||
if (!m_init) {
|
||||
qCritical() << "DO UPDATE: INITIALIZATION OR UPDATE-SCRIPT FAILED";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -637,7 +612,6 @@ bool Update::doUpdate() {
|
||||
qCritical() << "No lines to handle in" << m_update_ctrl_file.fileName();
|
||||
return true;
|
||||
}
|
||||
|
||||
qDebug() << "open lines...";
|
||||
for (int i=0; i< linesToWorkOn.size(); ++i) {
|
||||
qDebug() << "line" << i << ":" << linesToWorkOn.at(i).trimmed();
|
||||
|
Loading…
x
Reference in New Issue
Block a user