From 3dea66516e1f31df64e4a6f26114a03204325e9f Mon Sep 17 00:00:00 2001 From: Timothy Redaelli Date: Sat, 27 Jun 2015 01:52:07 +0200 Subject: [PATCH] Use vps2arch as root password if it was not set --- vps2arch | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/vps2arch b/vps2arch index 2b6941c..03ff58c 100755 --- a/vps2arch +++ b/vps2arch @@ -97,8 +97,13 @@ install_packages() { } restore_root_pass() { - sed -i '/^root:/d' /etc/shadow - cat "/root.$cpu_type/root.passwd" >> /etc/shadow + # If the root password is not set, use vps2arch + if egrep -q '^root:.?:' "/root.$cpu_type/root.passwd"; then + echo "root:vps2arch" | chpasswd + else + sed -i '/^root:/d' /etc/shadow + cat "/root.$cpu_type/root.passwd" >> /etc/shadow + fi } cleanup() { @@ -174,7 +179,7 @@ finalize() { When you are finished with your post-installation, you'll need to reboot the VM the rough way: # sync ; reboot -f - Then you'll be able to connect to your VM using SSH and to login using your old root password. + Then you'll be able to connect to your VM using SSH and to login using your old root password (or "vps2arch" if you didn't have a root password). EOF }