Skip to content
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

Refactor systemd unit installation #23

Closed
wants to merge 3 commits into from

Conversation

jtagcat
Copy link
Contributor

@jtagcat jtagcat commented Oct 14, 2023

No description provided.

@Foxboron
Copy link
Owner

While I don't object to the changes it would be nice to get a better description why these changes are needed.

They also seem to change some inconsequential function names for no particular reason?

@jtagcat jtagcat temporarily deployed to Build, sign, release binaries October 14, 2023 12:56 — with GitHub Actions Inactive
@jtagcat jtagcat temporarily deployed to Build, sign, release binaries October 14, 2023 12:56 — with GitHub Actions Inactive
@jtagcat jtagcat temporarily deployed to Build, sign, release binaries October 14, 2023 12:56 — with GitHub Actions Inactive
@jtagcat
Copy link
Contributor Author

jtagcat commented Oct 14, 2023

Context: I'm trying to get TPM ssh keys working. Some (mainly spacing changes) are by auto-run gofmt and me reading the code.

fix slog formatting is because slog doesn't use fmt (see https://pkg.go.dev/log/slog)

For the other commit, I went looking why my user unit exec pointed to $HOME/go/bin, not $HOME/go/bin/ssh-tpm-agent. In the end, I have no idea why, it seems fine, when trying again.

The systemd check was wrong: you can run systemd without the .config/systemd/user directory existing.

The function name changes are for readability, in most cases Get* is not needed, as it is assumed. https://www.youtube.com/watch?v=-J3wNP6u5YU might give a fair-enough longer explanation. You are the maintainer, feel free to drop the name changes.

Any other changes here are pure refactor, iirc avoiding copy-pasta code in the install functions.

@jtagcat jtagcat force-pushed the installUnitsRefactor branch from f1338eb to 7e3eeb8 Compare October 14, 2023 13:43
@Foxboron
Copy link
Owner

Foxboron commented Oct 14, 2023

For the other commit, I went looking why my user unit exec pointed to $HOME/go/bin, not $HOME/go/bin/ssh-tpm-agent. In the end, I have no idea why, it seems fine, when trying again.

This change fixed it probably; e1ecab3

@jtagcat jtagcat temporarily deployed to Build, sign, release binaries October 14, 2023 13:50 — with GitHub Actions Inactive
@jtagcat jtagcat temporarily deployed to Build, sign, release binaries October 14, 2023 13:50 — with GitHub Actions Inactive
@jtagcat jtagcat temporarily deployed to Build, sign, release binaries October 14, 2023 13:50 — with GitHub Actions Inactive
@jtagcat
Copy link
Contributor Author

jtagcat commented Oct 14, 2023

For the other commit, I went looking why my user unit exec pointed to $HOME/go/bin, not $HOME/go/bin/ssh-tpm-agent. In the end, I have no idea why, it seems fine, when trying again.

This change fixed it probably; e1ecab3

aha, yep the problem was that I installed 0.1.0 with go install ...@latest (or AUR), since release candidates are not actual releases. I created the unit before I upgraded to 1.0.0-rc2.

@Foxboron
Copy link
Owner

aha, yep the problem was that I installed 0.1.0 with go install ...@latest (or AUR), since release candidates are not actual releases. I created the unit before I upgraded to 1.0.0-rc2.

Ohh, I was not aware that go would be that clever and ignore the tag.

@@ -24,7 +24,7 @@ install: $(BINS)
@install -dm755 $(DESTDIR)$(LIBDIR)/systemd/system
@install -dm755 $(DESTDIR)$(LIBDIR)/systemd/user
@DESTDIR=$(DESTDIR) PREFIX=$(PREFIX) bin/ssh-tpm-hostkeys --install-system-units
@TEMPLATE_BINARY=1 DESTDIR=$(DESTDIR) PREFIX=$(PREFIX) bin/ssh-tpm-agent --install-user-units --install-system
@TEMPLATE_BINARY=/usr/bin/ssh-tpm-agent DESTDIR=$(DESTDIR) PREFIX=$(PREFIX) bin/ssh-tpm-agent --install-user-units --install-system
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
@TEMPLATE_BINARY=/usr/bin/ssh-tpm-agent DESTDIR=$(DESTDIR) PREFIX=$(PREFIX) bin/ssh-tpm-agent --install-user-units --install-system
@TEMPLATE_BINARY=$(BINDIR)/ssh-tpm-agent DESTDIR=$(DESTDIR) PREFIX=$(PREFIX) bin/ssh-tpm-agent --install-user-units --install-system

@Foxboron
Copy link
Owner

Generally for the future, it would be better to have the descriptions explaining "why" in the commits themselves, then we won't be at the mercy of github to contexualize the commits :)

Other then that it's fine. I can amend the BINDIR change.

@jtagcat jtagcat temporarily deployed to Build, sign, release binaries October 15, 2023 12:13 — with GitHub Actions Inactive
@jtagcat jtagcat temporarily deployed to Build, sign, release binaries October 15, 2023 12:13 — with GitHub Actions Inactive
@jtagcat jtagcat temporarily deployed to Build, sign, release binaries October 15, 2023 12:13 — with GitHub Actions Inactive
@Foxboron
Copy link
Owner

Merged with 7f5985f

@Foxboron Foxboron closed this Oct 15, 2023
@jtagcat jtagcat deleted the installUnitsRefactor branch October 16, 2023 01:15
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.

2 participants