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

cmd/tailscale/cli: implement update for dnf/yum-based distros #8678

Merged
merged 1 commit into from
Jul 24, 2023

Conversation

awly
Copy link
Contributor

@awly awly commented Jul 21, 2023

This is the Fedora family of distros, including CentOS, RHEL and others. Tested in fedora:latest and centos:7 containers.

@awly awly force-pushed the awly/tailscale-update-fedora branch from a586726 to cb0e3b4 Compare July 21, 2023 22:30
Comment on lines -237 to -242
track := "unstable"
if stable, ok := versionIsStable(ver); !ok {
return fmt.Errorf("malformed version %q", ver)
} else if stable {
track = "stable"
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is already handled here:

if version.IsUnstableBuild() {
up.track = "unstable"
} else {
up.track = "stable"
}
if updateArgs.version != "" {
stable, ok := versionIsStable(updateArgs.version)
if !ok {
return nil, fmt.Errorf("malformed version %q", updateArgs.version)
}
if stable {
up.track = "stable"
} else {
up.track = "unstable"
}

cmd/tailscale/cli/update.go Fixed Show fixed Hide fixed
cmd/tailscale/cli/update.go Fixed Show fixed Hide fixed
@awly awly force-pushed the awly/tailscale-update-fedora branch from cb0e3b4 to c26387c Compare July 21, 2023 23:03
switch {
case haveExecutable("pacman"):
up.update = up.updateArchLike
case haveExecutable("apt-get"):
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe do haveExecutable("apt") || haveExecutable("apt-get")? Belt and suspenders, or overkill? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Left a TODO, since updateDebLike assumes apt-get and will fail if that's missing, even if apt is present.
Will add apt support in a separate PR.

} else if stable {
track = "stable"
}

if os.Geteuid() != 0 {
return errors.New("must be root; use sudo")
Copy link
Contributor

Choose a reason for hiding this comment

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

I keep thinking about this. It is bad to simply re-invoke ourselves with sudo?

And/or, should we re-tool the error message to talk about doas (OBSD at least, maybe others?) and runas.exe (Windows, when we get to that point)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a helper to check running as root and print an OS-appropriate message.
It doesn't look like updateWindows requires admin privileges, at least not explicitly in the code today.

cmd/tailscale/cli/update.go Outdated Show resolved Hide resolved
cmd/tailscale/cli/update.go Outdated Show resolved Hide resolved
@awly awly force-pushed the awly/tailscale-update-fedora branch 2 times, most recently from 8a288e1 to 62704fa Compare July 22, 2023 00:39
This is the Fedora family of distros, including CentOS, RHEL and others.
Tested in `fedora:latest` and `centos:7` containers.

Updates #6995

Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
@awly awly force-pushed the awly/tailscale-update-fedora branch from 62704fa to 25490d6 Compare July 22, 2023 00:49
@awly awly requested a review from noncombatant July 22, 2023 00:51
@awly awly merged commit 894b237 into main Jul 24, 2023
36 checks passed
@awly awly deleted the awly/tailscale-update-fedora branch July 24, 2023 17:20
alexelisenko pushed a commit to Control-D-Inc/tailscale that referenced this pull request Feb 15, 2024
…ale#8678)

This is the Fedora family of distros, including CentOS, RHEL and others.
Tested in `fedora:latest` and `centos:7` containers.

Updates tailscale#6995

Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
Signed-off-by: Alex Paguis <alex@windscribe.com>
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.

None yet

2 participants