mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-08 06:28:27 -04:00
freebsd: add initial support for running on FreeBSD, excluding Bluez,
ppd, and some things. Add a simple wpa_supplicant backend
This commit is contained in:
@@ -980,26 +980,6 @@ func signalTerminals(opts *Options) {
|
||||
}
|
||||
}
|
||||
|
||||
func signalByName(name string, sig syscall.Signal) {
|
||||
entries, err := os.ReadDir("/proc")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
for _, entry := range entries {
|
||||
pid, err := strconv.Atoi(entry.Name())
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
comm, err := os.ReadFile(filepath.Join("/proc", entry.Name(), "comm"))
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
if strings.TrimSpace(string(comm)) == name {
|
||||
syscall.Kill(pid, sig)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func syncColorScheme(mode ColorMode) {
|
||||
scheme := "prefer-dark"
|
||||
if mode == ColorModeLight {
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package matugen
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// procfs(5) is optional on FreeBSD; pkill(1) from base queries the kernel
|
||||
// directly.
|
||||
func signalByName(name string, sig syscall.Signal) {
|
||||
signame := strings.TrimPrefix(unix.SignalName(sig), "SIG")
|
||||
exec.Command("pkill", "-"+signame, "-x", name).Run()
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package matugen
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func signalByName(name string, sig syscall.Signal) {
|
||||
entries, err := os.ReadDir("/proc")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
for _, entry := range entries {
|
||||
pid, err := strconv.Atoi(entry.Name())
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
comm, err := os.ReadFile(filepath.Join("/proc", entry.Name(), "comm"))
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
if strings.TrimSpace(string(comm)) == name {
|
||||
syscall.Kill(pid, sig)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user