Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- [ -f "$1" ] || exec echo "'$1' does not exist"
- which guestfish >/dev/null 2>/dev/null || exec echo "guestfish not found"
- guestfish -a "$1" -i <<'EOF'
- # trick to keep the SELinux context
- sh 'sed "s/^root:[^:]*:/root::/" /etc/shadow >/tmp/shadow ; cat /tmp/shadow >/etc/shadow ; rm -f /tmp/shadow'
- sh 'rm -rf /etc/rc.d/rc3.d/S*cloud-init /etc/systemd/system/cloud-init.target.wants/* /etc/systemd/system/multi-user.target.wants/cloud-*.service'
- mkdir /etc/systemd/system/getty@.service.d
- write /etc/systemd/system/getty@.service.d/override.conf "[Service]\\nExecStart=\\nExecStart=-/sbin/agetty -a root --noclear %I $TERM"
- mkdir /etc/systemd/system/serial-getty@.service.d
- write /etc/systemd/system/serial-getty@.service.d/override.conf "[Service]\\nExecStart=\\nExecStart=-/sbin/agetty -a root --keep-baud 115200,38400,9600 %I $TERM"
- write /etc/profile.d/colorprompt.sh "PS1='\\[\\e[1;31m\\]\\u\\[\\e[0m\\]@\\[\\e[1;36m\\]\\h\\[\\e[0m\\]:\\[\\e[1;32m\\]\\w\\[\\e[0m\\]\\$ '"
- write-append /etc/environment TERM=xterm-256color
- EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement