posadka/internal/modify.go

41 lines
731 B
Go
Raw Normal View History

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(""),
)
}