Skip to content

Conversation

@gcsong023
Copy link
Contributor

@gcsong023 gcsong023 commented Nov 7, 2025

What this PR does / why we need it?

Summary of your change

Please indicate you've done the following:

  • Made sure tests are passing and test coverage is added if needed.
  • Made sure commit message follow the rule of Conventional Commits specification.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed.

Introduces a new function to determine the configuration file path
for a service based on the system's service manager. Supports
both default directory paths for empty service names and specific
file paths for named services. Ensures compatibility with
"systemd", "openrc", and "sysvinit", while gracefully handling
unsupported service managers.

Improves service management flexibility and error handling in
multi-environment setups.
Replaces hardcoded systemd service file paths with dynamic retrieval
using `controller.GetServicePath`, enhancing maintainability and
flexibility of the snapshot creation process.

Relates to optimization of systemd service file handling.
…arious systems

Introduces `SelectInitScript` and `GetScriptName` functions to determine
appropriate init script names based on the service manager type.

Supports differences in file naming conventions across "systemd",
"openrc", and "sysvinit" systems, including detection of specific
configurations via file existence checks. Adds `os` package for file
status validation.

Enhances compatibility with multiple initialization systems.
Refactors the service file restoration process to dynamically determine
service paths and names, enhancing compatibility with various Linux
distributions' service management systems.

Attempts to copy configuration files using service names first, falling
back to init script names if necessary, increasing robustness and
adaptability of the restore operation.
Introduces a dedicated backup directory for service scripts during
snapshot creation, recovery, and rollback processes. Ensures proper
backup and restoration of initialization scripts and service-related
files for improved consistency and robustness. Refactors file
operations to use dynamically resolved service paths, reducing
hardcoded dependencies.
Replaces hardcoded service names and paths with dynamically retrieved values to enhance maintainability and flexibility.

Adds checks for creating service script directories during backup and rollback to improve stability and compatibility.

Optimizes the handling of service script copying and backup paths.
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Nov 7, 2025

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Nov 7, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign ssongliu for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

gcsong023 and others added 4 commits November 8, 2025 13:55
在调用 global.LOG.Debugf 前增加 nil 检查,避免当全局日志对象未初始化时程序崩溃。
此问题可能在程序启动早期或日志系统异常时触发,增加健壮性。

Fix nil check for global logger to prevent panic

Adds a nil check before invoking global.LOG.Debugf to ensure
the program does not panic if the global logger is uninitialized.

This improves robustness, particularly during early application
startup or in cases of logging system failures.
在多个构建目标中添加CGO_ENABLED=0环境变量配置,
确保在不同平台下进行静态链接编译,
提升二进制文件的可移植性和运行稳定性。
当 newName 为 "." 或空字符串时,直接将源目录中的内容复制到目标目录,
增加其应用的场景。
@ssongliu ssongliu merged commit 82a0f3a into 1Panel-dev:dev-v2 Nov 11, 2025
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants