Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Tools/Niklas-Excon-Helper/initiate.py
T
torsten d5c13033e2 Session 022: Migrate Lts/Tools (72 submodules) to Qt6
- Copied complete Lts/Tools directory from qt5-before to qt6-after
- Updated 32 CMakeLists.txt files (Qt5:: → Qt6::)
- Tools subdirectory already included in parent Lts/CMakeLists.txt
- All 72 tool submodules now present in qt6-migrated-legatus
- Includes: Adler, ArAssets, ConfigX, DBAdministration, DBUpdate,
  DdsView, InfrastructureManagement, and 67 more tools
- C++17 standard (RTI 7.7.0 compatibility maintained)
- Tests deferred until final validation phase

Migration progress:
✅ Lts/Application (68 files)
✅ Lts/DDS (verified Qt6-ready)
✅ Lts/Plugins (60 submodules, verified)
✅ Lts/Projects (5 submodules, verified)
✅ Lts/Proxies (13 submodules, verified)
✅ Lts/Services (47 submodules, verified)
✅ Lts/Tools (72 submodules, copied + CMake updated)
✅ Lts/Viewer (LtsFileDialog, LtsReportDisplay, SituationMap)
🟡 TetraIF (partial)
🟡 Z (partial: nglwidgets, QtSingleApplication, qsql_informix, WMS_Interface)
2026-08-25 14:07:20 +02:00

177 lines
5.4 KiB
Python
Executable File

import os.path
import shutil
import subprocess
import sys
import stat
from prompt_toolkit import prompt
import settings
from local import check_rpm_package_installed
from network import is_reachable, check_ssh_credentials
def initiate():
root_pass = prompt("Local root password:")
install_self(root_pass)
if autoinit(root_pass):
return
settings_dict = dict()
tds = prompt("Address of TDS (Standard is EXCTDS01):")
if tds == "":
tds = "EXCTDS01"
settings_dict["tds"] = tds
if tds != "localhost":
tds_user = prompt("TDS Username (Standard is ctc):")
if tds_user == "":
tds_user = "ctc"
settings_dict["tds_user"] = tds_user
tds_pass = prompt("TDS Password (Standard is ctc11de):")
if tds_pass == "":
tds_pass = "ctc11de"
settings_dict["tds_pass"] = tds_pass
ws = prompt("Address of WS (Standard is localhost):")
if ws == "":
ws = "localhost"
settings_dict["ws"] = ws
if ws != "localhost":
ws_user = prompt("WS Username (Standard is ctc):")
if ws_user == "":
ws_user = "ctc"
settings_dict["ws_user"] = ws_user
ws_pass = prompt("WS Password (Standard is ctc11de):")
if ws_pass == "":
ws_pass = "ctc11de"
settings_dict["ws_pass"] = ws_pass
dbs = prompt("Address of DBS (Standard is EXCDBS01):")
if dbs == "":
dbs = "EXCDBS01"
settings_dict["dbs"] = dbs
if dbs != "localhost":
dbs_user = prompt("DBS Username (Standard is postgres):")
if dbs_user == "":
dbs_user = "postgres"
settings_dict["dbs_user"] = dbs_user
dbs_pass = prompt("DBS Password (Standard is postgres):")
if dbs_pass == "":
dbs_pass = "postgres"
settings_dict["dbs_pass"] = dbs_pass
avs = prompt("Address of AVS (Standard is EXCDAVS01):")
if avs == "":
avs = "EXCAVS01"
settings_dict["avs"] = avs
if avs != "localhost":
avs_user = prompt("AVS Username (Standard is ctc):")
if avs_user == "":
avs_user = "ctc"
settings_dict["avs_user"] = avs_user
avs_pass = prompt("AVS Password (Standard is ctc11de):")
if avs_pass == "":
avs_pass = "ctc11de"
settings_dict["avs_pass"] = avs_pass
build = prompt("Is the software installed over rpm? (y/n):")
if build == "y":
aws = prompt("Admin Workstation Address (Standard is CCSAWS01):")
if aws == "":
aws = "CCSAWS01"
settings_dict["aws"] = aws
settings_dict["rpm"] = True
else:
settings_dict["rpm"] = False
settings.save_settings(settings_dict, root_pass)
print("Erfolgreich gespeichert!")
def autoinit(root_pass):
settings_dict = dict()
if is_reachable("EXCTDS01", False):
tds = "EXCTDS01"
if check_ssh_credentials(tds, "ctc", "ctc11de"):
tds_user = "ctc"
tds_pass = "ctc11de"
settings_dict["tds_user"] = tds_user
settings_dict["tds_pass"] = tds_pass
else:
print("Auto Init failed. Please enter the credentials manually.")
return False
else:
tds = "localhost"
settings_dict["tds"] = tds
if is_reachable("EXCDBS01", False):
dbs = "EXCDBS01"
if check_ssh_credentials(dbs, "postgres", "postgres"):
settings_dict["dbs_user"] = "postgres"
settings_dict["dbs_pass"] = "postgres"
else:
print("Auto Init failed. Please enter the credentials manually.")
return False
else:
dbs = "localhost"
settings_dict["dbs"] = dbs
settings_dict["ws"] = "localhost"
settings_dict["ws_user"] = "ctc"
settings_dict["ws_pass"] = "ctc11de"
if is_reachable("EXCAVS01", False):
settings_dict["avs"] = "EXCAVS01"
if check_ssh_credentials("EXCAVS01", "ctc", "ctc11de"):
settings_dict["avs_user"] = "ctc"
settings_dict["avs_pass"] = "ctc11de"
else:
print("Auto Init failed. Please enter the credentials manually.")
return False
if check_rpm_package_installed('guez_ws'):
if is_reachable("CCSAWS01", False):
aws = "CCSAWS01"
if check_ssh_credentials(aws, "root", "!Moutde"):
settings_dict["aws"] = aws
settings_dict["aws_user"] = "root"
settings_dict["aws_pass"] = "!Moutde"
settings_dict["rpm"] = True
else:
print("Auto Init failed. Please enter the credentials manually.")
return False
else:
print("Auto Init failed. Please enter the credentials manually.")
return False
else:
settings_dict["rpm"] = False
settings.save_settings(settings_dict, root_pass)
def install_self(root_pass):
target_bin_path = f"/usr/local/bin/excon"
try:
# Kopiere die Datei nach /usr/local/bin mit sudo
subprocess.run(f"echo {root_pass} | sudo -S cp {sys.executable} {target_bin_path}", shell=True, check=True)
# Setze die Ausführberechtigung für die Datei
subprocess.run(f"echo {root_pass} | sudo -S chmod +x {target_bin_path}", shell=True, check=True)
except subprocess.CalledProcessError as e:
print(f"Fehler beim Kopieren der Datei nach '/usr/local/bin': {e}")
except Exception as e:
print(f"Unbekannter Fehler: {e}")