updates
This commit is contained in:
22
scripts/download-image.sh
Executable file
22
scripts/download-image.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
URL="$1"
|
||||
OUTPUT_DIR="${2:-/var/lib/libvirt/images}"
|
||||
FORCE="${3:-false}"
|
||||
|
||||
if [ -z "$URL" ]; then
|
||||
echo "Usage: $0 <url> [output_dir] [force]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
FILENAME=$(basename "$URL")
|
||||
CACHED="$OUTPUT_DIR/$FILENAME"
|
||||
|
||||
if [ "$FORCE" = "true" ] || [ ! -f "$CACHED" ]; then
|
||||
echo "Downloading $URL to $CACHED"
|
||||
curl -L --progress-bar -o "$CACHED" "$URL"
|
||||
else
|
||||
echo "Using cached image: $CACHED"
|
||||
fi
|
||||
|
||||
echo "$CACHED"
|
||||
Reference in New Issue
Block a user