qemush/qemu/bin/pathof

22 lines
399 B
Bash
Executable file

#!/bin/sh -e
# Check if QEMUSH_NAME variable is initialized, abort if not
[ -n "$QEMUSH_NAME" ]
# Choose the base dir to print according to argv[1]
case "$1" in
socket)
path="${HOME}/sockets"
;;
disk)
path="${HOME}/disks"
;;
*)
false
;;
esac
# Create the base dir if it doesn't exist and print the path of the
# ressource
mkdir -p -- "$path"
printf %s/%s\\n "$path" "$QEMUSH_NAME"