Skip to content
Snippets Groups Projects
Commit 54b73724 authored by ulisse's avatar ulisse
Browse files

advanced (not working) version of vbox2template

parent 38468b0e
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,9 @@
# global configuration
##############################################
# images home dir
IMG_HOME="/opt/vm-images"
# media folder (USB mounting point)
MEDIA_DIR="${HOME}/vbox_media"
......
test.vbox 0 → 100644
This diff is collapsed.
......@@ -25,14 +25,16 @@ TPL_FILE="$1"-tpl.vbox
# prepare template
cp "$1" "${TPL_FILE}"
sed -i 's@\(Machine.*uuid="\)\([^"]*\)\("\)@\1'"`echo "${UUID}"`"'\3@g' "${TPL_FILE}"
sed -i 's@\(Machine.*name="\)\([^"]*\)\("\)@\1'"`echo "${VM_NAME}"`"'\3@g' "${TPL_FILE}"
sed -i 's@\(Machine.*snapshotFolder="\)\([^"]*\)\("\)@\1'"`echo "${TMP_DIR}"`"'\3@g' "${TPL_FILE}"
sed -i 's@\(SharedFolder.*name="'"`echo "${SF_LINUX_NAME}"`"'".*hostPath="\)\([^"]*\)\("\)@\1'"`echo "${SF_LINUX_TARGET}"`"'\3@g' "${TPL_FILE}"
sed -i 's@\(SharedFolder.*name="'"`echo "${SF_MEDIA_NAME}"`"'".*hostPath="\)\([^"]*\)\("\)@\1'"`echo "${SF_MEDIA_TARGET}"`"'\3@g' "${TPL_FILE}"
if [ "${DIFF_DISK_FILE}" != "" ]; then
sed -i 's@\(HardDisk.*location="\)\([^"]*diff_[^"]*\)\("\)@\1'"`echo "${TMP_DIR}/${DIFF_DISK_FILE}"`"'\3@g' "${TPL_FILE}"
fi
sed -i 's:\(Machine.*snapshotFolder="\)\([^"]*\)\("\):\1'"`echo "${TMP_DIR}"`"'\3:g' "${TPL_FILE}"
sed -i 's:\(SharedFolder.*name="'"`echo "${SF_LINUX_NAME}"`"'".*hostPath="\)\([^"]*\)\("\):\1'"`echo "${SF_LINUX_TARGET}"`"'\3:g' "${TPL_FILE}"
sed -i 's:\(SharedFolder.*name="'"`echo "${SF_MEDIA_NAME}"`"'".*hostPath="\)\([^"]*\)\("\):\1'"`echo "${SF_MEDIA_TARGET}"`"'\3:g' "${TPL_FILE}"
sed -i 's:\(MACAddress="\)\([^"]*\)\("\):\1'"`echo ""`"'\3:g' "${TPL_FILE}"
#perl -pi -e 's:\(stateFile="\)\(.*?/\)":\1'"`echo "${IMG_HOME}/"`"'\3:g' "${TPL_FILE}"
perl -pi -e 's:\(stateFile="\)\(.*?/\)":\1'"`echo "${IMG_HOME}/"`"'\3:g' "${TPL_FILE}"
#if [ "${DIFF_DISK_FILE}" != "" ]; then
# sed -i 's@\(HardDisk.*location="\)\([^"]*diff_[^"]*\)\("\)@\1'"`echo "${TMP_DIR}/${DIFF_DISK_FILE}"`"'\3@g' "${TPL_FILE}"
#fi
exit 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment