#!/bin/bash echo "Fixing MBR and Grub install" grub2-install /dev/vda grub-install --recheck /dev/vda update-grub echo "Fixing drive paths in grub and fstab" # perl -pe 's/\/dev\/[hv]d(?=[a-z][0-9]*\b)/\/dev\/sd/g' /boot/grub2/grub.cfg /etc/fstab CurrentFile="/boot/grub/grub.conf"; if [ -f "$CurrentFile" ]; then sed -ie 's/\/dev\/[hv]da/\/dev\/sda/g' "$CurrentFile"; fi CurrentFile="/boot/grub/grub.cfg"; if [ -f "$CurrentFile" ]; then sed -ie 's/\/dev\/[hv]da/\/dev\/sda/g' "$CurrentFile"; fi CurrentFile="/boot/grub2/grub.cfg"; if [ -f "$CurrentFile" ]; then sed -ie 's/\/dev\/[hv]da/\/dev\/sda/g' "$CurrentFile"; fi CurrentFile="/etc/fstab"; if [ -f "$CurrentFile" ]; then sed -ie 's/\/dev\/[hv]da/\/dev\/sda/g' "$CurrentFile"; fi unset CurrentFile # echo "Removing OnApp ssh key" # perl -pe "s{\Qssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDNE4AnWbyRa1nlvJNcmjRHg9u0M/oJfG3Onp8Cwvhpz6Ya1S1W6r2TLLytLfnwRJECMKi1FL3p0+edA/WrwrD6n+f1Wvi9wXrrfx26v0WLZKJru8hmoSt/gaY9lvz61hSzcEBVRfJovtIV71jv0wlss7di65k9WRlHO6KsT/7/+eMTJC4yRzxTUojOH874qxy77vNrJd/LCfIlG/Ws4pWcbFXEXigEq8/ZcCBQ3mQXlatRQkqfijXzNFqX7SrUp5QgjyH0G3qalpqe3s9P1aXsVhZ95xJ/kD0ZK6DKuGM/KIEY5Sl7FJ7L8S83IumYeceIkYlmeLVF3mZ8aY9xd3wR\E\n}{}" /root/.ssh/authorized_keys