Skip to content

Commit

Permalink
Added missing check for resolvectl
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Saloň committed Aug 5, 2024
1 parent 10547bf commit 4ed9b59
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added
- install scripts for Linux, macOS and Windows
- check if `resolvectl` is available for `vpn` commands

### Fixed
- commands will now exit with exit code 1 for all error types

## [v1.0.20] - 2024-07-02

Expand Down
1 change: 1 addition & 0 deletions src/i18n/en.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ at https://docs.zerops.io/references/cli for further details.`,

// vpn shared
VpnWgQuickIsNotInstalled: "wg-quick is not installed, please visit https://www.wireguard.com/install/",
VpnResolveCtlIsNotInstalled: "resolvectl is not installed, please install systemd-resolved or equivalent for your distribution",
VpnWgQuickIsNotInstalledWindows: "wireguard is not installed, please visit https://www.wireguard.com/install/",

// flags description
Expand Down
1 change: 1 addition & 0 deletions src/i18n/i18n.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ const (

// vpn shared
VpnWgQuickIsNotInstalled = "VpnWgQuickIsNotInstalled"
VpnResolveCtlIsNotInstalled = "VpnResolveCtlIsNotInstalled"
VpnWgQuickIsNotInstalledWindows = "VpnWgQuickIsNotInstalledWindows"

// flags description
Expand Down
8 changes: 5 additions & 3 deletions src/wg/linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ import (
)

func CheckWgInstallation() error {
_, err := exec.LookPath("wg-quick")
if err != nil {
if _, err := exec.LookPath("wg-quick"); err != nil {
return errors.New(i18n.T(i18n.VpnWgQuickIsNotInstalled))
}

// Debian does not have it by default anymore
if _, err := exec.LookPath("resolvectl"); err != nil {
return errors.New(i18n.T(i18n.VpnResolveCtlIsNotInstalled))
}
return nil
}

Expand Down

0 comments on commit 4ed9b59

Please sign in to comment.