Refactor code

This commit is contained in:
whiskerz007 2020-03-20 15:45:08 +01:00
parent 46af8a34b4
commit be78536fed
No known key found for this signature in database
GPG Key ID: A7EEAB6E1F1A6805

View File

@ -29,10 +29,10 @@ function msg() {
}
function cleanup() {
popd >/dev/null
rm -rf $TMP
rm -rf $TEMP_DIR
}
TMP=`mktemp -d`
pushd $TMP >/dev/null
TEMP_DIR=$(mktemp -d)
pushd $TEMP_DIR >/dev/null
# Select storage location
while read -r line; do
@ -86,7 +86,7 @@ fi
# Download Home Assistant disk image archive
msg "Downloading disk image..."
wget -q --show-progress $URL
msg "\e[1A\e[0K\e[1A" #Overwrite output from wget
echo -en "\e[1A\e[0K" #Overwrite output from wget
FILE=$(basename $URL)
# Extract Home Assistant disk image
@ -94,7 +94,7 @@ msg "Extracting disk image..."
gunzip -f $FILE
# Create variables for container disk
STORAGE_TYPE=`pvesm status -storage $STORAGE | awk 'NR>1 {print $2}'`
STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}')
if [ "$STORAGE_TYPE" = "dir" ]; then
DISK_EXT=".qcow2"
DISK_REF="$VMID/"