summaryrefslogtreecommitdiff
path: root/cmd/podman-mac-helper
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman-mac-helper')
-rw-r--r--cmd/podman-mac-helper/install.go16
-rw-r--r--cmd/podman-mac-helper/main.go4
-rw-r--r--cmd/podman-mac-helper/uninstall.go5
3 files changed, 12 insertions, 13 deletions
diff --git a/cmd/podman-mac-helper/install.go b/cmd/podman-mac-helper/install.go
index a1b99e66c..7b8753820 100644
--- a/cmd/podman-mac-helper/install.go
+++ b/cmd/podman-mac-helper/install.go
@@ -5,6 +5,7 @@ package main
import (
"bytes"
+ "errors"
"fmt"
"io"
"io/fs"
@@ -14,7 +15,6 @@ import (
"syscall"
"text/template"
- "github.com/pkg/errors"
"github.com/spf13/cobra"
)
@@ -111,7 +111,7 @@ func install(cmd *cobra.Command, args []string) error {
file, err := os.OpenFile(fileName, os.O_WRONLY|os.O_CREATE|os.O_EXCL, rw_r_r)
if err != nil {
- return errors.Wrap(err, "error creating helper plist file")
+ return fmt.Errorf("creating helper plist file: %w", err)
}
defer file.Close()
_, err = buf.WriteTo(file)
@@ -120,7 +120,7 @@ func install(cmd *cobra.Command, args []string) error {
}
if err = runDetectErr("launchctl", "load", fileName); err != nil {
- return errors.Wrap(err, "launchctl failed loading service")
+ return fmt.Errorf("launchctl failed loading service: %w", err)
}
return nil
@@ -133,13 +133,13 @@ func restrictRecursive(targetDir string, until string) error {
return err
}
if info.Mode()&fs.ModeSymlink != 0 {
- return errors.Errorf("symlinks not allowed in helper paths (remove them and rerun): %s", targetDir)
+ return fmt.Errorf("symlinks not allowed in helper paths (remove them and rerun): %s", targetDir)
}
if err = os.Chown(targetDir, 0, 0); err != nil {
- return errors.Wrap(err, "could not update ownership of helper path")
+ return fmt.Errorf("could not update ownership of helper path: %w", err)
}
if err = os.Chmod(targetDir, rwx_rx_rx|fs.ModeSticky); err != nil {
- return errors.Wrap(err, "could not update permissions of helper path")
+ return fmt.Errorf("could not update permissions of helper path: %w", err)
}
targetDir = filepath.Dir(targetDir)
}
@@ -162,7 +162,7 @@ func verifyRootDeep(path string) error {
stat := info.Sys().(*syscall.Stat_t)
if stat.Uid != 0 {
- return errors.Errorf("installation target path must be solely owned by root: %s is not", current)
+ return fmt.Errorf("installation target path must be solely owned by root: %s is not", current)
}
if info.Mode()&fs.ModeSymlink != 0 {
@@ -206,7 +206,7 @@ func installExecutable(user string) (string, error) {
targetDir := filepath.Join(installPrefix, "podman", "helper", user)
if err := os.MkdirAll(targetDir, rwx_rx_rx); err != nil {
- return "", errors.Wrap(err, "could not create helper directory structure")
+ return "", fmt.Errorf("could not create helper directory structure: %w", err)
}
// Correct any incorrect perms on previously existing directories and verify no symlinks
diff --git a/cmd/podman-mac-helper/main.go b/cmd/podman-mac-helper/main.go
index 735d9898f..937cb8433 100644
--- a/cmd/podman-mac-helper/main.go
+++ b/cmd/podman-mac-helper/main.go
@@ -4,6 +4,7 @@
package main
import (
+ "errors"
"fmt"
"io"
"io/ioutil"
@@ -13,7 +14,6 @@ import (
"strconv"
"strings"
- "github.com/pkg/errors"
"github.com/spf13/cobra"
)
@@ -97,7 +97,7 @@ func getUser() (string, string, string, error) {
return "", "", "", fmt.Errorf("invalid uid for user: %s", name)
}
if id == 0 {
- return "", "", "", fmt.Errorf("unexpected root user")
+ return "", "", "", errors.New("unexpected root user")
}
return name, uid, home, nil
diff --git a/cmd/podman-mac-helper/uninstall.go b/cmd/podman-mac-helper/uninstall.go
index f72d0efd1..0c21b27e9 100644
--- a/cmd/podman-mac-helper/uninstall.go
+++ b/cmd/podman-mac-helper/uninstall.go
@@ -9,7 +9,6 @@ import (
"os/exec"
"path/filepath"
- "github.com/pkg/errors"
"github.com/spf13/cobra"
)
@@ -48,13 +47,13 @@ func uninstall(cmd *cobra.Command, args []string) error {
if err := os.Remove(fileName); err != nil {
if !os.IsNotExist(err) {
- return errors.Errorf("could not remove plist file: %s", fileName)
+ return fmt.Errorf("could not remove plist file: %s", fileName)
}
}
helperPath := filepath.Join(installPrefix, "podman", "helper", userName)
if err := os.RemoveAll(helperPath); err != nil {
- return errors.Errorf("could not remove helper binary path: %s", helperPath)
+ return fmt.Errorf("could not remove helper binary path: %s", helperPath)
}
return nil
}