feat(daemon): update service descriptors for systemd and launchctl#130
feat(daemon): update service descriptors for systemd and launchctl#130
Conversation
- Update systemd service file (shelltime.service) - Update macOS launchctl plist (xyz.shelltime.daemon.plist) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Summary of ChangesHello @AnnatarHe, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refines the service descriptors for the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Codecov Report✅ All modified and coverable lines are covered by tests.
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request updates the systemd and launchctl service descriptors to run the daemon process within a login shell, which helps in sourcing the correct user environment. The changes for the macOS launchctl plist appear correct and follow good practices. However, the systemd service file introduces a critical issue by hardcoding the username, and it also retains a hardcoded path to the executable, which is likely incorrect. My review includes a suggestion to fix these issues by using template variables, which will require a small corresponding change in the Go installer code.
| [Service] | ||
| Type=simple | ||
| ExecStart=/usr/local/bin/shelltime-daemon | ||
| ExecStart=/bin/sh -c 'exec $(getent passwd username | cut -d: -f7) -l -c "/usr/local/bin/shelltime-daemon"' |
There was a problem hiding this comment.
The ExecStart command has two issues that will prevent the service from running correctly:
-
Hardcoded username: The username is hardcoded as
username. This will causegetent passwd usernameto fail for any user whose login is not 'username'. This should be replaced with the template variable{{.UserName}}. -
Hardcoded executable path: The path to
shelltime-daemonis hardcoded to/usr/local/bin/shelltime-daemon. The installer logic places the binary at a path constructed fromBaseFolder. This path should also be templated, e.g.,{{.BaseFolder}}/bin/shelltime-daemon, just like in the macOS.plistfile.
Fixing this will also require updating model/daemon-installer.linux.go to pass the BaseFolder variable to the template.
ExecStart=/bin/sh -c 'exec $(getent passwd {{.UserName}} | cut -d: -f7) -l -c "{{.BaseFolder}}/bin/shelltime-daemon"'
Summary
Changes
model/sys-desc/shelltime.service- systemd service descriptormodel/sys-desc/xyz.shelltime.daemon.plist- macOS launchctl daemon plistTest plan
🤖 Generated with Claude Code