posadka/internal/modify.go
Simon de Vlieger 0877745cda
sketch: commandline interface
Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2024-12-28 10:30:02 +01:00

40 lines
731 B
Go

package internal
import (
"path/filepath"
)
func EmptyRootPassword(prefix string) error {
path := filepath.Join(prefix, "etc/passwd")
return ReplaceInFile(
path,
[]byte("root:x:"),
[]byte("root::"),
)
}
func EnableSystemRequest(prefix string) error {
path := filepath.Join(prefix, "etc/sysctl.d/posadka-sysrq.conf")
// TODO, might want an append instead?
return WriteToFile(
path,
[]byte("kernel.sysrq = 1\n"),
)
}
func ShowBoot(prefix string) error {
path := filepath.Join(prefix, "etc/passwd")
//# remove quiet from kargs
//if [ "$SHOWBOOT" != "" ]; then
// sed -i 's|rhgb quiet ||g' /tmp/boot/loader/entries/*.conf
//fi
return ReplaceInFile(
path,
[]byte("rhgb quiet "),
[]byte(""),
)
}