Add support for Initialisation Scripts with rcS (#340)

* validate systemctl command

* validate systemctl command

* add rcS support

* only attempt to set environment if list is not empty

* check if service bin exists
This commit is contained in:
Maycon Santos
2022-10-11 14:13:05 +02:00
committed by GitHub
parent f4a4df2b5e
commit 3596dfaf34
4 changed files with 326 additions and 0 deletions
+4
View File
@@ -9,6 +9,7 @@ import (
"errors"
"fmt"
"os"
"os/exec"
"os/signal"
"path/filepath"
"regexp"
@@ -22,6 +23,9 @@ func isSystemd() bool {
if _, err := os.Stat("/run/systemd/system"); err == nil {
return true
}
if _, err := exec.LookPath("systemctl"); err != nil {
return false
}
if _, err := os.Stat("/proc/1/comm"); err == nil {
filerc, err := os.Open("/proc/1/comm")
if err != nil {