]> ruderich.org/simon Gitweb - safcm/safcm.git/blobdiff - rpc/dial.go
Add basic support for OpenBSD
[safcm/safcm.git] / rpc / dial.go
index 680cb87df39ae0c999ce789d5d53bb168ed64b80..ef280191ef57b23ca8f03461a97af206e23ecc67 100644 (file)
@@ -112,6 +112,17 @@ compat_stat() {
 compat_sha512sum() {
        sha512sum "$1"
 }
+`
+       case "freebsd", "openbsd":
+               compat = `
+dir_stat='41777 0 0'
+file_stat="100700 $(id -u) $(id -g)"
+compat_stat() {
+       stat -f '%p %u %g' "$1"
+}
+compat_sha512sum() {
+       sha512 -q "$1"
+}
 `
        default:
                return fmt.Errorf("internal error: no support for %q", goos)
@@ -263,7 +274,7 @@ f
 }
 
 func connGetGoos(stdin io.Writer, stdout *bufio.Reader) (string, error) {
-       _, err := fmt.Fprintln(stdin, "uname -o")
+       _, err := fmt.Fprintln(stdin, "uname")
        if err != nil {
                return "", err
        }
@@ -276,10 +287,14 @@ func connGetGoos(stdin io.Writer, stdout *bufio.Reader) (string, error) {
        // NOTE: Adapt helper uploading in dialSSH() when adding new systems
        var goos string
        switch x {
-       case "GNU/Linux":
+       case "Linux":
                goos = "linux"
+       case "FreeBSD":
+               goos = "freebsd"
+       case "OpenBSD":
+               goos = "openbsd"
        default:
-               return "", fmt.Errorf("unsupported OS %q (`uname -o`)", x)
+               return "", fmt.Errorf("unsupported OS %q (`uname`)", x)
        }
        return goos, nil
 }
@@ -298,7 +313,7 @@ func connGetGoarch(stdin io.Writer, stdout *bufio.Reader) (string, error) {
        // NOTE: Adapt cmd/safcm-remote/build.sh when adding new architectures
        var goarch string
        switch x {
-       case "x86_64":
+       case "x86_64", "amd64":
                goarch = "amd64"
        case "armv7l":
                goarch = "armv7l"