Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
virl-utils-hs-fulda
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sebastian Rieger
virl-utils-hs-fulda
Commits
ad46da85
Commit
ad46da85
authored
9 years ago
by
Sebastian Rieger
Browse files
Options
Downloads
Patches
Plain Diff
fixed device mapping locations in /dev, fixed stale swi directory problems
parent
b32a5d77
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
create-arista-veos-image/create-arista-veos-image.sh
+11
-10
11 additions, 10 deletions
create-arista-veos-image/create-arista-veos-image.sh
with
11 additions
and
10 deletions
create-arista-veos-image/create-arista-veos-image.sh
+
11
−
10
View file @
ad46da85
...
@@ -25,6 +25,7 @@ VEOS_VMDK_BASENAME=$(basename -s .vmdk $2)
...
@@ -25,6 +25,7 @@ VEOS_VMDK_BASENAME=$(basename -s .vmdk $2)
GLANCE_IMAGE_NAME
=
$3
GLANCE_IMAGE_NAME
=
$3
GLANCE_IMAGE_RELEASE
=
$VEOS_VMDK_BASENAME
-
$ABOOT_SERIAL_ISO_BASENAME
GLANCE_IMAGE_RELEASE
=
$VEOS_VMDK_BASENAME
-
$ABOOT_SERIAL_ISO_BASENAME
TMP_NAME
=
"vEOS-
$GLANCE_IMAGE_RELEASE
"
TMP_NAME
=
"vEOS-
$GLANCE_IMAGE_RELEASE
"
TIMESTAMP
=
$(
date
+%Y%m%d%H%M%S
)
echo
echo
echo
"Creating vEOS image..."
echo
"Creating vEOS image..."
...
@@ -41,8 +42,8 @@ echo "==========================================================="
...
@@ -41,8 +42,8 @@ echo "==========================================================="
# convert vmdk to raw and extract two partitions in it
# convert vmdk to raw and extract two partitions in it
qemu-img convert
-O
raw
$2
$VEOS_VMDK_BASENAME
.raw
qemu-img convert
-O
raw
$2
$VEOS_VMDK_BASENAME
.raw
kpartx
-av
$VEOS_VMDK_BASENAME
.raw
kpartx
-av
$VEOS_VMDK_BASENAME
.raw
dd
if
=
/dev/loop0p1
of
=
$VEOS_VMDK_BASENAME
-p1
.raw
dd
if
=
/dev/
mapper/
loop0p1
of
=
$VEOS_VMDK_BASENAME
-p1
.raw
dd
if
=
/dev/loop0p2
of
=
$VEOS_VMDK_BASENAME
-p2
.raw
dd
if
=
/dev/
mapper/
loop0p2
of
=
$VEOS_VMDK_BASENAME
-p2
.raw
kpartx
-d
$VEOS_VMDK_BASENAME
.raw
kpartx
-d
$VEOS_VMDK_BASENAME
.raw
echo
echo
...
@@ -50,9 +51,9 @@ echo "Injecting rc.eos startup script to get switch config..."
...
@@ -50,9 +51,9 @@ echo "Injecting rc.eos startup script to get switch config..."
echo
"==========================================================="
echo
"==========================================================="
# inject rc.eos script in first partition of the image, to get switch config defined in VM Maestro (config-drive)
# inject rc.eos script in first partition of the image, to get switch config defined in VM Maestro (config-drive)
mkdir
swi
mkdir
swi
-
$TIMESTAMP
mount
-o
loop
$VEOS_VMDK_BASENAME
-p1
.raw swi
mount
-o
loop
$VEOS_VMDK_BASENAME
-p1
.raw swi
-
$TIMESTAMP
cd
swi
cd
swi
-
$TIMESTAMP
cat
<<
EOF
> rc.eos
cat
<<
EOF
> rc.eos
#!/bin/sh
#!/bin/sh
#
#
...
@@ -80,8 +81,8 @@ cp /mnt/flash/startup-config.tmp /mnt/flash/startup-config
...
@@ -80,8 +81,8 @@ cp /mnt/flash/startup-config.tmp /mnt/flash/startup-config
EOF
EOF
chmod
755 rc.eos
chmod
755 rc.eos
cd
..
cd
..
umount swi
umount swi
-
$TIMESTAMP
rm
dir
swi
rm
-rf
swi-
$TIMESTAMP
echo
echo
echo
"Injecting new partitions from vEOS vmdk in Aboot image..."
echo
"Injecting new partitions from vEOS vmdk in Aboot image..."
...
@@ -119,8 +120,8 @@ w" | fdisk $TMP_NAME.raw >/dev/null
...
@@ -119,8 +120,8 @@ w" | fdisk $TMP_NAME.raw >/dev/null
# copy the partitions from vEOS vmdk to new image
# copy the partitions from vEOS vmdk to new image
kpartx
-av
$TMP_NAME
.raw
kpartx
-av
$TMP_NAME
.raw
dd
if
=
$VEOS_VMDK_BASENAME
-p1
.raw
of
=
/dev/loop0p2
dd
if
=
$VEOS_VMDK_BASENAME
-p1
.raw
of
=
/dev/
mapper/
loop0p2
dd
if
=
$VEOS_VMDK_BASENAME
-p2
.raw
of
=
/dev/loop0p3
dd
if
=
$VEOS_VMDK_BASENAME
-p2
.raw
of
=
/dev/
mapper/
loop0p3
kpartx
-d
$TMP_NAME
.raw
kpartx
-d
$TMP_NAME
.raw
echo
echo
...
...
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