From a7ce11b67bd34d9fa2d16863b79585cf55471a14 Mon Sep 17 00:00:00 2001 From: charliemaiors Date: Mon, 26 Jun 2023 14:56:40 +0200 Subject: [PATCH 1/3] sha256 enabled --- .github/workflows/create-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 7cded66..3325015 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -49,4 +49,5 @@ jobs: goversion: "https://dl.google.com/go/go1.20.5.linux-amd64.tar.gz" project_path: "." binary_name: "sleep-on-lan" + sha256sum: true extra_files: script/win-service-install.ps1 script/win-service-uninstall.ps1 README.md \ No newline at end of file From c40a4751e6232c96e85b24d72042f07f1a2db7be Mon Sep 17 00:00:00 2001 From: charliemaiors Date: Mon, 26 Jun 2023 15:15:12 +0200 Subject: [PATCH 2/3] support for BSD and darwin --- server/solserver.go | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/server/solserver.go b/server/solserver.go index 5c1412b..f77b1a8 100644 --- a/server/solserver.go +++ b/server/solserver.go @@ -21,6 +21,8 @@ type Result struct { const ( baseLinux = "systemctl" baseWindows = "shutdown -f" + baseDarwin = "shutdown" + baseBSD = "shutdown" ) var ( @@ -35,6 +37,16 @@ func init() { case "linux": fmt.Println("###############\nPlease be sure that this script has sudo priviledges in order to run commands from this script\n################") shutdownFunc = shutdownLinux + case "darwin": + fmt.Println("###############\nPlease be sure that this script has sudo priviledges in order to run commands from this script\n################") + shutdownFunc = shutdownDarwin + case "freebsd": + case "openbsd": + case "netbsd": + case "dragonfly": + case "illumos": + fmt.Println("###############\nPlease be sure that this script has sudo priviledges in order to run commands from this script\n################") + shutdownFunc = shutdownBSD default: panic("Your os is not yet supported") } @@ -109,3 +121,33 @@ func shutdownWindows(command string) error { } return nil } + +func shutdownDarwin(command string) error { + var commandEx *exec.Cmd + switch command { + case "suspend": + commandEx = exec.Command(baseDarwin, "-s") + case "hibernate": + return errors.New("Hibernate is not supported on Darwin") + case "reboot": + commandEx = exec.Command(baseDarwin, "-r now") + case "poweroff": + commandEx = exec.Command(baseDarwin, "-h now") + } + return commandEx.Run() +} + +func shutdownBSD(command string) error { + var commandEx *exec.Cmd + switch command { + case "suspend": + commandEx = exec.Command(baseBSD, "-s") + case "hibernate": + return errors.New("Hibernate is not supported on Darwin") + case "reboot": + commandEx = exec.Command(baseBSD, "-r") + case "poweroff": + commandEx = exec.Command(baseBSD, "-h") + } + return commandEx.Run() +} From 18169d56f812df340f9122df2a9a424ad59d051e Mon Sep 17 00:00:00 2001 From: charliemaiors Date: Mon, 26 Jun 2023 15:18:20 +0200 Subject: [PATCH 3/3] support for BSD and darwin --- .github/workflows/create-release.yml | 3 +-- Changelog.md | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 3325015..d8ae96a 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -29,8 +29,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - # build and publish in parallel: linux/386, linux/amd64, linux/arm64, windows/386, windows/amd64, darwin/amd64, darwin/arm64 - goos: [linux, windows, darwin] + goos: [linux, windows, darwin, freebsd, openbsd, netbsd] goarch: ["386", amd64, arm64] exclude: - goarch: "386" diff --git a/Changelog.md b/Changelog.md index c46d2c0..8cf1fa6 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,4 @@ -# Release 1.0.17 +# Release 1.1.0 -* Actions test +* Support extended for darwin (macos) +* Support for *BSD systems