Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
vbox-scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto LIVIO BECCARIA
vbox-scripts
Commits
54b73724
Commit
54b73724
authored
8 years ago
by
ulisse
Browse files
Options
Downloads
Patches
Plain Diff
advanced (not working) version of vbox2template
parent
38468b0e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
settings/settings
+3
-0
3 additions, 0 deletions
settings/settings
test.vbox
+409
-0
409 additions, 0 deletions
test.vbox
vbox2template
+11
-9
11 additions, 9 deletions
vbox2template
with
423 additions
and
9 deletions
settings/settings
+
3
−
0
View file @
54b73724
...
...
@@ -2,6 +2,9 @@
# global configuration
##############################################
# images home dir
IMG_HOME="/opt/vm-images"
# media folder (USB mounting point)
MEDIA_DIR="${HOME}/vbox_media"
...
...
This diff is collapsed.
Click to expand it.
test.vbox
0 → 100644
+
409
−
0
View file @
54b73724
This diff is collapsed.
Click to expand it.
vbox2template
+
11
−
9
View file @
54b73724
...
...
@@ -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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment