feat: restart to apply update, privileged helper, rollback
This commit is contained in:
1 parent
70460e4170
commit
54e8fd5fed
63 files changed
+8635
-164
No files matched your search
@@ -0,0 +1,30 @@
|
||||
package update
|
||||
|
||||
import (
|
||||
domain "RenewCMS/internal/domain/update"
|
||||
"os"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
const systemdRuntimeDirectory = "/run/systemd/system"
|
||||
|
||||
type SystemMachineProbe struct{}
|
||||
|
||||
var _ domain.MachineProbe = &SystemMachineProbe{}
|
||||
|
||||
func NewSystemMachineProbe() *SystemMachineProbe {
|
||||
return &SystemMachineProbe{}
|
||||
}
|
||||
|
||||
func (p *SystemMachineProbe) OS() string {
|
||||
return runtime.GOOS
|
||||
}
|
||||
|
||||
func (p *SystemMachineProbe) SystemdRunning() bool {
|
||||
info, err := os.Stat(systemdRuntimeDirectory)
|
||||
return err == nil && info.IsDir()
|
||||
}
|
||||
|
||||
func (p *SystemMachineProbe) IsRoot() bool {
|
||||
return os.Geteuid() == 0
|
||||
}
|
||||
Reference in new issue
Block a user