diff --git a/bin/vzvol b/bin/vzvol index abad543..a911cee 100755 --- a/bin/vzvol +++ b/bin/vzvol @@ -11,6 +11,7 @@ VOLTYPE=NULL vzvol_libdir=/usr/local/lib/vzvol/lib vzvol_gitdir=$( find ./ -name "vzvol" | grep bin | sed 's/.\{10\}$//' ) ZUSER="$(logname)" +ZUSERHOME=$( awk -F ":" '/${ZUSER}/{print $6}' < /etc/passwd ) if [ ! "$(whoami)" = 'root' ]; then diff --git a/lib/shared/vzvol_getargz.sh b/lib/shared/vzvol_getargz.sh index 1dd7196..cf88133 100644 --- a/lib/shared/vzvol_getargz.sh +++ b/lib/shared/vzvol_getargz.sh @@ -101,7 +101,7 @@ vzvol_getargz() { return 1 else DELETE_ME="${2}" - DELETE_VMDK="${HOME}/VBoxDisks/${2}.vmdk" + DELETE_VMDK="${ZUSERHOME}/VBoxDisks/${2}.vmdk" vzvol_delete || exit 1 exit fi diff --git a/lib/shared/vzvol_list.sh b/lib/shared/vzvol_list.sh index e6240ce..5d3acba 100644 --- a/lib/shared/vzvol_list.sh +++ b/lib/shared/vzvol_list.sh @@ -39,8 +39,8 @@ vzvol_list_type() { else zvolfstype="unknown" fi - if [ -f "${HOME}/VBoxdisks/${purevolname}.vmdk" ]; then - echo "${vols} VirtualBox ${HOME}/VBoxdisks/${purevolname}.vmdk $purevolused $purevolsize $zvolfstype" + if [ -f "${ZUSERHOME}/VBoxdisks/${purevolname}.vmdk" ]; then + echo "${vols} VirtualBox ${ZUSERHOME}/VBoxdisks/${purevolname}.vmdk $purevolused $purevolsize $zvolfstype" else echo "${vols} RAW none $purevolused $purevolsize $zvolfstype" fi diff --git a/lib/shared/vzvol_type.sh b/lib/shared/vzvol_type.sh index 097c18f..68fa932 100644 --- a/lib/shared/vzvol_type.sh +++ b/lib/shared/vzvol_type.sh @@ -11,7 +11,7 @@ zvol_type_virtualbox() { errorfunc='zvol_type_virtualbox' zvol_create || return 1 vmdk_create || return 1 - echo "Please use ${HOME}/VBoxdisks/${VOLNAME}.vmdk as your VM Disk" + echo "Please use ${ZUSERHOME}/VBoxdisks/${VOLNAME}.vmdk as your VM Disk" } zvol_type_raw() { errorfunc='zvol_type_raw' diff --git a/lib/shared/vzvol_vmdk.sh b/lib/shared/vzvol_vmdk.sh index f79edef..89af862 100644 --- a/lib/shared/vzvol_vmdk.sh +++ b/lib/shared/vzvol_vmdk.sh @@ -1,6 +1,5 @@ #!/bin/sh vmdk_create() { - ZUSERHOME=$( awk -F ":" '/${ZUSER}/{print $6}' < /etc/passwd ) errorfunc='vmdk_create' if [ ! -d "${ZUSERHOME}"/VBoxdisks/ ]; then mkdir -p "${ZUSERHOME}"/VBoxdisks/