aboutsummaryrefslogtreecommitdiff
path: root/kvm-creator
diff options
context:
space:
mode:
authorJamie McClelland <jm@mayfirst.org>2009-10-08 20:58:33 -0400
committerJamie McClelland <jm@mayfirst.org>2009-10-08 20:58:33 -0400
commita18b3bc83c262525ab21013744fa1dbd515a1813 (patch)
tree248f8784cf5906067deee06bd2cc63c07a4c9ace /kvm-creator
parent6d38e74e2506b105285e281432454775ad5d8329 (diff)
downloadkvm-manager-a18b3bc83c262525ab21013744fa1dbd515a1813.tar.gz
kvm-manager-a18b3bc83c262525ab21013744fa1dbd515a1813.tar.bz2
ensure directories don't exist before creating them (I put
.ssh/authorized_keys in /etc/skel!).
Diffstat (limited to 'kvm-creator')
-rwxr-xr-xkvm-creator4
1 files changed, 3 insertions, 1 deletions
diff --git a/kvm-creator b/kvm-creator
index 5db748a..79f88ca 100755
--- a/kvm-creator
+++ b/kvm-creator
@@ -46,7 +46,9 @@ create() {
[ -z "$NAME" ] && die "Please pass the name of the virtual server to create"
[ -z "$VG" ] && die "Please pass the name of the volume group to use"
adduser "$NAME" --disabled-password --gecos "$NAME KVM user,,,"
- mkdir "/home/$NAME/"{.ssh,vms,"vms/$NAME"}
+ for dir in .ssh vms "vms/$NAME"; do
+ [ ! -d "/home/$NAME/$dir" ] && mkdir "/home/$NAME/$dir"
+ done
touch "/home/$NAME/vms/$NAME/netboot"
chown "$NAME:$NAME" "/home/$NAME/"{.ssh,vms,"vms/$NAME","vms/$NAME/netboot"}
cp /root/.ssh/authorized_keys "/home/$NAME/.ssh/"