2024-05-09 17:22:46 -03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2024-05-21 15:09:07 -03:00
|
|
|
# Function to extract the output file from arguments
|
|
|
|
extract_output_file() {
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
|
key="$1"
|
|
|
|
case $key in
|
|
|
|
-o | --output)
|
|
|
|
output_file="$2"
|
|
|
|
shift # past argument
|
|
|
|
shift # past value
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
shift # past argument
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
# Extract the -o argument
|
|
|
|
extract_output_file "$@"
|
|
|
|
|
|
|
|
# Run the docker command
|
|
|
|
#docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock --privileged -v "$PWD":/d2vm -w /d2vm vmutil "$@"
|
|
|
|
docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock --privileged -v "$PWD":/d2vm -w /d2vm git.spirirobotics.com/spiri/utils-docker_to_ovf:2024-05-21 "$@"
|
|
|
|
|
|
|
|
# Change the ownership of the output file to the current user
|
|
|
|
if [[ -n "$output_file" ]]; then
|
|
|
|
echo "Setting permissions on file"
|
|
|
|
sudo chown $(whoami) "$output_file"
|
|
|
|
fi
|