Rework immucore (#246)

This commit is contained in:
Itxaka
2024-03-20 11:48:51 +01:00
committed by GitHub
parent ddfe8b7648
commit 93f5cf5de6
17 changed files with 1443 additions and 1345 deletions

View File

@@ -7,6 +7,7 @@ import (
"os/exec"
"path/filepath"
"strings"
"syscall"
"time"
"github.com/avast/retry-go"
@@ -239,3 +240,15 @@ func GetHostProcCmdline() string {
}
return proc
}
func DropToEmergencyShell() {
if err := syscall.Exec("/bin/bash", []string{"/bin/bash"}, os.Environ()); err != nil {
if err := syscall.Exec("/bin/sh", []string{"/bin/sh"}, os.Environ()); err != nil {
if err := syscall.Exec("/sysroot/bin/bash", []string{"/sysroot/bin/bash"}, os.Environ()); err != nil {
if err := syscall.Exec("/sysroot/bin/sh", []string{"/sysroot/bin/sh"}, os.Environ()); err != nil {
Log.Fatal().Msg("Could not drop to emergency shell")
}
}
}
}
}