#!/bin/bash IMAGE="$1" [ -f "$IMAGE" ] || { echo "File $IMAGE is not found!"; exit 1; } GUID=$(virt-fw-vars -i $IMAGE -p -v 2>/dev/null | awk '{if($1 ~ /name=db$/){sub(/guid=guid:/,"",$2);print $2}}') [ -n "$GUID" ] || { echo "GUID is not set!"; exit 1; } for F in `ls ./*.pem`; do echo "virt-fw-vars --add-db $GUID $F -i $IMAGE -o $IMAGE"; virt-fw-vars --add-db $GUID $F -i $IMAGE -o $IMAGE; done