add check git lfs

This commit is contained in:
Eric X. Liu 2024-06-23 05:09:21 +00:00
parent 699f96e371
commit f73104862e

View File

@ -33,8 +33,18 @@ LATEST_IMG=$(wget -qO- $DEBIAN_IMG_DIR | grep -oP '(?<=href=")[^"]*(?=/")' | gre
SRC_IMG="${DEBIAN_IMG_DIR}${LATEST_IMG}/debian-${DEBIAN_VERSION}-generic-amd64-${LATEST_IMG}.qcow2"
IMG_NAME="${LOCAL_IMG_DIR}/debian-${DEBIAN_VERSION}-generic-amd64-${LATEST_IMG}.qcow2"
# Check if Git LFS is installed
if ! which git-lfs > /dev/null; then
echo "git-lfs not found. Please install git-lfs and try again."
exit 1
fi
# Pull the specific image file from Git LFS if it exists in the repository
git lfs pull --include "$IMG_NAME" || true
# Download the image if it doesn't already exist
if [ ! -f "$IMG_NAME" ]; then
echo "New release. Downloading it now..."
wget -O $IMG_NAME $SRC_IMG
fi
@ -72,3 +82,6 @@ qm set $VMID --serial0 socket --vga serial0
qm set $VMID --ipconfig0 ip=dhcp,gw=10.10.0.1
qm resize $VMID scsi0 $DISK_SIZE
qm template $VMID
# Optionally, remove the downloaded image
# rm $IMG_NAME