File tree 3 files changed +43
-4
lines changed
3 files changed +43
-4
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,22 @@ given that we're dealing with an entire operating system.
99
99
- Remove the box config in vagrantcloud
100
100
- Update README.md
101
101
102
+ ## Repackaging base boxes
103
+
104
+ You might want to repackage base boxes on occasion to make running the
105
+ automated suite faster. There will be fewer updates to apply, and sometimes
106
+ vendor-supplied updates do not apply cleanly in a non-interactive shell.
107
+
108
+ ``` sh
109
+ ./bin/repackage_base_boxes.sh
110
+ ```
111
+ This will iterate over ` spec/vagrantfiles/Vagrantfile.* ` , spin up a VM, drop
112
+ you into an interactive shell and then give you the option to repackage
113
+ afterwards. It will skip any boxes that already exist in the project root,
114
+ similar to behavior of the rspec suite.
115
+
116
+ After repackaging, use ` ./bin/publish_laptopped_boxes.sh ` to publish to aws.
117
+
102
118
## Creating new base boxes to test a new release
103
119
104
120
1 . Download a 64 bit minimal server ISO
Original file line number Diff line number Diff line change 1
- #! /usr/bin/env sh
1
+ #! /bin/sh
2
+
2
3
check_for_aws () {
3
- if ! command -v aws & > /dev/null; then
4
+ if ! command -v aws > /dev/null; then
4
5
failure_message ' You must install aws-cli to publish boxes'
5
6
exit 1
6
7
fi
@@ -34,10 +35,10 @@ publish_box(){
34
35
}
35
36
36
37
box_has_changed () {
37
- local remote_size=$( aws s3 ls " laptop-boxes/$box " | cut -f 3 -d ' ' )
38
+ local remote_size=$( aws s3 ls " laptop-boxes/$box " | sed " s/ / / " | cut -f 3 -d ' ' )
38
39
local local_size=$( stat -c %s " $box " )
39
40
40
- [ " $local_size " -ne " $remote_size " ]
41
+ [ " $local_size " != " $remote_size " ]
41
42
}
42
43
43
44
# ##################################
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ for box in spec/vagrantfiles/Vagrantfile.* ; do
4
+ base_name=$( basename " $box " ' .box' | sed " s/Vagrantfile\.//" )
5
+ box_file=" ${base_name} .box"
6
+
7
+ if [ ! -e " $box_file " ]; then
8
+ ln -sf $box Vagrantfile
9
+
10
+ vagrant destroy
11
+ vagrant up
12
+ echo " You'll now be dropped into an interactive shell in $base_name ."
13
+ echo " Make whatever changes are necessary and when you exit we'll repackage the box."
14
+ vagrant ssh
15
+
16
+ rm -f " $box_file "
17
+ vagrant package --base " laptop-$base_name " --output " $box_file "
18
+
19
+ else
20
+ echo " $base_name already packaged at $box_file , skipping"
21
+ fi
22
+ done
You can’t perform that action at this time.
0 commit comments