Skip to content

fix(model): use template variable for binary path in Linux service file#153

Merged
AnnatarHe merged 1 commit intomainfrom
claude/issue-152-20251222-1324
Dec 23, 2025
Merged

fix(model): use template variable for binary path in Linux service file#153
AnnatarHe merged 1 commit intomainfrom
claude/issue-152-20251222-1324

Conversation

@AnnatarHe
Copy link
Copy Markdown
Contributor

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

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>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @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 shelltime-daemon service by standardizing its binary path configuration. It replaces a hardcoded path in the Linux service file with a templated variable, ensuring the service can correctly locate its executable regardless of the installation location. This change brings the Linux setup in line with macOS configurations, improving overall system consistency and simplifying future maintenance efforts.

Highlights

  • Configuration Standardization: The hardcoded binary path for the shelltime-daemon in the Linux service file has been replaced with a template variable ({{.BaseFolder}}/bin/shelltime-daemon). This change aligns the Linux configuration with the existing pattern used in macOS, promoting consistency across platforms.
  • Improved Flexibility: By using a template variable, the service can now dynamically determine the correct binary path based on the installation's base folder, making the deployment more flexible and less prone to issues if the installation directory varies from the default /usr/local/bin.
  • Bug Fix: This update directly addresses and resolves issue binary path is incorrect please fix it #152, which likely concerned the rigidity or incorrect path resolution of the shelltime-daemon service on Linux systems.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@AnnatarHe AnnatarHe merged commit 773fa43 into main Dec 23, 2025
2 checks passed
@AnnatarHe AnnatarHe deleted the claude/issue-152-20251222-1324 branch December 23, 2025 01:40
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

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"'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

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
Copy link
Copy Markdown

codecov Bot commented Dec 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
unittests 20.32% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

binary path is incorrect please fix it

1 participant