-
Notifications
You must be signed in to change notification settings - Fork 24
fix: remove set -e and exit 0 from postinst script #131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Removed the 'set -e' command and explicit 'exit 0' from the postinst script to follow Debian packaging best practices. The 'set -e' command causes the script to exit immediately on any error, which can prevent proper error handling and cleanup in package installation scripts. The explicit 'exit 0' is unnecessary as the script will naturally exit with the status of the last executed command. These changes ensure the script behaves consistently with standard Debian package installation conventions. Influence: 1. Test package installation and removal to ensure no regression 2. Verify that script errors are handled appropriately without immediate termination 3. Test triggered functionality to confirm proper operation 4. Check that the script exits with correct status codes in various scenarios fix: 从 postinst 脚本中移除 set -e 和 exit 0 移除了 postinst 脚本中的 'set -e' 命令和显式的 'exit 0' 以遵循 Debian 打 包最佳实践。'set -e' 命令会导致脚本在任何错误时立即退出,这可能妨碍包安 装脚本中的正确错误处理和清理。显式的 'exit 0' 是不必要的,因为脚本会自 然以最后执行命令的状态退出。这些更改确保脚本行为符合标准的 Debian 包安装 约定。 Influence: 1. 测试软件包安装和移除以确保没有回归问题 2. 验证脚本错误能够被适当处理而不会立即终止 3. 测试触发功能以确认正常运行 4. 检查脚本在各种场景下是否以正确的状态码退出
|
Warning
|
deepin pr auto review我来审查这段 postinst 脚本的代码: 语法逻辑
代码质量
代码性能
代码安全
改进建议#!/bin/sh
# Handle dconfig triggers
if [ "$1" = "triggered" ]; then
# 检查系统是否使用 systemd
if [ ! -d "/run/systemd/system" ]; then
echo "Warning: systemd not detected, skipping service restart" >&2
exit 0
fi
# 检查服务是否存在
if ! systemctl list-units --all | grep -q "dde-dconfig-daemon.service"; then
echo "Warning: dde-dconfig-daemon.service not found" >&2
exit 0
fi
# 重启服务并检查结果
if ! systemctl restart dde-dconfig-daemon.service; then
echo "Error: Failed to restart dde-dconfig-daemon.service" >&2
exit 1
fi
# 检查服务状态
if ! systemctl is-active --quiet dde-dconfig-daemon.service; then
echo "Error: dde-dconfig-daemon.service is not active after restart" >&2
exit 1
fi
fi
exit 0改进点说明:
这些改进可以提高脚本的健壮性和可靠性,确保在异常情况下能够正确处理并提供有用的错误信息。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR refactors the Debian post-installation script by deleting the “set -e” directive and the final “exit 0” statement, aligning it with Debian packaging best practices to ensure errors are handled gracefully and the script exits with the status of its last command. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, mhduiy The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Removed the 'set -e' command and explicit 'exit 0' from the postinst
script to follow Debian packaging best practices. The 'set -e' command
causes the script to exit immediately on any error, which can prevent
proper error handling and cleanup in package installation scripts.
The explicit 'exit 0' is unnecessary as the script will naturally exit
with the status of the last executed command. These changes ensure the
script behaves consistently with standard Debian package installation
conventions.
Influence:
termination
scenarios
fix: 从 postinst 脚本中移除 set -e 和 exit 0
移除了 postinst 脚本中的 'set -e' 命令和显式的 'exit 0' 以遵循 Debian 打
包最佳实践。'set -e' 命令会导致脚本在任何错误时立即退出,这可能妨碍包安
装脚本中的正确错误处理和清理。显式的 'exit 0' 是不必要的,因为脚本会自
然以最后执行命令的状态退出。这些更改确保脚本行为符合标准的 Debian 包安装
约定。
Influence:
Summary by Sourcery
Remove 'set -e' and explicit 'exit 0' from the Debian postinst script to align with packaging best practices and ensure proper error handling.
Bug Fixes: