fix(model): use template variable for binary path in Linux service file#153
fix(model): use template variable for binary path in Linux service file#153
Conversation
Updated shelltime.service to use {{.BaseFolder}}/bin/shelltime-daemon
instead of hardcoded /usr/local/bin/shelltime-daemon to match the
pattern used in macOS configuration.
Fixes #152
Co-authored-by: Le He <AnnatarHe@users.noreply.github.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 enhances the robustness and portability of 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
|
There was a problem hiding this comment.
Code Review
This pull request updates the Linux service file to use a template variable for the binary path, which is a good move to eliminate hardcoded paths and align with the macOS configuration. However, this change is incomplete as it misses a corresponding update in the Go code that processes this template. The new {{.BaseFolder}} variable is not being supplied, which will lead to a broken service configuration and prevent the daemon from starting on Linux. I've left a critical comment detailing the necessary fix in the Go code.
| [Service] | ||
| Type=simple | ||
| ExecStart=/bin/sh -c 'exec $(getent passwd $USER | cut -d: -f7) -l -c "/usr/local/bin/shelltime-daemon"' | ||
| ExecStart=/bin/sh -c 'exec $(getent passwd $USER | cut -d: -f7) -l -c "{{.BaseFolder}}/bin/shelltime-daemon"' |
There was a problem hiding this comment.
This change introduces the {{.BaseFolder}} template variable, which is a good step towards removing hardcoded paths. However, the Go code that processes this template has not been updated to supply this new variable. This will cause the service file to be generated with an incorrect path for ExecStart, breaking the daemon installation on Linux.
To fix this, you need to update the GetDaemonServiceFile function in model/daemon-installer.linux.go to pass BaseFolder to the template execution context. The baseFolder is available on the LinuxDaemonInstaller struct.
Here's the required change in model/daemon-installer.linux.go (around line 168):
err = tmpl.Execute(&buf, map[string]string{
"UserName": username,
"BaseFolder": l.baseFolder,
})Without this change, the daemon installation will fail.
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:
|
Updated shelltime.service to use {{.BaseFolder}}/bin/shelltime-daemon instead of hardcoded /usr/local/bin/shelltime-daemon to match the pattern used in macOS configuration.
Fixes #152
Generated with Claude Code