#!/usr/bin/bash # link VM in User-Dir in /tmp or /var/vm set -eu source /etc/lmn/vm.conf # change to image-directory cd "${VM_SYSDIR}" while getopts ':p' OPTION; do case "$OPTION" in p) VM_DIR="${VM_DIR_PERSISTENT}" ;; esac done shift "$((OPTIND -1))" # link system-VM-Images to User VM Directory for filename in "$@"; do filename="$(basename ${filename})" [[ -f "${VM_DIR}/${filename}" ]] || ln "${filename}" "${VM_DIR}/${filename}" done # allow lmnsynci to remove old vm images chgrp lmnsynci "${VM_DIR}" chmod g+w "${VM_DIR}"