Compare commits
7 Commits
281/Szeged
...
1.5.99-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
8a564b9538
|
|||
|
d5e62e72d3
|
|||
|
0155d51d3d
|
|||
|
843ac23770
|
|||
|
c3b2db7797
|
|||
|
51640b70e9
|
|||
|
be84c96953
|
@@ -152,7 +152,10 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
# 1.5.7 : Add support for dynamic portrait / landscape.
|
# 1.5.7 : Add support for dynamic portrait / landscape.
|
||||||
# 1.5.8 : Use EVENT_ID=<pid of update-tool> for CMD_EVENT.
|
# 1.5.8 : Use EVENT_ID=<pid of update-tool> for CMD_EVENT.
|
||||||
# 1.5.9 : Removed restart of Apism if ISMAS unreachable.
|
# 1.5.9 : Removed restart of Apism if ISMAS unreachable.
|
||||||
VERSION="1.5.9"
|
# 1.5.99 : Special version for 281/Szeged: remove all DC-library dependencies, as
|
||||||
|
# DC-firmware in Szeged does not support uploading json-files or uploading
|
||||||
|
# DC-firmware binaries.
|
||||||
|
VERSION="1.5.99"
|
||||||
# PLANNED TODOS:
|
# PLANNED TODOS:
|
||||||
# 1: Das Repository wird repariert bwz. neu geklont. Unabhaengig vom WAIT.
|
# 1: Das Repository wird repariert bwz. neu geklont. Unabhaengig vom WAIT.
|
||||||
# 2: Wenn der WAIT-Button aktiv ist, dann wird ein Repository repariert (neu
|
# 2: Wenn der WAIT-Button aktiv ist, dann wird ein Repository repariert (neu
|
||||||
@@ -258,9 +261,6 @@ contains( CONFIG, PTU5_YOCTO ) {
|
|||||||
PTU5BASEPATH = /opt/devel/ptu5
|
PTU5BASEPATH = /opt/devel/ptu5
|
||||||
ARCH = PTU5
|
ARCH = PTU5
|
||||||
DEFINES+=PTU5
|
DEFINES+=PTU5
|
||||||
|
|
||||||
LIBS += -lCAslave
|
|
||||||
LIBS += -lCAmaster
|
|
||||||
}
|
}
|
||||||
contains( CONFIG, DesktopLinux ) {
|
contains( CONFIG, DesktopLinux ) {
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += serialport
|
greaterThan(QT_MAJOR_VERSION, 4): QT += serialport
|
||||||
|
|||||||
@@ -6,7 +6,9 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
CommandLineParser::CommandLineParser()
|
CommandLineParser::CommandLineParser()
|
||||||
: m_repositoryUrl("https://git.mimbach49.de/GerhardHoffmann")
|
: m_repositoryUrl("gitea@ptu-config.atb-comm.de:ATB/")
|
||||||
|
, m_sshKeyFile("/opt/app/tools/atbupdate/.keys/id_ed25519_ptuConfig")
|
||||||
|
, m_sshOptionStrictHostKeyChecking("false")
|
||||||
, m_plugInDir("/usr/lib/")
|
, m_plugInDir("/usr/lib/")
|
||||||
, m_plugInName("libCAslave.so")
|
, m_plugInName("libCAslave.so")
|
||||||
, m_workingDir("/opt/app/tools/atbupdate/")
|
, m_workingDir("/opt/app/tools/atbupdate/")
|
||||||
@@ -20,27 +22,36 @@ CommandLineParser::CommandLineParser()
|
|||||||
, m_alwaysDownloadDC("false")
|
, m_alwaysDownloadDC("false")
|
||||||
, m_repositoryUrlOption(
|
, m_repositoryUrlOption(
|
||||||
QCommandLineOption(
|
QCommandLineOption(
|
||||||
QStringList() << "repository-url" << "repository-url",
|
QStringList() << "repository-url",
|
||||||
QCoreApplication::translate("main", "Where to find a customer repository."),
|
QCoreApplication::translate("main", "Where to find a customer repository."),
|
||||||
QCoreApplication::translate("main", "directory")))
|
QCoreApplication::translate("main", "directory")))
|
||||||
|
, m_sshKeyFileOption(
|
||||||
|
QCommandLineOption(
|
||||||
|
QStringList() << "sshKeyFile",
|
||||||
|
QCoreApplication::translate("main", "Used ssh key."),
|
||||||
|
QCoreApplication::translate("main", "file")))
|
||||||
|
, m_sshOptionStrictHostKeyCheckingOption(
|
||||||
|
QCommandLineOption(
|
||||||
|
QStringList() << "sshStrictHostKeyChecking",
|
||||||
|
QCoreApplication::translate("main", "Enable ssh strict host key checking")))
|
||||||
, m_iniFileDirectoryOption(
|
, m_iniFileDirectoryOption(
|
||||||
QCommandLineOption(
|
QCommandLineOption(
|
||||||
QStringList() << "ini-directory" << "ini-directory",
|
QStringList() << "ini-directory",
|
||||||
QCoreApplication::translate("main", "Where to find an ini-file."),
|
QCoreApplication::translate("main", "Where to find an ini-file."),
|
||||||
QCoreApplication::translate("main", "directory")))
|
QCoreApplication::translate("main", "directory")))
|
||||||
, m_iniFileNameOption(
|
, m_iniFileNameOption(
|
||||||
QCommandLineOption(
|
QCommandLineOption(
|
||||||
QStringList() << "ini-filename" << "ini-filename",
|
QStringList() << "ini-filename",
|
||||||
QCoreApplication::translate("main", "Name of ini-file."),
|
QCoreApplication::translate("main", "Name of ini-file."),
|
||||||
QCoreApplication::translate("main", "file")))
|
QCoreApplication::translate("main", "file")))
|
||||||
, m_pluginDirectoryOption(
|
, m_pluginDirectoryOption(
|
||||||
QCommandLineOption(
|
QCommandLineOption(
|
||||||
QStringList() << "plugin-directory" << "plugin-directory",
|
QStringList() << "plugin-directory",
|
||||||
QCoreApplication::translate("main", "Where to find dc-plugin."),
|
QCoreApplication::translate("main", "Where to find dc-plugin."),
|
||||||
QCoreApplication::translate("main", "directory")))
|
QCoreApplication::translate("main", "directory")))
|
||||||
, m_pluginNameOption(
|
, m_pluginNameOption(
|
||||||
QCommandLineOption(
|
QCommandLineOption(
|
||||||
QStringList() << "plugin-name" << "plugin-name",
|
QStringList() << "plugin-name",
|
||||||
QCoreApplication::translate("main", "Name of dc-plugin."),
|
QCoreApplication::translate("main", "Name of dc-plugin."),
|
||||||
QCoreApplication::translate("main", "directory")))
|
QCoreApplication::translate("main", "directory")))
|
||||||
, m_noDownloadOption(
|
, m_noDownloadOption(
|
||||||
@@ -57,17 +68,17 @@ CommandLineParser::CommandLineParser()
|
|||||||
QCoreApplication::translate("main", "Always download the dc-bin-file to DC).")))
|
QCoreApplication::translate("main", "Always download the dc-bin-file to DC).")))
|
||||||
, m_workingDirectoryOption(
|
, m_workingDirectoryOption(
|
||||||
QCommandLineOption(
|
QCommandLineOption(
|
||||||
QStringList() << "working-directory" << "working-directory",
|
QStringList() << "working-directory",
|
||||||
QCoreApplication::translate("main", "working directory of update-script."),
|
QCoreApplication::translate("main", "working directory of update-script."),
|
||||||
QCoreApplication::translate("main", "directory")))
|
QCoreApplication::translate("main", "directory")))
|
||||||
, m_psaConfigDirectoryOption(
|
, m_psaConfigDirectoryOption(
|
||||||
QCommandLineOption(
|
QCommandLineOption(
|
||||||
QStringList() << "psa-config-directory" << "psa-config-directory",
|
QStringList() << "psa-config-directory",
|
||||||
QCoreApplication::translate("main", "config directory of json-files sent to dc."),
|
QCoreApplication::translate("main", "config directory of json-files sent to dc."),
|
||||||
QCoreApplication::translate("main", "directory")))
|
QCoreApplication::translate("main", "directory")))
|
||||||
, m_psaTariffDirectoryOption(
|
, m_psaTariffDirectoryOption(
|
||||||
QCommandLineOption(
|
QCommandLineOption(
|
||||||
QStringList() << "psa-tariff-directory" << "psa-tariff-directory",
|
QStringList() << "psa-tariff-directory",
|
||||||
QCoreApplication::translate("main", "tariff directory of tariff-json-files."),
|
QCoreApplication::translate("main", "tariff directory of tariff-json-files."),
|
||||||
QCoreApplication::translate("main", "directory")))
|
QCoreApplication::translate("main", "directory")))
|
||||||
, m_dryRunOption(
|
, m_dryRunOption(
|
||||||
@@ -94,8 +105,8 @@ CommandLineParser::CommandLineParser()
|
|||||||
, m_readDCVersionOption(
|
, m_readDCVersionOption(
|
||||||
QCommandLineOption(
|
QCommandLineOption(
|
||||||
QStringList() << "D" << "read-dc-version",
|
QStringList() << "D" << "read-dc-version",
|
||||||
QCoreApplication::translate("main", "Show version of device controller."),
|
QCoreApplication::translate("main", "Show version of device controller.")))
|
||||||
QCoreApplication::translate("main", "Show version of device controller."))) {
|
{
|
||||||
configure();
|
configure();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,9 +115,15 @@ void CommandLineParser::configure() {
|
|||||||
m_parser.addHelpOption();
|
m_parser.addHelpOption();
|
||||||
m_parser.addVersionOption();
|
m_parser.addVersionOption();
|
||||||
|
|
||||||
m_repositoryUrlOption.setDefaultValue("https://git.mimbach49.de/GerhardHoffmann");
|
m_repositoryUrlOption.setDefaultValue("gitea@ptu-config.atb-comm.de:ATB/");
|
||||||
m_parser.addOption(m_repositoryUrlOption);
|
m_parser.addOption(m_repositoryUrlOption);
|
||||||
|
|
||||||
|
m_sshKeyFileOption.setDefaultValue("/opt/app/tools/atbupdate/.keys/id_ed25519_ptuConfig");
|
||||||
|
m_parser.addOption(m_sshKeyFileOption);
|
||||||
|
|
||||||
|
m_sshOptionStrictHostKeyCheckingOption.setDefaultValue("");
|
||||||
|
m_parser.addOption(m_sshOptionStrictHostKeyCheckingOption);
|
||||||
|
|
||||||
m_iniFileDirectoryOption.setDefaultValue(QCoreApplication::applicationDirPath());
|
m_iniFileDirectoryOption.setDefaultValue(QCoreApplication::applicationDirPath());
|
||||||
m_parser.addOption(m_iniFileDirectoryOption);
|
m_parser.addOption(m_iniFileDirectoryOption);
|
||||||
|
|
||||||
@@ -177,6 +194,12 @@ void CommandLineParser::readSettings() {
|
|||||||
if (key.contains("repository-url")) {
|
if (key.contains("repository-url")) {
|
||||||
m_repositoryUrl = v.toString();
|
m_repositoryUrl = v.toString();
|
||||||
} else
|
} else
|
||||||
|
if (key.contains("sshKeyFile")) {
|
||||||
|
m_sshKeyFile = v.toString();
|
||||||
|
} else
|
||||||
|
if (key.contains("sshOptionStrictHostKeyChecking")) {
|
||||||
|
m_sshOptionStrictHostKeyChecking = (v.toBool() ? "true" : "false");
|
||||||
|
} else
|
||||||
if (key.contains("plugin-directory")) {
|
if (key.contains("plugin-directory")) {
|
||||||
m_plugInDir = v.toString();
|
m_plugInDir = v.toString();
|
||||||
} else
|
} else
|
||||||
@@ -237,6 +260,21 @@ QString CommandLineParser::repositoryUrl() {
|
|||||||
return m_repositoryUrl;
|
return m_repositoryUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString CommandLineParser::sshKeyFile() {
|
||||||
|
if (m_parser.isSet(m_sshKeyFileOption)) {
|
||||||
|
m_sshKeyFile = m_parser.value(m_sshKeyFileOption);
|
||||||
|
}
|
||||||
|
return m_sshKeyFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CommandLineParser::sshOptionStrictHostKeyChecking()
|
||||||
|
{
|
||||||
|
if (m_parser.isSet(m_sshOptionStrictHostKeyCheckingOption)) {
|
||||||
|
m_sshOptionStrictHostKeyChecking = m_parser.value(m_sshOptionStrictHostKeyCheckingOption);
|
||||||
|
}
|
||||||
|
return m_sshOptionStrictHostKeyChecking == "false" ? false : true;
|
||||||
|
}
|
||||||
|
|
||||||
QString CommandLineParser::plugInDir() {
|
QString CommandLineParser::plugInDir() {
|
||||||
if (m_parser.isSet(m_pluginDirectoryOption)) {
|
if (m_parser.isSet(m_pluginDirectoryOption)) {
|
||||||
m_plugInDir = m_parser.value(m_pluginDirectoryOption);
|
m_plugInDir = m_parser.value(m_pluginDirectoryOption);
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
class CommandLineParser : public QCommandLineParser {
|
class CommandLineParser : public QCommandLineParser {
|
||||||
QString m_repositoryUrl;
|
QString m_repositoryUrl;
|
||||||
|
QString m_sshKeyFile;
|
||||||
|
QString m_sshOptionStrictHostKeyChecking;
|
||||||
QString m_plugInDir;
|
QString m_plugInDir;
|
||||||
QString m_plugInName;
|
QString m_plugInName;
|
||||||
QString m_workingDir;
|
QString m_workingDir;
|
||||||
@@ -25,6 +27,8 @@ class CommandLineParser : public QCommandLineParser {
|
|||||||
QString m_dcDir{"etc/dc/"};
|
QString m_dcDir{"etc/dc/"};
|
||||||
|
|
||||||
QCommandLineOption m_repositoryUrlOption;
|
QCommandLineOption m_repositoryUrlOption;
|
||||||
|
QCommandLineOption m_sshKeyFileOption;
|
||||||
|
QCommandLineOption m_sshOptionStrictHostKeyCheckingOption;
|
||||||
QCommandLineOption m_iniFileDirectoryOption;
|
QCommandLineOption m_iniFileDirectoryOption;
|
||||||
QCommandLineOption m_iniFileNameOption;
|
QCommandLineOption m_iniFileNameOption;
|
||||||
QCommandLineOption m_pluginDirectoryOption;
|
QCommandLineOption m_pluginDirectoryOption;
|
||||||
@@ -57,6 +61,8 @@ public:
|
|||||||
QString const &iniFileName() const { return m_iniFileName; }
|
QString const &iniFileName() const { return m_iniFileName; }
|
||||||
void readSettings();
|
void readSettings();
|
||||||
QString repositoryUrl();
|
QString repositoryUrl();
|
||||||
|
QString sshKeyFile();
|
||||||
|
bool sshOptionStrictHostKeyChecking();
|
||||||
QString plugInDir();
|
QString plugInDir();
|
||||||
QString plugInName();
|
QString plugInName();
|
||||||
QString workingDir();
|
QString workingDir();
|
||||||
|
|||||||
@@ -400,6 +400,12 @@ std::optional<QString> GitClient::gitPull() {
|
|||||||
If remote host keys are changed, then
|
If remote host keys are changed, then
|
||||||
|
|
||||||
export GIT_SSH_COMMAND="ssh -i /opt/app/tools/atbupdate/.keys/id_ed25519_ptuConfig"
|
export GIT_SSH_COMMAND="ssh -i /opt/app/tools/atbupdate/.keys/id_ed25519_ptuConfig"
|
||||||
|
|
||||||
|
... or ignore host key checking:
|
||||||
|
export GIT_SSH_COMMAND="ssh -i /opt/app/tools/atbupdate/.keys/id_ed25519_ptuConfig -o StrictHostKeyChecking=no"
|
||||||
|
|
||||||
|
... or use separate known_hosts file:
|
||||||
|
export GIT_SSH_COMMAND="ssh -i /mypath/.keys/id_ed25519 -o StrictHostKeyChecking=yes -o UserKnownHostsFile=/opt/app/tools/atbupdate/.keys/known_hosts
|
||||||
git pull
|
git pull
|
||||||
|
|
||||||
leads to the following warning/error message:
|
leads to the following warning/error message:
|
||||||
|
|||||||
@@ -72,22 +72,31 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
CommandLineParser parser;
|
CommandLineParser parser;
|
||||||
parser.process(a);
|
parser.process(a);
|
||||||
|
|
||||||
|
if (parser.isSet(parser.addHelpOption())) {
|
||||||
|
parser.showHelp(0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
parser.readSettings();
|
parser.readSettings();
|
||||||
|
|
||||||
QString repositoryUrl = parser.repositoryUrl();
|
QString repositoryUrl = parser.repositoryUrl();
|
||||||
|
QString sshKeyFile = parser.sshKeyFile();
|
||||||
|
bool strictHostKeyChecking = parser.sshOptionStrictHostKeyChecking();
|
||||||
|
|
||||||
if (repositoryUrl.endsWith('/')) {
|
if (repositoryUrl.endsWith('/')) {
|
||||||
repositoryUrl.chop(1);
|
repositoryUrl.chop(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString gitSSHCommand("");
|
// default for gitSSHCommand
|
||||||
|
QString gitSSHCommand = "ssh -i " + sshKeyFile;
|
||||||
|
|
||||||
|
strictHostKeyChecking ? gitSSHCommand.append(" -o StrictHostKeyChecking=yes")
|
||||||
|
: gitSSHCommand.append(" -o StrictHostKeyChecking=no");
|
||||||
|
|
||||||
if (repositoryUrl.contains("ptu-config.atb-comm.de")) {
|
|
||||||
QByteArray const v = qgetenv("GIT_SSH_COMMAND");
|
QByteArray const v = qgetenv("GIT_SSH_COMMAND");
|
||||||
if (v.isEmpty()) {
|
if (v.isEmpty()) {
|
||||||
QString sshKeyFile("/opt/app/tools/atbupdate/.keys/id_ed25519_ptuConfig");
|
|
||||||
if (QFileInfo(sshKeyFile).exists()) {
|
if (QFileInfo(sshKeyFile).exists()) {
|
||||||
gitSSHCommand = "ssh -i /opt/app/tools/atbupdate/.keys/id_ed25519_ptuConfig";
|
|
||||||
if (!qputenv("GIT_SSH_COMMAND", QByteArray(gitSSHCommand.toStdString().c_str()))) {
|
if (!qputenv("GIT_SSH_COMMAND", QByteArray(gitSSHCommand.toStdString().c_str()))) {
|
||||||
qCritical() << "ERROR: GIT_SSH_COMMAND not put into env. Exiting...";
|
qCritical() << "ERROR: GIT_SSH_COMMAND not put into env. Exiting...";
|
||||||
return -1;
|
return -1;
|
||||||
@@ -100,11 +109,6 @@ int main(int argc, char *argv[]) {
|
|||||||
gitSSHCommand = QString(v.toStdString().c_str());
|
gitSSHCommand = QString(v.toStdString().c_str());
|
||||||
qCritical() << "WARNING GIT_SSH_COMMAND already set in enviroment:"
|
qCritical() << "WARNING GIT_SSH_COMMAND already set in enviroment:"
|
||||||
<< gitSSHCommand;
|
<< gitSSHCommand;
|
||||||
if (gitSSHCommand != "ssh -i /opt/app/tools/atbupdate/.keys/id_ed25519_ptuConfig") {
|
|
||||||
qCritical() << "ERROR" << gitSSHCommand << "wrong. Exiting...";
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString plugInDir = parser.plugInDir();
|
QString plugInDir = parser.plugInDir();
|
||||||
@@ -161,7 +165,6 @@ int main(int argc, char *argv[]) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QThread::currentThread()->setObjectName("main thread");
|
QThread::currentThread()->setObjectName("main thread");
|
||||||
qInfo() << "Main thread" << QThread::currentThreadId();
|
qInfo() << "Main thread" << QThread::currentThreadId();
|
||||||
|
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ void Worker::privateUpdate() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
//return;
|
||||||
|
|
||||||
QString func(__PRETTY_FUNCTION__);
|
QString func(__PRETTY_FUNCTION__);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user