Skip to content

fix: 解决没有关机音效的问题#148

Merged
fly602 merged 1 commit into
linuxdeepin:masterfrom
fly602:master
Aug 21, 2025
Merged

fix: 解决没有关机音效的问题#148
fly602 merged 1 commit into
linuxdeepin:masterfrom
fly602:master

Conversation

@fly602
Copy link
Copy Markdown
Contributor

@fly602 fly602 commented Aug 21, 2025

因为用 Requisite= 是“硬依赖”。如果系统上没激活 sound.target(很多环境确实不会激活它),这个服务就不会在开机被拉起,结果就是 enabled 但一直 inactive (dead)

Log: 去掉Requisite,改成Wants
PMS: BUG-315787
Influence: 系统音效

Summary by Sourcery

Bug Fixes:

  • Replace Requisite=sound.target with Wants=sound.target in deepin-shutdown-sound.service to prevent the service from staying inactive in environments without sound.target

因为用 Requisite= 是“硬依赖”。如果系统上没激活 sound.target(很多环境确实不会激活它),这个服务就不会在开机被拉起,结果就是 enabled 但一直 inactive (dead)

Log: 去掉Requisite,改成Wants
PMS: BUG-315787
Influence: 系统音效
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Aug 21, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR updates the deepin-shutdown-sound.service unit by changing its sound.target dependency from a hard ‘Requisite’ to a soft ‘Wants’, ensuring the service is pulled in even when sound.target isn’t explicitly activated.

File-Level Changes

Change Details Files
Switched sound.target dependency from hard to soft
  • Removed Requisite=sound.target
  • Added Wants=sound.target
misc/systemd/system/deepin-shutdown-sound.service

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

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!


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.

@deepin-ci-robot
Copy link
Copy Markdown

deepin pr auto review

我来分析这个systemd服务文件的变更:

  1. 变更内容:
  • 移除了Requisite=的依赖项
  • 新增了Wants=的依赖项
  • 保留了After=Before=的配置
  1. 改进意见:

a) 语法逻辑:

  • 原代码中Requisite=sound.target local-fs.target的写法有误,因为Requisite指令只能有一个单元作为依赖
  • 修改后的代码将依赖关系改为Wants=是正确的,因为Wants允许多个依赖项

b) 代码质量:

  • 建议明确指定服务的行为意图,考虑添加Description的更详细描述
  • 建议添加DefaultDependencies=yes以明确默认依赖关系的行为

c) 代码性能:

  • 使用Wants=而不是Requires是合理的,因为关机声音播放不是关键系统功能
  • 保留After=确保服务在依赖项之后启动,这是正确的

d) 代码安全:

  • 配置看起来是安全的,没有明显的安全隐患
  • 建议添加Type=明确指定服务类型,例如Type=simple
  1. 建议的改进版本:
[Unit]
Description=Deepin shutdown sound service
DefaultDependencies=yes
Wants=sound.target local-fs.target
After=sound.target local-fs.target
Conflicts=shutdown.target
Before=shutdown.target
Type=simple

这些改进使得服务文件更加清晰和完整,同时保持了原有的功能意图。主要改进包括:

  1. 修复了依赖关系的语法错误
  2. 添加了更详细的描述
  3. 明确了默认依赖行为
  4. 指定了服务类型
  5. 保持了原有的启动顺序和冲突关系

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: fly602, robertkill

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

@fly602 fly602 merged commit 111271b into linuxdeepin:master Aug 21, 2025
16 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