Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion model/sys-desc/shelltime.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@ After=network.target

[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"'
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

The ExecStart command has two issues that will prevent the service from running correctly:

  1. Hardcoded username: The username is hardcoded as username. This will cause getent passwd username to fail for any user whose login is not 'username'. This should be replaced with the template variable {{.UserName}}.

  2. Hardcoded executable path: The path to shelltime-daemon is hardcoded to /usr/local/bin/shelltime-daemon. The installer logic places the binary at a path constructed from BaseFolder. This path should also be templated, e.g., {{.BaseFolder}}/bin/shelltime-daemon, just like in the macOS .plist file.

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"'

Restart=always

# Resource limits
LimitNOFILE=65536

# Logging
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=default.target
4 changes: 3 additions & 1 deletion model/sys-desc/xyz.shelltime.daemon.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
<string>xyz.shelltime.daemon</string>
<key>ProgramArguments</key>
<array>
<string>{{.BaseFolder}}/bin/shelltime-daemon</string>
<string>/bin/sh</string>
<string>-c</string>
<string>exec $SHELL -l -c '{{.BaseFolder}}/bin/shelltime-daemon'</string>
</array>
<key>RunAtLoad</key>
<true/>
Expand Down