Switch remote deploy to vendored source builds
Move remote deployment to a vendored source bundle built on the target host via Docker so redeploys no longer require local cross-compilation or host Go installation. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
14
vendor/github.com/wailsapp/wails/v2/internal/system/operatingsystem/os.go
generated
vendored
Normal file
14
vendor/github.com/wailsapp/wails/v2/internal/system/operatingsystem/os.go
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
package operatingsystem
|
||||
|
||||
// OS contains information about the operating system
|
||||
type OS struct {
|
||||
ID string
|
||||
Name string
|
||||
Version string
|
||||
Branding string
|
||||
}
|
||||
|
||||
// Info retrieves information about the current platform
|
||||
func Info() (*OS, error) {
|
||||
return platformInfo()
|
||||
}
|
||||
49
vendor/github.com/wailsapp/wails/v2/internal/system/operatingsystem/os_darwin.go
generated
vendored
Normal file
49
vendor/github.com/wailsapp/wails/v2/internal/system/operatingsystem/os_darwin.go
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
package operatingsystem
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/wailsapp/wails/v2/internal/shell"
|
||||
)
|
||||
|
||||
func getSysctlValue(key string) (string, error) {
|
||||
stdout, _, err := shell.RunCommand(".", "sysctl", key)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
version := strings.TrimPrefix(stdout, key+": ")
|
||||
return strings.TrimSpace(version), nil
|
||||
}
|
||||
|
||||
func platformInfo() (*OS, error) {
|
||||
// Default value
|
||||
var result OS
|
||||
result.ID = "Unknown"
|
||||
result.Name = "MacOS"
|
||||
result.Version = "Unknown"
|
||||
|
||||
version, err := getSysctlValue("kern.osproductversion")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result.Version = version
|
||||
ID, err := getSysctlValue("kern.osversion")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result.ID = ID
|
||||
|
||||
// cmd := CreateCommand(directory, command, args...)
|
||||
// var stdo, stde bytes.Buffer
|
||||
// cmd.Stdout = &stdo
|
||||
// cmd.Stderr = &stde
|
||||
// err := cmd.Run()
|
||||
// return stdo.String(), stde.String(), err
|
||||
// }
|
||||
// sysctl := shell.NewCommand("sysctl")
|
||||
// kern.ostype: Darwin
|
||||
// kern.osrelease: 20.1.0
|
||||
// kern.osrevision: 199506
|
||||
|
||||
return &result, nil
|
||||
}
|
||||
51
vendor/github.com/wailsapp/wails/v2/internal/system/operatingsystem/os_linux.go
generated
vendored
Normal file
51
vendor/github.com/wailsapp/wails/v2/internal/system/operatingsystem/os_linux.go
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
package operatingsystem
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// platformInfo is the platform specific method to get system information
|
||||
func platformInfo() (*OS, error) {
|
||||
_, err := os.Stat("/etc/os-release")
|
||||
if os.IsNotExist(err) {
|
||||
return nil, fmt.Errorf("unable to read system information")
|
||||
}
|
||||
|
||||
osRelease, _ := os.ReadFile("/etc/os-release")
|
||||
return parseOsRelease(string(osRelease)), nil
|
||||
}
|
||||
|
||||
func parseOsRelease(osRelease string) *OS {
|
||||
|
||||
// Default value
|
||||
var result OS
|
||||
result.ID = "Unknown"
|
||||
result.Name = "Unknown"
|
||||
result.Version = "Unknown"
|
||||
|
||||
// Split into lines
|
||||
lines := strings.Split(osRelease, "\n")
|
||||
// Iterate lines
|
||||
for _, line := range lines {
|
||||
// Split each line by the equals char
|
||||
splitLine := strings.SplitN(line, "=", 2)
|
||||
// Check we have
|
||||
if len(splitLine) != 2 {
|
||||
continue
|
||||
}
|
||||
switch splitLine[0] {
|
||||
case "ID":
|
||||
result.ID = strings.ToLower(strings.Trim(splitLine[1], "\""))
|
||||
case "NAME":
|
||||
result.Name = strings.Trim(splitLine[1], "\"")
|
||||
case "VERSION_ID":
|
||||
result.Version = strings.Trim(splitLine[1], "\"")
|
||||
}
|
||||
}
|
||||
return &result
|
||||
}
|
||||
67
vendor/github.com/wailsapp/wails/v2/internal/system/operatingsystem/os_windows.go
generated
vendored
Normal file
67
vendor/github.com/wailsapp/wails/v2/internal/system/operatingsystem/os_windows.go
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
//go:build windows
|
||||
|
||||
package operatingsystem
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/sys/windows"
|
||||
"golang.org/x/sys/windows/registry"
|
||||
)
|
||||
|
||||
func stripNulls(str string) string {
|
||||
// Split the string into substrings at each null character
|
||||
substrings := strings.Split(str, "\x00")
|
||||
|
||||
// Join the substrings back into a single string
|
||||
strippedStr := strings.Join(substrings, "")
|
||||
|
||||
return strippedStr
|
||||
}
|
||||
|
||||
func mustStringToUTF16Ptr(input string) *uint16 {
|
||||
input = stripNulls(input)
|
||||
result, err := syscall.UTF16PtrFromString(input)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func getBranding() string {
|
||||
var modBranding = syscall.NewLazyDLL("winbrand.dll")
|
||||
var brandingFormatString = modBranding.NewProc("BrandingFormatString")
|
||||
|
||||
windowsLong := mustStringToUTF16Ptr("%WINDOWS_LONG%\x00")
|
||||
ret, _, _ := brandingFormatString.Call(
|
||||
uintptr(unsafe.Pointer(windowsLong)),
|
||||
)
|
||||
return windows.UTF16PtrToString((*uint16)(unsafe.Pointer(ret)))
|
||||
}
|
||||
|
||||
func platformInfo() (*OS, error) {
|
||||
// Default value
|
||||
var result OS
|
||||
result.ID = "Unknown"
|
||||
result.Name = "Windows"
|
||||
result.Version = "Unknown"
|
||||
|
||||
// Credit: https://stackoverflow.com/a/33288328
|
||||
// Ignore errors as it isn't a showstopper
|
||||
key, _ := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Windows NT\CurrentVersion`, registry.QUERY_VALUE)
|
||||
|
||||
productName, _, _ := key.GetStringValue("ProductName")
|
||||
currentBuild, _, _ := key.GetStringValue("CurrentBuildNumber")
|
||||
displayVersion, _, _ := key.GetStringValue("DisplayVersion")
|
||||
releaseId, _, _ := key.GetStringValue("ReleaseId")
|
||||
|
||||
result.Name = productName
|
||||
result.Version = fmt.Sprintf("%s (Build: %s)", releaseId, currentBuild)
|
||||
result.ID = displayVersion
|
||||
result.Branding = getBranding()
|
||||
|
||||
return &result, key.Close()
|
||||
}
|
||||
62
vendor/github.com/wailsapp/wails/v2/internal/system/operatingsystem/version_windows.go
generated
vendored
Normal file
62
vendor/github.com/wailsapp/wails/v2/internal/system/operatingsystem/version_windows.go
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
//go:build windows
|
||||
|
||||
package operatingsystem
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"golang.org/x/sys/windows/registry"
|
||||
)
|
||||
|
||||
type WindowsVersionInfo struct {
|
||||
Major int
|
||||
Minor int
|
||||
Build int
|
||||
DisplayVersion string
|
||||
}
|
||||
|
||||
func (w *WindowsVersionInfo) IsWindowsVersionAtLeast(major, minor, buildNumber int) bool {
|
||||
return w.Major >= major && w.Minor >= minor && w.Build >= buildNumber
|
||||
}
|
||||
|
||||
func GetWindowsVersionInfo() (*WindowsVersionInfo, error) {
|
||||
key, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Windows NT\CurrentVersion`, registry.QUERY_VALUE)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &WindowsVersionInfo{
|
||||
Major: regDWORDKeyAsInt(key, "CurrentMajorVersionNumber"),
|
||||
Minor: regDWORDKeyAsInt(key, "CurrentMinorVersionNumber"),
|
||||
Build: regStringKeyAsInt(key, "CurrentBuildNumber"),
|
||||
DisplayVersion: regKeyAsString(key, "DisplayVersion"),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func regDWORDKeyAsInt(key registry.Key, name string) int {
|
||||
result, _, err := key.GetIntegerValue(name)
|
||||
if err != nil {
|
||||
return -1
|
||||
}
|
||||
return int(result)
|
||||
}
|
||||
|
||||
func regStringKeyAsInt(key registry.Key, name string) int {
|
||||
resultStr, _, err := key.GetStringValue(name)
|
||||
if err != nil {
|
||||
return -1
|
||||
}
|
||||
result, err := strconv.Atoi(resultStr)
|
||||
if err != nil {
|
||||
return -1
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func regKeyAsString(key registry.Key, name string) string {
|
||||
resultStr, _, err := key.GetStringValue(name)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return resultStr
|
||||
}
|
||||
Reference in New Issue
Block a user