diff options
author | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2009-11-11 17:16:30 -0500 |
---|---|---|
committer | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2009-11-11 17:16:30 -0500 |
commit | 4c74e5346f55dfe5f22f0d8a25a3a712ff27b6cf (patch) | |
tree | c0256eb620c8a9165f698daddb43d2c5aaf8ed1c /kvm-creator | |
parent | 7ec0b002eba10c12d3687fec7ee8afa7b1d03729 (diff) | |
download | kvm-manager-4c74e5346f55dfe5f22f0d8a25a3a712ff27b6cf.tar.gz kvm-manager-4c74e5346f55dfe5f22f0d8a25a3a712ff27b6cf.tar.bz2 |
abstract away the choice of placement of homedir for non-standard systems
Diffstat (limited to 'kvm-creator')
-rwxr-xr-x | kvm-creator | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/kvm-creator b/kvm-creator index 744cb96..e2c0ca9 100755 --- a/kvm-creator +++ b/kvm-creator @@ -45,9 +45,8 @@ destroy() { update-service --remove "/etc/sv/kvm/$NAME" rm -rf "/etc/sv/kvm/$NAME" - deluser "$NAME" + deluser --remove-home "$NAME" lvremove "$VG/$NAME" - rm -rf "/home/$NAME" } @@ -69,9 +68,13 @@ create() { set -e validate adduser "$NAME" --disabled-password --gecos "$NAME KVM user,,," - mkdir -p "/home/$NAME/"{.ssh,vms,"vms/$NAME"} - chown "$NAME:$NAME" "/home/$NAME/"{.ssh,vms,"vms/$NAME"} - cp /root/.ssh/authorized_keys "/home/$NAME/.ssh/" + USERHOMEDIR=$(getent passwd "$NAME" | cut -f6 -d:) + mkdir -p "$USERHOMEDIR/"{.ssh,vms,"vms/$NAME"} + chown "$NAME:$NAME" "$USERHOMEDIR/"{.ssh,vms,"vms/$NAME"} + if [ -f /root/.ssh/authorized_keys ]; then + # is this really the right thing to do? + cp /root/.ssh/authorized_keys "$USERHOMEDIR/.ssh/" + fi lvcreate --name "$NAME" --size "$SIZE" $VG mkdir "/etc/sv/kvm/$NAME"{,/log,/env} cat > "/etc/sv/kvm/$NAME/log/run" <<EOF |