Skip to content

fix: install systemd drop-in under libdir - #741

Merged
lzwind merged 1 commit into
linuxdeepin:masterfrom
felixonmars:fix-systemd-dropin-install-dir
Aug 31, 2026
Merged

fix: install systemd drop-in under libdir#741
lzwind merged 1 commit into
linuxdeepin:masterfrom
felixonmars:fix-systemd-dropin-install-dir

Conversation

@felixonmars

@felixonmars felixonmars commented Aug 30, 2026

Copy link
Copy Markdown
Member

The service drop-in is shipped by the project, so install it next to packaged systemd units instead of under /etc/systemd/system, which is reserved for local administrator overrides.

Summary by Sourcery

Bug Fixes:

  • Install the packaged systemd service drop-in under the system unit directory instead of the administrator override directory.

@sourcery-ai

sourcery-ai Bot commented Aug 30, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates the CMake installation path for the project-provided systemd drop-in so it is installed alongside packaged units under the configured libdir rather than /etc/systemd/system, preserving /etc for local administrator overrides.

File-Level Changes

Change Details Files
Relocate the packaged systemd service drop-in from the administrator override directory to the package-managed systemd unit directory.
  • Change the install destination to ${CMAKE_INSTALL_LIBDIR}/systemd/system/, aligning the drop-in with packaged units and libdir configuration.
deepin-devicemanager-server/deepin-devicecontrol/CMakeLists.txt

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="deepin-devicemanager-server/deepin-devicecontrol/CMakeLists.txt" line_range="136" />
<code_context>
 install(FILES deepin-devicecontrol.service DESTINATION lib/systemd/system/)
 # 添加安全加固策略
-install(DIRECTORY deepin-service-group@.service.d DESTINATION /etc/systemd/system/)
+install(DIRECTORY deepin-service-group@.service.d DESTINATION ${CMAKE_INSTALL_LIBDIR}/systemd/system/)
</code_context>
<issue_to_address>
**🚨 issue (security):** On Debian multiarch builds, `${CMAKE_INSTALL_LIBDIR}` resolves to a path such as `lib/x86_64-linux-gnu`, so the drop-in is installed under `/usr/lib/x86_64-linux-gnu/systemd/system/`, which systemd does not search for unit drop-ins. The packaged `deepin-devicecontrol.service` remains under `/usr/lib/systemd/system/`, so this security-hardening drop-in is never applied.

**Triggers:** When the package is built on a multiarch system or with a non-default library directory.

**Suggested fix:** Install the drop-in beside the unit in `${CMAKE_INSTALL_PREFIX}/lib/systemd/system/`, or otherwise use the systemd vendor-unit directory rather than the architecture-specific library directory.

```suggestion
install(DIRECTORY deepin-service-group@.service.d DESTINATION lib/systemd/system/)
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread deepin-devicemanager-server/deepin-devicecontrol/CMakeLists.txt Outdated
The deepin-service-group@.service.d drop-in is shipped by the project, so install it with packaged systemd units instead of /etc/systemd/system, which is reserved for local administrator overrides.

Use lib/systemd/system to match deepin-devicecontrol.service and avoid architecture-specific CMAKE_INSTALL_LIBDIR values such as lib/x86_64-linux-gnu, which systemd does not search for unit drop-ins.
@felixonmars
felixonmars force-pushed the fix-systemd-dropin-install-dir branch from 537d434 to 484b857 Compare August 30, 2026 09:27
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 100 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 未发现安全问题,变更正确将 systemd drop-in 安装目录从 /etc/systemd/system/ 改为 lib/systemd/system/,符合 systemd 打包最佳实践

🔍 详细分析

1. 语法逻辑 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


2. 代码质量 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


3. 代码性能 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


4. 代码安全 🔒

评价: 优秀 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: []


💡 改进建议代码示例

// 暂无代码示例

本报告由 AI 代码审查工具自动生成

@BLumia
BLumia requested a review from lzwind August 31, 2026 05:40
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: felixonmars, lzwind

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

@lzwind
lzwind merged commit 4650760 into linuxdeepin:master Aug 31, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants