Skip to content

Commit a60c2f8

Browse files
committed
move the chroot logic to a separate agent to fix the update process chroot bugs
1 parent e1fcfc3 commit a60c2f8

9 files changed

Lines changed: 1044 additions & 649 deletions

File tree

include/nuts/SystemInterface.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ class NUTS_EXPORT SystemInterface : public QObject {
3838
// Overlay operations
3939
bool executeInOverlay(const QStringList& command, QString& output, QString& error);
4040

41+
// Long-running variant for the single agent call.
42+
// Timeout defaults to 7200000 ms (2 hours) to cover the full update pipeline.
43+
bool executeInOverlayAgent(const QStringList& command, QString& output,
44+
QString& error, int timeout = 7200000);
45+
4146
// File operations
4247
bool downloadFile(const QString& url, const QString& destination);
4348
QString calculateMD5(const QString& filePath);

include/nuts/UpdateManager.h

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,17 @@ class NUTS_EXPORT UpdateManager : public QObject {
4747
QString m_updateUrl;
4848
QString m_updateChecksum;
4949
QString m_otaChecksum;
50-
QString m_pkgManagerPath;
5150
QStringList m_mirrorList;
5251
QMap<QString, QString> m_queryData;
5352

54-
// Helper methods for update process
53+
// Pre-chroot helpers (run on host)
5554
bool checkDiskSpace();
56-
bool prepareSystemPartitions();
57-
bool downloadOTAPayload();
58-
bool verifySquashFSIntegrity(const QString& squashfsPath);
59-
bool mountOTAPayload();
60-
bool prepareUpdateTools();
61-
bool syncPackageData();
62-
bool performPackageUpdates();
63-
bool runCleanupCrew();
64-
void cleanup();
55+
56+
// Write the parameter file for nuts-agent and launch it in a single chroot session.
57+
bool writeAgentParams(const QString& filePath, bool hasNvidia) const;
58+
59+
// Parse structured output from nuts-agent and relay progress signals.
60+
void parseAndRelayAgentOutput(const QString& output);
6561

6662
// Version comparison helper
6763
static int compareVersions(const QString& version1, const QString& version2);

src/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Library
22
add_subdirectory(lib)
33

4+
# Agent (single-session chroot binary)
5+
add_subdirectory(agent)
6+
47
# Helper (privileged backend)
58
add_subdirectory(helper)
69

src/agent/CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
set(AGENT_SOURCES
2+
main.cpp
3+
NutsAgent.cpp
4+
)
5+
6+
add_executable(nuts-agent ${AGENT_SOURCES})
7+
8+
target_include_directories(nuts-agent
9+
PRIVATE
10+
${CMAKE_SOURCE_DIR}/include
11+
)
12+
13+
target_link_libraries(nuts-agent
14+
PRIVATE
15+
Qt6::Core
16+
)
17+
18+
install(TARGETS nuts-agent
19+
RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
20+
)

0 commit comments

Comments
 (0)