├── .gitignore ├── AUTHORS ├── CHANGELOG.md ├── LICENSE ├── Makefile ├── README.md ├── VERSION ├── bin ├── Makefile.local.winry ├── box ├── build-box ├── bump.sh ├── register_atlas.sh ├── ssh-box ├── test-box └── test-vagrantcloud-box ├── custom-script.sh ├── debian.json ├── debian10.json ├── debian7-i386.json ├── debian7.json ├── debian8-desktop.json ├── debian8-i386.json ├── debian8.json ├── debian9-desktop.json ├── debian9-i386.json ├── debian9.json ├── http ├── preseed-buster.cfg ├── preseed-jessie.cfg └── preseed.cfg ├── script ├── cleanup.sh ├── desktop.sh ├── minimize.sh ├── motd.sh ├── parallels.sh ├── remove-cdrom-sources.sh ├── systemd.sh ├── update.sh ├── vagrant.sh ├── virtualbox.sh └── vmware.sh ├── test ├── debian_spec.rb └── spec_helper.rb └── tpl └── vagrantfile-debian-desktop.tpl /.gitignore: -------------------------------------------------------------------------------- 1 | packer_cache/ 2 | output-* 3 | *.box 4 | *.tar.gz 5 | iso 6 | crash.log 7 | tmp 8 | .vagrant/ 9 | *.swp 10 | Makefile.local 11 | box/ 12 | 13 | .DS_Store 14 | .tmpatlas/ 15 | 16 | .idea 17 | *.iml 18 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | # This file lists all individuals having contributed content to the repository. 2 | # If you're submitting a patch, please add your name here in alphabetical order as part of the patch. 3 | # 4 | André Lucas 5 | Dominic 6 | Matt Black 7 | Mischa Taylor 8 | Rickard von Essen 9 | Roland Moriz 10 | Ross Smith II 11 | Ronen Narkis 12 | Ruben Barkow 13 | Sam 14 | Stephen Reay 15 | Vasyl Vavrychuk 16 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 2.0.8 (2016-12-04) 4 | 5 | * Upgrade Parallels Tools to 12.1.1 6 | * Upgrade VirtualBox guest additions to 5.1.10 7 | ## 2.0.7 (2016-09-28) 8 | 9 | * Change naming scheme dropping point releases from names 10 | * Upgrade VMware tools to 10.0.10 for VMware Fusion 8.5.0 11 | * Upgrade to Parallels 12 and Parallels Tools 12.0.2 12 | 13 | ## 2.0.6 (2016-08-28) 14 | 15 | * Add Debian 8.5 template 16 | * Add Debian 8.5 desktop template 17 | * Add Debian 7.11 template 18 | * Upgrade VirtualBox guest additions to 5.0.26 19 | * Upgrade VMware tools to 10.0.6 20 | * Upgrade Parallels tools to 11.2.1 21 | 22 | ## 2.0.5 (2016-01-11) 23 | 24 | * Upgrade Parallels tools to 11.1.2 25 | 26 | ## 2.0.4 (2015-12-24) 27 | 28 | * Upgrade VirtualBox guest additions to 5.0.12 29 | * Upgrade Parallels tools to 11.1.1 30 | 31 | ## 2.0.3 (2015-11-26) 32 | 33 | * Upgrade VirtualBox guest additions to 5.0.10 34 | * Upgrade Parallels tools to 11.1.0 35 | * Make images smaller by delaying creation of swap parition 36 | 37 | ## 2.0.2 (2015-11-09) 38 | 39 | * Upgrade VirtualBox guest additions to 5.0.8 40 | * Upgrade VMware Tools to 10.0.1 for VMware Fusion 8.02 41 | * Port improvements in structure/build parallelism from Ubuntu templates 42 | 43 | ## 2.0.1 (2015-10-03) 44 | 45 | * Upgrade VirtualBox guest additions to 5.0.6 46 | * Add templates for some older versions of Debian 47 | 48 | ## 2.0.0 (2015-09-27) 49 | 50 | * Upgrade VirtualBox guest additions to 5.0.4 51 | * Upgrade VMware Tools to 10.0.0 for VMware Fusion 8 52 | * Add Debian 8.2 templates 53 | * Add Debian 7.9 templates 54 | * Remove Parallels provider 55 | * Add date stamp to motd 56 | * Remove deborphan phase in minimize 57 | 58 | ## 1.0.13 (2015-04-19) 59 | 60 | * Update Debian 8 to RC2 61 | * Upgrade Parallels tools to 10.2.0 62 | 63 | ## 1.0.12 (2015-03-23) 64 | 65 | * Upgrade VirtualBox guest additions to 4.3.26 66 | 67 | ## 1.0.11 (2015-03-15) 68 | 69 | * Add Debian 8 templates 70 | * Upgrade VirtualBox guest additions to 4.3.24 71 | 72 | ## 1.0.10 (2015-02-27) 73 | 74 | * Add Debian 7.8 75 | * Upgrade VirtualBox guest additions to 4.3.22 76 | * Upgrade Parallels tools to version 10.1.4 77 | 78 | ## 1.0.8 (2014-12-26) 79 | 80 | * Upgrade Parallels tools to version 10.1.2 81 | * Make default timezone UTC 82 | 83 | ## 1.0.7 (2014-12-08) 84 | 85 | * Upgrade VMware tools to version 9.9.0 for VMware Fusion 7.1.0 86 | 87 | ## 1.0.6 (2014-11-27) 88 | 89 | * Upgrade VirtualBox guest additions to version 4.3.20 90 | 91 | ## 1.0.5 (2014-11-05) 92 | 93 | * Upgrade VMware Tools to 9.8.4 for VMware Fusion 7 94 | * Add templates for Debian 7.7.0 95 | * Added Parallels build 96 | * Retire Debian 7.4 templates 97 | * Return Debian 6.0.9 templates 98 | 99 | ## 1.0.4 (2014-10-17) 100 | 101 | * Upgrade VirtualBox guest additions to version 4.3.18 102 | 103 | ## 1.0.3 (2014-09-29) 104 | 105 | * Upgraded VirtualBox guest additions to version 4.3.16 106 | 107 | ## 1.0.2 (2014-09-09) 108 | 109 | * Upgraded VMware tools to version 9.8.3 110 | * Added templates for Debian 6.0.10 111 | * Added templates for Debian 7.6.0 112 | 113 | ## 1.0.0 (2014-05-09) 114 | 115 | * Initial commit 116 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2014 Box-Cutter Authors (see AUTHORS file). 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | BOX_VERSION ?= $(shell cat VERSION) 2 | BOX_SUFFIX := -$(BOX_VERSION).box 3 | BUILDER_TYPES ?= vmware virtualbox parallels 4 | TEMPLATE_FILENAMES := $(filter-out debian.json,$(wildcard *.json)) 5 | BOX_NAMES := $(basename $(TEMPLATE_FILENAMES)) 6 | BOX_FILENAMES := $(TEMPLATE_FILENAMES:.json=$(BOX_SUFFIX)) 7 | VMWARE_BOX_DIR ?= box/vmware 8 | VMWARE_TEMPLATE_FILENAMES = $(TEMPLATE_FILENAMES) 9 | VMWARE_BOX_FILENAMES := $(VMWARE_TEMPLATE_FILENAMES:.json=$(BOX_SUFFIX)) 10 | VMWARE_BOX_FILES := $(foreach box_filename, $(VMWARE_BOX_FILENAMES), $(VMWARE_BOX_DIR)/$(box_filename)) 11 | VIRTUALBOX_BOX_DIR ?= box/virtualbox 12 | VIRTUALBOX_TEMPLATE_FILENAMES = $(TEMPLATE_FILENAMES) 13 | VIRTUALBOX_BOX_FILENAMES := $(VIRTUALBOX_TEMPLATE_FILENAMES:.json=$(BOX_SUFFIX)) 14 | VIRTUALBOX_BOX_FILES := $(foreach box_filename, $(VIRTUALBOX_BOX_FILENAMES), $(VIRTUALBOX_BOX_DIR)/$(box_filename)) 15 | PARALLELS_BOX_DIR ?= box/parallels 16 | PARALLELS_TEMPLATE_FILENAMES = $(TEMPLATE_FILENAMES) 17 | PARALLELS_BOX_FILENAMES := $(PARALLELS_TEMPLATE_FILENAMES:.json=$(BOX_SUFFIX)) 18 | PARALLELS_BOX_FILES := $(foreach box_filename, $(PARALLELS_BOX_FILENAMES), $(PARALLELS_BOX_DIR)/$(box_filename)) 19 | BOX_FILES := $(VMWARE_BOX_FILES) $(VIRTUALBOX_BOX_FILES) $(PARALLELS_BOX_FILES) 20 | ISO_FILES := $(shell sed -nE 's/^.*iso_name.*:\s*"([^"]+\.iso)".*$$/iso\/\1/p' $(TEMPLATE_FILENAMES)) 21 | 22 | box/vmware/%$(BOX_SUFFIX) box/virtualbox/%$(BOX_SUFFIX) box/parallels/%$(BOX_SUFFIX): %.json 23 | bin/box build $< 24 | 25 | .PHONY: all clean isos assure deliver assure_atlas assure_atlas_vmware assure_atlas_virtualbox assure_atlas_parallels 26 | 27 | all: isos build assure deliver 28 | 29 | iso/%.iso: 30 | mkdir -p iso 31 | @cd iso && ( \ 32 | CURRENT_URL="http://cdimage.debian.org/debian-cd/$(shell echo "$@" | cut -d- -f2,3 --output-delimiter=/)/jigdo-dvd/$(notdir $(basename $@)).jigdo" ; \ 33 | ARCHIVE_URL="http://cdimage.debian.org/mirror/cdimage/archive/$(shell echo "$@" | cut -d- -f2,3 --output-delimiter=/)/jigdo-dvd/$(notdir $(basename $@)).jigdo" ; \ 34 | \ 35 | if curl -sfI "$$CURRENT_URL" >/dev/null ; then \ 36 | URL="$$CURRENT_URL" ; \ 37 | else \ 38 | URL="$$ARCHIVE_URL" ; \ 39 | fi ; \ 40 | jigdo-lite --noask "$$URL" ; \ 41 | ) 42 | 43 | isos: $(ISO_FILES) 44 | 45 | build: $(BOX_FILES) 46 | 47 | assure: assure_vmware assure_virtualbox assure_parallels 48 | 49 | assure_vmware: $(VMWARE_BOX_FILES) 50 | @for vmware_box_file in $(VMWARE_BOX_FILES) ; do \ 51 | echo Checking $$vmware_box_file ; \ 52 | bin/box test $$vmware_box_file vmware ; \ 53 | done 54 | 55 | assure_virtualbox: $(VIRTUALBOX_BOX_FILES) 56 | @for virtualbox_box_file in $(VIRTUALBOX_BOX_FILES) ; do \ 57 | echo Checking $$virtualbox_box_file ; \ 58 | bin/box test $$virtualbox_box_file virtualbox ; \ 59 | done 60 | 61 | assure_parallels: $(PARALLELS_BOX_FILES) 62 | @for parallels_box_file in $(PARALLELS_BOX_FILES) ; do \ 63 | echo Checking $$parallels_box_file ; \ 64 | bin/box test $$parallels_box_file parallels ; \ 65 | done 66 | 67 | assure_atlas: assure_atlas_vmware assure_atlas_virtualbox assure_atlas_parallels 68 | 69 | assure_atlas_vmware: 70 | @for box_name in $(BOX_NAMES) ; do \ 71 | echo Checking $$box_name ; \ 72 | bin/test-vagrantcloud-box box-cutter/$$box_name vmware ; \ 73 | bin/test-vagrantcloud-box boxcutter/$$box_name vmware ; \ 74 | done 75 | 76 | assure_atlas_virtualbox: 77 | @for box_name in $(BOX_NAMES) ; do \ 78 | echo Checking $$box_name ; \ 79 | bin/test-vagrantcloud-box box-cutter/$$box_name virtualbox ; \ 80 | bin/test-vagrantcloud-box boxcutter/$$box_name virtualbox ; \ 81 | done 82 | 83 | assure_atlas_parallels: 84 | @for box_name in $(BOX_NAME) ; do \ 85 | echo Checking $$box_name ; \ 86 | bin/test-vagrantcloud-box box-cutter/$$box_name parallels ; \ 87 | bin/test-vagrantcloud-box boxcutter/$$box_name parallels ; \ 88 | done 89 | 90 | deliver: 91 | @for box_name in $(BOX_NAMES) ; do \ 92 | echo Uploading $$box_name to Atlas ; \ 93 | bin/register_atlas.sh $$box_name $(BOX_SUFFIX) $(BOX_VERSION) ; \ 94 | done 95 | 96 | clean: 97 | @for builder in $(BUILDER_TYPES) ; do \ 98 | echo Deleting output-*-$$builder-iso ; \ 99 | echo rm -rf output-*-$$builder-iso ; \ 100 | done 101 | @for builder in $(BUILDER_TYPES) ; do \ 102 | if test -d box/$$builder ; then \ 103 | echo Deleting box/$$builder/*.box ; \ 104 | find box/$$builder -maxdepth 1 -type f -name "*.box" ! -name .gitignore -exec rm '{}' \; ; \ 105 | fi ; \ 106 | done 107 | @if [ -L iso ] ; then \ 108 | echo "NOT deleting iso (it is a symlink)" ; \ 109 | else \ 110 | echo rm -rf iso ; \ 111 | rm -rf iso ; \ 112 | fi ; 113 | 114 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Packer templates for Debian written in legacy JSON 2 | 3 | ### Overview 4 | 5 | This repository contains Packer templates for creating Debian Vagrant boxes written in legacy JSON. 6 | 7 | ## Current Boxes 8 | 9 | We no longer provide pre-built binaries for these templates. 10 | 11 | ## Building the Vagrant boxes with Packer 12 | 13 | To build all the boxes, you will need [VirtualBox](https://www.virtualbox.org/wiki/Downloads), 14 | [VMware Fusion](https://www.vmware.com/products/fusion)/[VMware Workstation](https://www.vmware.com/products/workstation) and 15 | [Parallels](http://www.parallels.com/products/desktop/whats-new/) installed. 16 | 17 | Parallels requires that the 18 | [Parallels Virtualization SDK for Mac](http://www.parallels.com/downloads/desktop) 19 | be installed as an additional preqrequisite. 20 | 21 | We make use of JSON files containing user variables to build specific versions of Debian. 22 | You tell `packer` to use a specific user variable file via the `-var-file=` command line 23 | option. This will override the default options on the core `debian.json` packer template, 24 | which builds Debian 8 by default. 25 | 26 | For example, to build Debian 7, use the following: 27 | 28 | $ packer build -var-file=debian7.json debian.json 29 | 30 | If you want to make boxes for a specific desktop virtualization platform, use the `-only` 31 | parameter. For example, to build Debian 7 for VirtualBox: 32 | 33 | $ packer build -only=virtualbox-iso -var-file=debian7.json debian.json 34 | 35 | The boxcutter templates currently support the following desktop virtualization strings: 36 | 37 | * `parallels-iso` - [Parallels](http://www.parallels.com/products/desktop/whats-new/) desktop virtualization (Requires the Pro Edition - Desktop edition won't work) 38 | * `virtualbox-iso` - [VirtualBox](https://www.virtualbox.org/wiki/Downloads) desktop virtualization 39 | * `vmware-iso` - [VMware Fusion](https://www.vmware.com/products/fusion) or [VMware Workstation](https://www.vmware.com/products/workstation) desktop virtualization 40 | 41 | ## Building the Vagrant boxes with the box script 42 | 43 | We've also provided a wrapper script `bin/box` for ease of use, so alternatively, you can use 44 | the following to build Debian 8 for all providers: 45 | 46 | $ bin/box build debian8 47 | 48 | Or if you just want to build Debian 8 for VirtualBox: 49 | 50 | $ bin/box build debian8 virtualbox 51 | 52 | ## Building the Vagrant boxes with the Makefile 53 | 54 | A GNU Make `Makefile` drives a complete basebox creation pipeline with the following stages: 55 | 56 | * `build` - Create basebox `*.box` files 57 | * `assure` - Verify that the basebox `*.box` files produced function correctly 58 | * `deliver` - Upload `*.box` files to [Artifactory](https://www.jfrog.com/confluence/display/RTF/Vagrant+Repositories), [Atlas](https://atlas.hashicorp.com/) or an [S3 bucket](https://aws.amazon.com/s3/) 59 | 60 | The pipeline is driven via the following targets, making it easy for you to include them 61 | in your favourite CI tool: 62 | 63 | make build # Build all available box types 64 | make assure # Run tests against all the boxes 65 | make deliver # Upload box artifacts to a repository 66 | make clean # Clean up build detritus 67 | 68 | ### Acquiring ISO Images 69 | 70 | The ISO image are expected to be in the iso subdirectory or the user configured 71 | path. The easiest way to acquire the files is the Makefile which depends on [jigdo-lite](https://www.debian.org/CD/jigdo-cd/). 72 | 73 | For a single iso: 74 | make iso/debian-7.8.0-amd64-DVD-1.iso 75 | 76 | For all isos: 77 | make isos 78 | 79 | ### Proxy Settings 80 | 81 | The templates respect the following network proxy environment variables 82 | and forward them on to the virtual machine environment during the box creation 83 | process, should you be using a proxy: 84 | 85 | * http_proxy 86 | * https_proxy 87 | * ftp_proxy 88 | * rsync_proxy 89 | * no_proxy 90 | 91 | ### Tests 92 | 93 | The tests are written in [Serverspec](http://serverspec.org) and require the 94 | `vagrant-serverspec` plugin to be installed with: 95 | 96 | vagrant plugin install vagrant-serverspec 97 | 98 | The `Makefile` has individual targets for each box type with the prefix 99 | `test-*` should you wish to run tests individually for each box. 100 | 101 | Similarly there are targets with the prefix `ssh-*` for registering a 102 | newly-built box with vagrant and for logging in using just one command to 103 | do exploratory testing. For example, to do exploratory testing 104 | on the VirtualBox training environmnet, run the following command: 105 | 106 | make ssh-box/virtualbox/debian76-nocm.box 107 | 108 | Upon logout `make ssh-*` will automatically de-register the box as well. 109 | 110 | ## Contributing 111 | 112 | 113 | 1. Fork and clone the repo. 114 | 2. Create a new branch, please don't work in your `master` branch directly. 115 | 3. Add new [Serverspec](http://serverspec.org/) or [Bats](https://blog.engineyard.com/2014/bats-test-command-line-tools) tests in the `test/` subtree for the change you want to make. Run `make test` on a relevant template to see the tests fail (like `make test-virtualbox/ubuntu1404`). 116 | 4. Fix stuff. Use `make ssh` to interactively test your box (like `make ssh-virtualbox/ubuntu1404`). 117 | 5. Run `make test` on a relevant template (like `make test-virtualbox/ubuntu1404`) to see if the tests pass. Repeat steps 3-5 until done. 118 | 6. Update `README.md` and `AUTHORS` to reflect any changes. 119 | 7. If you have a large change in mind, it is still preferred that you split them into small commits. Good commit messages are important. The git documentatproject has some nice guidelines on [writing descriptive commit messages](http://git-scm.com/book/ch5-2.html#Commit-Guidelines). 120 | 8. Push to your fork and submit a pull request. 121 | 9. Once submitted, a full `make test` run will be performed against your change in the build farm. You will be notified if the test suite fails. 122 | 10. 123 | ### Would you like to help out more? 124 | 125 | Contact moujan@annawake.com 126 | 127 | ### Acknowledgments 128 | 129 | [Parallels](http://www.parallels.com/) provided a Business Edition license of 130 | their software to run on the basebox build farm. 131 | 132 | 133 | 134 | [SmartyStreets](http://www.smartystreets.com) provided basebox hosting for the box-cutter project since 2015 - thank you for your support! 135 | 136 | 137 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 2.0.9 2 | -------------------------------------------------------------------------------- /bin/Makefile.local.winry: -------------------------------------------------------------------------------- 1 | ISO_PATH := file:///Volumes/Thunder/software/debian 2 | 3 | VIRTUALBOX_VERSION := $(shell virtualbox --help | head -n 1 | awk '{print $$NF}') 4 | VMWARE_VERSION := 10.0.0 5 | VMWARE_BOX_FILES := $(wildcard box/vmware/*.box) 6 | VIRTUALBOX_BOX_FILES := $(wildcard box/virtualbox/*.box) 7 | VMWARE_S3_BUCKET := s3://smartystreets-boxcutter/debian/vmware$(VMWARE_VERSION)/ 8 | VIRTUALBOX_S3_BUCKET := s3://smartystreets-boxcutter/debian/virtualbox$(VIRTUALBOX_VERSION)/ 9 | S3_GRANT_ID := id=120985f7542bdcc1f07bb3e2fc74f0e53a03f9a05e4267a3c8d38d27933c7a94 10 | AWS_PROFILE = smartystreets 11 | -------------------------------------------------------------------------------- /bin/box: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -o errexit -o nounset -o pipefail 3 | 4 | if [ "${DEBUG:=false}" = "true" ]; then 5 | set -o xtrace 6 | fi 7 | 8 | usage() { 9 | echo "usage: $(basename $0) [-h/--help] command [arguments...]" 10 | echo 11 | echo "Available commands are:" 12 | echo " build Generate a box image file" 13 | echo " ssh Run vagrant ssh against a box image name" 14 | echo " test Run serverspec tests against a box image name" 15 | } 16 | 17 | args() { 18 | if [ $# -lt 1 ]; then 19 | usage 20 | exit 0 21 | fi 22 | 23 | if [[ ! $1 =~ ^(build|ssh|test)$ ]]; then 24 | echo "$(basename $0): illegal option $1" 25 | usage 26 | exit 1 27 | fi 28 | 29 | command=$1 30 | case $command in 31 | "" | "-h" | "--help") 32 | usage 33 | ;; 34 | *) 35 | shift 36 | ;; 37 | esac 38 | $command "$@" 39 | } 40 | 41 | ssh() { 42 | bin/ssh-box "$@" 43 | } 44 | 45 | test() { 46 | bin/test-box "$@" 47 | } 48 | 49 | build() { 50 | bin/build-box "$@" 51 | } 52 | 53 | # main 54 | args "$@" 55 | -------------------------------------------------------------------------------- /bin/build-box: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -o errexit -o nounset -o pipefail 3 | 4 | if [ "${DEBUG:=false}" = "true" ]; then 5 | set -o xtrace 6 | fi 7 | 8 | usage() { 9 | echo "usage: $(basename $0) VAR_LIST_FILE [vmware|virtualbox|parallels] [PACKER_TEMPLATE]" 10 | echo 11 | echo "Build a box" 12 | } 13 | 14 | args() { 15 | if [ $# -lt 1 ]; then 16 | usage 17 | exit 0 18 | fi 19 | 20 | var_file=$1 21 | if [ ! -f ${var_file} ]; then 22 | var_file="${var_file}.json" 23 | if [ ! -f ${var_file} ]; then 24 | echo "$(basename $0): Invalid template file ${var_file}" 25 | exit 127 26 | fi 27 | fi 28 | only=${2:-} 29 | if [[ -n ${only} ]]; then 30 | if [[ ! $only =~ ^(vmware|virtualbox|parallels)$ ]]; then 31 | echo "$(basename $0): illegal platform $2" 32 | echo "Valid platforms: vmware|virtualbox|parallels" 33 | usage 34 | exit 1 35 | fi 36 | fi 37 | if [[ "${only}" = "vmware" ]]; then 38 | only=vmware-iso 39 | elif [[ "${only}" = "virtualbox" ]]; then 40 | only=virtualbox-iso 41 | elif [[ "${only}" = "parallels" ]]; then 42 | only=parallels-iso 43 | fi 44 | if [ -n "${only}" ]; then 45 | only="-only=${only}" 46 | fi 47 | packer_template=${3:-debian.json} 48 | } 49 | 50 | # main 51 | args "$@" 52 | 53 | version=$(cat VERSION) 54 | packer build ${only} -var-file=${var_file} -var "version=${version}" ${packer_template} 55 | -------------------------------------------------------------------------------- /bin/bump.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eu 2 | 3 | if [ "${DEBUG:=false}" = "true" ]; then 4 | set -x 5 | fi 6 | 7 | usage() { 8 | echo "usage: $(basename $0) " 9 | echo 10 | echo "Available subcommands are:" 11 | echo " current Print current version" 12 | echo " major Bump major version (ex: 1.2.1 -> 2.0.0)" 13 | echo " minor Bump minor version (ex: 1.2.1 -> 1.3.0)" 14 | echo " patch Bump patch version (ex: 1.2.1 -> 1.2.2)" 15 | echo " tag Tag in Git using current version" 16 | } 17 | 18 | args() { 19 | if [ $# -lt 1 ]; then 20 | usage 21 | exit 0 22 | fi 23 | 24 | if [[ ! $1 =~ ^(current|major|minor|patch|tag)$ ]]; then 25 | usage 26 | exit 1 27 | fi 28 | 29 | subcommand=$1 30 | case $subcommand in 31 | "" | "-h" | "--help") 32 | usage 33 | ;; 34 | *) 35 | shift 36 | ;; 37 | esac 38 | $subcommand 39 | } 40 | 41 | current() { 42 | echo "Current version: ${CURRENT_VERSION}" 43 | } 44 | 45 | tag() { 46 | echo "tagged: ${CURRENT_VERSION}" 47 | git fetch --all > /dev/null 48 | git add CHANGELOG.md 49 | git commit -m "Version ${CURRENT_VERSION} pushed to Atlas" 50 | git tag -a -m "Version ${CURRENT_VERSION} pushed to Atlas" ${CURRENT_VERSION} 51 | git push --tags || true 52 | } 53 | 54 | write_version() { 55 | NEXT_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION} 56 | echo "Writing files: VERSION" 57 | echo ${NEXT_VERSION} > VERSION 58 | git fetch --all > /dev/null 59 | git add VERSION 60 | git commit -m "Bump VERSION to ${NEXT_VERSION}" 61 | } 62 | 63 | major() { 64 | MAJOR_VERSION=$((${MAJOR_VERSION}+1)) 65 | MINOR_VERSION=0 66 | PATCH_VERSION=0 67 | write_version 68 | } 69 | 70 | minor() { 71 | MAJOR_VERSION=${MAJOR_VERSION} 72 | MINOR_VERSION=$((${MINOR_VERSION}+1)) 73 | PATCH_VERSION=0 74 | write_version 75 | } 76 | 77 | patch() { 78 | MAJOR_VERSION=${MAJOR_VERSION} 79 | MINOR_VERSION=${MINOR_VERSION} 80 | PATCH_VERSION=$((${PATCH_VERSION}+1)) 81 | write_version 82 | } 83 | 84 | main() { 85 | CURRENT_VERSION=$(cat VERSION) 86 | VERSION_LIST=($(echo ${CURRENT_VERSION} | tr '.' ' ')) 87 | MAJOR_VERSION=${VERSION_LIST[0]} 88 | MINOR_VERSION=${VERSION_LIST[1]} 89 | PATCH_VERSION=${VERSION_LIST[2]} 90 | args "$@" 91 | } 92 | 93 | main "$@" 94 | 95 | -------------------------------------------------------------------------------- /bin/register_atlas.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -o nounset # Treat unset variables as an error and immediately exit 3 | set -o errexit # If a command fails exit the whole script 4 | 5 | if [ "${DEBUG:-false}" = "true" ]; then 6 | set -x # Run the entire script in debug mode 7 | fi 8 | 9 | usage() { 10 | echo "usage: $(basename $0) " 11 | echo 12 | echo "Requires the following environment variables to be set:" 13 | echo " ATLAS_USERNAME" 14 | echo " ATLAS_ACCESS_TOKEN" 15 | echo " BOX_CUTTER_ATLAS_USERNAME" 16 | echo " BOX_CUTTER_ATLAS_ACCESS_TOKEN" 17 | } 18 | 19 | args() { 20 | if [ $# -lt 3 ]; then 21 | usage 22 | exit 1 23 | fi 24 | 25 | if [ -z ${ATLAS_USERNAME+x} ]; then 26 | echo "ATLAS_USERNAME environment variable not set!" 27 | usage 28 | exit 1 29 | elif [ -z ${ATLAS_ACCESS_TOKEN+x} ]; then 30 | echo "ATLAS_ACCESS_TOKEN environment variable not set!" 31 | usage 32 | exit 1 33 | elif [ -z ${BOX_CUTTER_ATLAS_USERNAME+x} ]; then 34 | echo "BOX_CUTTER_ATLAS_USERNAME environment variable not set!" 35 | usage 36 | exit 1 37 | elif [ -z ${BOX_CUTTER_ATLAS_ACCESS_TOKEN+x} ]; then 38 | echo "BOX_CUTTER_ATLAS_ACCESS_TOKEN environment variable not set!" 39 | usage 40 | exit 1 41 | fi 42 | 43 | BOX_NAME=$1 44 | BOX_SUFFIX=$2 45 | VERSION=$3 46 | } 47 | 48 | get_short_description() { 49 | if [[ "${BOX_NAME}" =~ i386 ]]; then 50 | BIT_STRING="32-bit" 51 | else 52 | BIT_STRING="64-bit" 53 | fi 54 | DOCKER_STRING= 55 | if [[ "${BOX_NAME}" =~ docker ]]; then 56 | DOCKER_STRING=" with Docker preinstalled" 57 | fi 58 | EDITION_STRING= 59 | if [[ "${BOX_NAME}" =~ desktop ]]; then 60 | EDITION_STRING=" Desktop" 61 | else 62 | EDITION_STRING=" Server" 63 | fi 64 | RAW_VERSION=${BOX_NAME#debian} 65 | RAW_VERSION=${RAW_VERSION%-i386} 66 | RAW_VERSION=${RAW_VERSION%-docker} 67 | RAW_VERSION=${RAW_VERSION%-desktop} 68 | case ${RAW_VERSION:0:1} in 69 | 7) 70 | PRETTY_VERSION="Wheezy 7.11" 71 | ;; 72 | 8) 73 | PRETTY_VERSION="Jessie 8.8.0" 74 | ;; 75 | esac 76 | 77 | VIRTUALBOX_VERSION=$(virtualbox --help | head -n 1 | awk '{print $NF}') 78 | PARALLELS_VERSION=$(prlctl --version | awk '{print $3}') 79 | VMWARE_VERSION=10.0.10 80 | SHORT_DESCRIPTION="Debian ${PRETTY_VERSION} (${BIT_STRING})${DOCKER_STRING}" 81 | } 82 | 83 | create_description() { 84 | if [[ "${BOX_NAME}" =~ i386 ]]; then 85 | BIT_STRING="32-bit" 86 | else 87 | BIT_STRING="64-bit" 88 | fi 89 | DOCKER_STRING= 90 | if [[ "${BOX_NAME}" =~ docker ]]; then 91 | DOCKER_STRING=" with Docker preinstalled" 92 | fi 93 | EDITION_STRING= 94 | if [[ "${BOX_NAME}" =~ desktop ]]; then 95 | EDITION_STRING=" Desktop" 96 | else 97 | EDITION_STRING=" Server" 98 | fi 99 | RAW_VERSION=${BOX_NAME#debian} 100 | RAW_VERSION=${RAW_VERSION%-i386} 101 | RAW_VERSION=${RAW_VERSION%-docker} 102 | RAW_VERSION=${RAW_VERSION%-desktop} 103 | case ${RAW_VERSION:0:1} in 104 | 7) 105 | PRETTY_VERSION="Wheezy 7.11" 106 | ;; 107 | 8) 108 | PRETTY_VERSION="Jessie 8.6" 109 | ;; 110 | esac 111 | 112 | VIRTUALBOX_VERSION=$(virtualbox --help | head -n 1 | awk '{print $NF}') 113 | PARALLELS_VERSION=$(prlctl --version | awk '{print $3}') 114 | VMWARE_VERSION=10.0.10 115 | 116 | VMWARE_BOX_FILE=box/vmware/${BOX_NAME}${BOX_SUFFIX} 117 | VIRTUALBOX_BOX_FILE=box/virtualbox/${BOX_NAME}${BOX_SUFFIX} 118 | PARALLELS_BOX_FILE=box/parallels/${BOX_NAME}${BOX_SUFFIX} 119 | DESCRIPTION="Debian ${PRETTY_VERSION} (${BIT_STRING})${DOCKER_STRING} 120 | 121 | " 122 | if [[ -e ${VMWARE_BOX_FILE} ]]; then 123 | FILESIZE=$(du -k -h "${VMWARE_BOX_FILE}" | cut -f1) 124 | DESCRIPTION=${DESCRIPTION}"VMWare ${FILESIZE}B/" 125 | fi 126 | if [[ -e ${VIRTUALBOX_BOX_FILE} ]]; then 127 | FILESIZE=$(du -k -h "${VIRTUALBOX_BOX_FILE}" | cut -f1) 128 | DESCRIPTION=${DESCRIPTION}"VirtualBox ${FILESIZE}B/" 129 | fi 130 | if [[ -e ${PARALLELS_BOX_FILE} ]]; then 131 | FILESIZE=$(du -k -h "${PARALLELS_BOX_FILE}" | cut -f1) 132 | DESCRIPTION=${DESCRIPTION}"Parallels ${FILESIZE}B/" 133 | fi 134 | DESCRIPTION=${DESCRIPTION%?} 135 | 136 | if [[ -e ${VMWARE_BOX_FILE} ]]; then 137 | DESCRIPTION="${DESCRIPTION} 138 | 139 | VMware Tools ${VMWARE_VERSION}" 140 | fi 141 | if [[ -e ${VIRTUALBOX_BOX_FILE} ]]; then 142 | DESCRIPTION="${DESCRIPTION} 143 | 144 | VirtualBox Guest Additions ${VIRTUALBOX_VERSION}" 145 | fi 146 | if [[ -e ${PARALLELS_BOX_FILE} ]]; then 147 | DESCRIPTION="${DESCRIPTION} 148 | 149 | Parallels Tools ${PARALLELS_VERSION}" 150 | fi 151 | 152 | VERSION_JSON=$( 153 | jq -n "{ 154 | version: { 155 | version: \"${VERSION}\", 156 | description: \"${DESCRIPTION}\" 157 | } 158 | }" 159 | ) 160 | } 161 | 162 | publish_provider() { 163 | atlas_username=$1 164 | atlas_access_token=$2 165 | 166 | echo "==> Checking to see if ${PROVIDER} provider exists" 167 | HTTP_STATUS=$(curl -s -f -o /dev/nul -w "%{http_code}" -i "${ATLAS_API_URL}/box/${atlas_username}/${BOX_NAME}/version/${VERSION}/provider/${PROVIDER}"?access_token="${atlas_access_token}" || true) 168 | echo ${HTTP_STATUS} 169 | if [ 200 -eq ${HTTP_STATUS} ]; then 170 | echo "==> Updating ${PROVIDER} provider" 171 | curl -X PUT "${ATLAS_API_URL}/box/${atlas_username}/${BOX_NAME}/version/${VERSION}/provider/${PROVIDER}" -d "access_token=${atlas_access_token}" -d provider[name]="${PROVIDER}" -d provider[url]="${PROVIDER_URL}" 172 | else 173 | echo "==> Creating ${PROVIDER} provider" 174 | curl -X POST "${ATLAS_API_URL}/box/${atlas_username}/${BOX_NAME}/version/${VERSION}/providers" -d "access_token=${atlas_access_token}" -d provider[name]="${PROVIDER}" -d provider[url]="${PROVIDER_URL}" 175 | fi 176 | } 177 | 178 | 179 | atlas_publish() { 180 | atlas_username=$1 181 | atlas_access_token=$2 182 | 183 | ATLAS_API_URL=https://atlas.hashicorp.com/api/v1 184 | 185 | echo "==> Checking for existing box ${BOX_NAME} on ${atlas_username}" 186 | # Retrieve box 187 | HTTP_STATUS=$(curl -s -f -o /dev/nul -w "%{http_code}" -i "${ATLAS_API_URL}/box/${atlas_username}/${BOX_NAME}"?access_token="${atlas_access_token}" || true) 188 | if [ 404 -eq ${HTTP_STATUS} ]; then 189 | echo "${BOX_NAME} does not exist, creating" 190 | get_short_description 191 | 192 | curl -X POST "${ATLAS_API_URL}/boxes" -d box[name]="${BOX_NAME}" -d box[short_description]="${SHORT_DESCRIPTION}" -d box[is_private]=false -d "access_token=${atlas_access_token}" 193 | elif [ 200 -ne ${HTTP_STATUS} ]; then 194 | echo "Unknown status ${HTTP_STATUS} from box/get" && exit 1 195 | fi 196 | 197 | echo "==> Checking for existing version ${VERSION} on ${atlas_username}" 198 | # Retrieve version 199 | HTTP_STATUS=$(curl -s -f -o /dev/nul -w "%{http_code}" -i "${ATLAS_API_URL}/box/${atlas_username}/${BOX_NAME}/version/${VERSION}" || true) 200 | if [ 404 -ne ${HTTP_STATUS} ] && [ 200 -ne ${HTTP_STATUS} ]; then 201 | echo "Unknown HTTP status ${HTTP_STATUS} from version/get" && exit 1 202 | fi 203 | 204 | create_description 205 | #echo "${VERSION_JSON}" 206 | if [ 404 -eq ${HTTP_STATUS} ]; then 207 | echo "==> none found; creating" 208 | JSON_RESULT=$(curl -s -f -X POST -H "Content-Type: application/json" "${ATLAS_API_URL}/box/${atlas_username}/${BOX_NAME}/versions?access_token=${atlas_access_token}" -d "${VERSION_JSON}" || true) 209 | else 210 | echo "==> version found; updating" 211 | JSON_RESULT=$(curl -s -f -X PUT "${ATLAS_API_URL}/box/${atlas_username}/${BOX_NAME}/version/${VERSION}" -d "access_token=${atlas_access_token}" -d "version[description]=${DESCRIPTION}" || true) 212 | fi 213 | 214 | BOXCUTTER_BASE_URL=http://cdn.boxcutter.io/debian 215 | if [[ -e ${VMWARE_BOX_FILE} ]]; then 216 | PROVIDER=vmware_desktop 217 | PROVIDER_URL=${BOXCUTTER_BASE_URL}/vmware${VMWARE_VERSION}/${BOX_NAME}${BOX_SUFFIX} 218 | publish_provider ${atlas_username} ${atlas_access_token} 219 | fi 220 | if [[ -e ${VIRTUALBOX_BOX_FILE} ]]; then 221 | PROVIDER=virtualbox 222 | PROVIDER_URL=${BOXCUTTER_BASE_URL}/virtualbox${VIRTUALBOX_VERSION}/${BOX_NAME}${BOX_SUFFIX} 223 | publish_provider ${atlas_username} ${atlas_access_token} 224 | fi 225 | if [[ -e ${PARALLELS_BOX_FILE} ]]; then 226 | PROVIDER=parallels 227 | PROVIDER_URL=${BOXCUTTER_BASE_URL}/parallels${PARALLELS_VERSION}/${BOX_NAME}${BOX_SUFFIX} 228 | publish_provider ${atlas_username} ${atlas_access_token} 229 | fi 230 | 231 | echo 232 | STATUS=$(echo ${JSON_RESULT} | jq -r .status) 233 | case $STATUS in 234 | unreleased) 235 | curl -X PUT "${ATLAS_API_URL}/box/${atlas_username}/${BOX_NAME}/version/${VERSION}/release" -d "access_token=${atlas_access_token}" 236 | echo 'released!' 237 | ;; 238 | active) 239 | echo 'already released' 240 | ;; 241 | *) 242 | abort "cannot publish version with status '$STATUS'" 243 | esac 244 | } 245 | 246 | main() { 247 | args "$@" 248 | 249 | ATLAS_API_URL=https://atlas.hashicorp.com/api/v1 250 | atlas_publish ${BOX_CUTTER_ATLAS_USERNAME} ${BOX_CUTTER_ATLAS_ACCESS_TOKEN} 251 | atlas_publish ${ATLAS_USERNAME} ${ATLAS_ACCESS_TOKEN} 252 | } 253 | 254 | main "$@" 255 | -------------------------------------------------------------------------------- /bin/ssh-box: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -o errexit -o nounset -o pipefail 3 | 4 | if [ "${DEBUG:=false}" = "true" ]; then 5 | set -o xtrace 6 | fi 7 | 8 | usage() { 9 | echo "usage: $(basename $0) BOX_PATH [vmware|virtualbox|parallels]" 10 | echo 11 | echo "Temporarily register a vagrant box to login to it" 12 | } 13 | 14 | args() { 15 | if [ $# -lt 2 ]; then 16 | usage 17 | exit 0 18 | fi 19 | 20 | if [[ ! $2 =~ ^(vmware|virtualbox|parallels)$ ]]; then 21 | echo "$(basename $0): illegal platform $2" 22 | echo "Valid platforms: vmware|virtualbox|parallels" 23 | usage 24 | exit 1 25 | fi 26 | 27 | box_path=$1 28 | box_provider=$2 29 | vagrant_provider=${3:-${box_provider}} 30 | if [ "$box_provider" = "vmware" ]; then 31 | box_provider=vmware_desktop 32 | if [[ $OSTYPE =~ darwin ]]; then 33 | vagrant_provider=vmware_fusion 34 | else 35 | vagrant_provider=vmware_workstation 36 | fi 37 | fi 38 | } 39 | 40 | # main 41 | args "$@" 42 | 43 | box_filename=$(basename "${box_path}") 44 | box_name=${box_filename%.*} 45 | tmp_path=/tmp/boxtest 46 | 47 | rm -rf ${tmp_path} 48 | 49 | vagrant box remove ${box_name} --provider ${box_provider} || true 50 | vagrant box add ${box_name} ${box_path} 51 | mkdir -p ${tmp_path} 52 | 53 | pushd ${tmp_path} 54 | vagrant init ${box_name} 55 | VAGRANT_LOG=warn vagrant up --provider ${vagrant_provider} 56 | vagrant ssh 57 | # vagrant won't actually tear down the VM 58 | sleep 10 59 | vagrant destroy -f 60 | popd 61 | 62 | vagrant box remove ${box_name} --provider ${box_provider} 63 | -------------------------------------------------------------------------------- /bin/test-box: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -o errexit -o nounset -o pipefail 3 | 4 | if [ "${DEBUG:=false}" = "true" ]; then 5 | set -o xtrace 6 | fi 7 | 8 | usage() { 9 | echo "usage: $(basename $0) BOX_PATH [vmware|virtualbox|parallels]" 10 | echo 11 | echo "Run automated tests against a local *.box file" 12 | } 13 | 14 | args() { 15 | if [ $# -lt 2 ]; then 16 | usage 17 | exit 0 18 | fi 19 | 20 | if [[ ! $2 =~ ^(vmware|virtualbox|parallels)$ ]]; then 21 | echo "$(basename $0): illegal platform $2" 22 | echo "Valid platforms: vmware|virtualbox|parallels" 23 | usage 24 | exit 1 25 | fi 26 | 27 | box_path=$1 28 | box_provider=$2 29 | vagrant_provider=${3:-${box_provider}} 30 | if [ "$box_provider" = "vmware" ]; then 31 | box_provider=vmware_desktop 32 | if [[ $OSTYPE =~ darwin ]]; then 33 | vagrant_provider=vmware_fusion 34 | else 35 | vagrant_provider=vmware_workstation 36 | fi 37 | fi 38 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 39 | test_src_path=${SCRIPT_DIR}/../test/*_spec.rb 40 | } 41 | 42 | create_vagrantfile_linux() { 43 | vagrant plugin list | grep vagrant-serverspec && echo "vagrant-serverspec installed" || vagrant plugin install vagrant-serverspec 44 | cat << EOF > ${tmp_path}/Vagrantfile 45 | Vagrant.configure('2') do |config| 46 | config.vm.box = '$box_name' 47 | 48 | config.vm.provision :serverspec do |spec| 49 | spec.pattern = '${test_src_path}' 50 | end 51 | end 52 | EOF 53 | } 54 | 55 | # main 56 | 57 | args "$@" 58 | 59 | box_filename=$(basename "${box_path}") 60 | box_name=${box_filename%.*} 61 | tmp_path=/tmp/boxtest 62 | 63 | rm -rf ${tmp_path} 64 | 65 | vagrant box remove ${box_name} --provider ${box_provider} 2>/dev/null || true 66 | vagrant box add ${box_name} ${box_path} 67 | mkdir -p ${tmp_path} 68 | 69 | pushd ${tmp_path} 70 | create_vagrantfile_linux 71 | VAGRANT_LOG=warn vagrant up --provider ${vagrant_provider} 72 | vagrant destroy -f 73 | popd 74 | 75 | vagrant box remove ${box_name} --provider ${box_provider} 76 | -------------------------------------------------------------------------------- /bin/test-vagrantcloud-box: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -o errexit -o nounset -o pipefail 3 | 4 | if [ "${DEBUG:=false}" = "true" ]; then 5 | set -o xtrace 6 | fi 7 | 8 | usage() { 9 | echo "usage: $(basename $0) BOX_NAME [vmware|virtualbox|parallels]" 10 | echo 11 | echo "Download BOX_NAME from Atlas and run automated tests against it" 12 | } 13 | 14 | args() { 15 | if [ $# -lt 2 ]; then 16 | usage 17 | exit 0 18 | fi 19 | 20 | if [[ ! $2 =~ ^(vmware|virtualbox|parallels)$ ]]; then 21 | echo "$(basename $0): illegal platform $2" 22 | echo "Valid platforms: vmware|virtualbox|parallels" 23 | usage 24 | exit 1 25 | fi 26 | 27 | box_path=$1 28 | box_provider=$2 29 | vagrant_provider=${3:-${box_provider}} 30 | if [ "$box_provider" = "vmware" ]; then 31 | box_provider=vmware_desktop 32 | if [[ $OSTYPE =~ darwin ]]; then 33 | vagrant_provider=vmware_fusion 34 | else 35 | vagrant_provider=vmware_workstation 36 | fi 37 | fi 38 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 39 | test_src_path=${SCRIPT_DIR}/../test/*_spec.rb 40 | } 41 | 42 | create_vagrantfile_linux() { 43 | vagrant plugin list | grep vagrant-serverspec && echo "vagrant-serverspec installed" || vagrant plugin install vagrant-serverspec 44 | cat << EOF > $tmp_path/Vagrantfile 45 | Vagrant.configure('2') do |config| 46 | config.vm.box = '$box_path' 47 | 48 | config.vm.provision :serverspec do |spec| 49 | spec.pattern = '$test_src_path' 50 | end 51 | end 52 | EOF 53 | } 54 | 55 | # main 56 | 57 | args "$@" 58 | 59 | box_filename=$(basename "${box_path}") 60 | box_name=${box_filename%.*} 61 | tmp_path=/tmp/vagrantcloudtest 62 | 63 | rm -rf ${tmp_path} 64 | rm -f ~/.ssh/known_hosts 65 | 66 | vagrant box remove ${box_path} --provider ${box_provider} 2>/dev/null || true 67 | vagrant box add ${box_path} --provider=${box_provider} 68 | mkdir -p ${tmp_path} 69 | 70 | pushd ${tmp_path} 71 | create_vagrantfile_linux 72 | VAGRANT_LOG=warn vagrant up --provider=${vagrant_provider} 73 | sleep 10 74 | vagrant destroy -f 75 | popd 76 | 77 | vagrant box remove ${box_path} --provider=${box_provider} 78 | -------------------------------------------------------------------------------- /custom-script.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eux 4 | 5 | # Sample custom configuration script - add your own commands here 6 | # to add some additional commands for your environment 7 | # 8 | # For example: 9 | # yum install -y curl wget git tmux firefox xvfb 10 | -------------------------------------------------------------------------------- /debian.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [ 3 | { 4 | "boot_command": [ 5 | "", 6 | "install", 7 | " auto", 8 | " url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{ user `preseed` }}", 9 | " debian-installer=en_US", 10 | " locale=en_US", 11 | " keymap=us", 12 | " netcfg/get_hostname=vagrant", 13 | " netcfg/get_domain=vm ", 14 | "" 15 | ], 16 | "disk_size": "{{ user `disk_size` }}", 17 | "guest_os_type": "{{ user `vmware_guest_os_type` }}", 18 | "headless": "{{ user `headless` }}", 19 | "http_directory": "http", 20 | "iso_checksum": "{{user `iso_checksum`}}", 21 | "iso_checksum_type": "{{user `iso_checksum_type`}}", 22 | "iso_urls": [ 23 | "{{ user `iso_path` }}/{{ user `iso_name` }}", 24 | "{{ user `iso_url` }}" 25 | ], 26 | "output_directory": "output-{{ user `vm_name` }}-vmware-iso", 27 | "shutdown_command": "echo 'vagrant'|sudo -S shutdown -h now", 28 | "ssh_password": "{{ user `ssh_password` }}", 29 | "ssh_username": "{{ user `ssh_username` }}", 30 | "ssh_wait_timeout": "10000s", 31 | "tools_upload_flavor": "linux", 32 | "type": "vmware-iso", 33 | "vm_name": "{{ user `vm_name` }}", 34 | "vmx_data": { 35 | "memsize": "{{ user `memory` }}", 36 | "numvcpus": "{{ user `cpus` }}" 37 | } 38 | }, 39 | { 40 | "boot_command": [ 41 | "", 42 | "install", 43 | " auto", 44 | " url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{ user `preseed` }}", 45 | " debian-installer=en_US", 46 | " locale=en_US", 47 | " keymap=us", 48 | " netcfg/get_hostname=vagrant", 49 | " netcfg/get_domain=vm ", 50 | "" 51 | ], 52 | "disk_size": "{{ user `disk_size` }}", 53 | "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso", 54 | "guest_os_type": "{{ user `virtualbox_guest_os_type` }}", 55 | "headless": "{{ user `headless` }}", 56 | "http_directory": "http", 57 | "iso_checksum": "{{ user `iso_checksum` }}", 58 | "iso_checksum_type": "{{ user `iso_checksum_type` }}", 59 | "iso_urls": [ 60 | "{{ user `iso_path` }}/{{ user `iso_name` }}", 61 | "{{ user `iso_url` }}" 62 | ], 63 | "output_directory": "output-{{ user `vm_name` }}-virtualbox-iso", 64 | "post_shutdown_delay": "1m", 65 | "shutdown_command": "echo 'vagrant'|sudo -S shutdown -h now", 66 | "ssh_password": "{{ user `ssh_password` }}", 67 | "ssh_username": "{{ user `ssh_username` }}", 68 | "ssh_wait_timeout": "10000s", 69 | "type": "virtualbox-iso", 70 | "vboxmanage": [ 71 | [ 72 | "modifyvm", "{{.Name}}", "--memory", "{{ user `memory` }}" 73 | ], 74 | [ 75 | "modifyvm", "{{.Name}}", "--cpus", "{{ user `cpus` }}" 76 | ] 77 | ], 78 | "virtualbox_version_file": ".vbox_version", 79 | "vm_name": "{{ user `vm_name` }}" 80 | }, 81 | { 82 | "boot_command": [ 83 | "", 84 | "install", 85 | " auto", 86 | " url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{ user `preseed` }}", 87 | " debian-installer=en_US", 88 | " locale=en_US", 89 | " keymap=us", 90 | " netcfg/get_hostname=vagrant", 91 | " netcfg/get_domain=vm ", 92 | "" 93 | ], 94 | "disk_size": "{{ user `disk_size` }}", 95 | "guest_os_type": "{{ user `parallels_guest_os_type` }}", 96 | "http_directory": "http", 97 | "iso_checksum": "{{ user `iso_checksum` }}", 98 | "iso_checksum_type": "{{ user `iso_checksum_type` }}", 99 | "iso_urls": [ 100 | "{{ user `iso_path` }}/{{ user `iso_name` }}", 101 | "{{ user `iso_url` }}" 102 | ], 103 | "output_directory": "output-{{ user `vm_name` }}-parallels-iso", 104 | "parallels_tools_flavor": "lin", 105 | "prlctl": [ 106 | [ 107 | "set", "{{.Name}}", "--memsize", "{{ user `memory` }}" 108 | ], 109 | [ 110 | "set", "{{.Name}}", "--cpus", "{{ user `cpus` }}" 111 | ] 112 | ], 113 | "prlctl_version_file": ".prlctl_version", 114 | "shutdown_command": "echo 'vagrant'|sudo -S shutdown -h now", 115 | "ssh_password": "{{ user `ssh_password` }}", 116 | "ssh_username": "{{ user `ssh_username` }}", 117 | "ssh_wait_timeout": "10000s", 118 | "type": "parallels-iso", 119 | "vm_name": "{{ user `vm_name` }}" 120 | } 121 | ], 122 | "post-processors": [ 123 | { 124 | "keep_input_artifact": false, 125 | "output": "box/{{.Provider}}/{{ user `vm_name` }}-{{ user `version` }}.box", 126 | "type": "vagrant", 127 | "vagrantfile_template": "{{ user `vagrantfile_template` }}" 128 | } 129 | ], 130 | "provisioners": [ 131 | { 132 | "environment_vars": [ 133 | "DESKTOP={{user `desktop`}}", 134 | "REMOVE_DOCS={{user `remove_docs`}}", 135 | "UPDATE={{user `update`}}", 136 | "INSTALL_VAGRANT_KEY={{user `install_vagrant_key`}}", 137 | "SSH_USERNAME={{user `ssh_username`}}", 138 | "SSH_PASSWORD={{user `ssh_password`}}", 139 | "http_proxy={{user `http_proxy`}}", 140 | "https_proxy={{user `https_proxy`}}", 141 | "ftp_proxy={{user `ftp_proxy`}}", 142 | "rsync_proxy={{user `rsync_proxy`}}", 143 | "no_proxy={{user `no_proxy`}}" 144 | ], 145 | "execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S bash '{{.Path}}'", 146 | "scripts": [ 147 | "script/remove-cdrom-sources.sh", 148 | "script/systemd.sh", 149 | "script/update.sh", 150 | "script/desktop.sh", 151 | "script/vagrant.sh", 152 | "script/vmware.sh", 153 | "script/virtualbox.sh", 154 | "script/parallels.sh", 155 | "script/motd.sh", 156 | "custom-script.sh", 157 | "script/minimize.sh", 158 | "script/cleanup.sh" 159 | ], 160 | "type": "shell", 161 | "pause_before": "10s", 162 | "expect_disconnect": "true" 163 | } 164 | ], 165 | "variables": { 166 | "cpus": "1", 167 | "desktop": "false", 168 | "disk_size": "65536", 169 | "ftp_proxy": "{{env `ftp_proxy`}}", 170 | "headless": "", 171 | "http_proxy": "{{env `http_proxy`}}", 172 | "https_proxy": "{{env `https_proxy`}}", 173 | "install_vagrant_key": "true", 174 | "iso_checksum": "40f51a36b39c180fe46d7393e5a3a3985072ffc2", 175 | "iso_checksum_type": "sha1", 176 | "iso_name": "debian-8.2.0-amd64-DVD-1.iso", 177 | "iso_path": "/Volumes/Storage/software/debian", 178 | "iso_url": "iso/debian-8.2.0-amd64-DVD-1.iso", 179 | "memory": "512", 180 | "no_proxy": "{{env `no_proxy`}}", 181 | "parallels_guest_os_type": "debian", 182 | "preseed": "preseed-jessie.cfg", 183 | "rsync_proxy": "{{env `rsync_proxy`}}", 184 | "remove_docs": "true", 185 | "ssh_password": "vagrant", 186 | "ssh_username": "vagrant", 187 | "update": "false", 188 | "vagrantfile_template": "", 189 | "version": "0.1.0", 190 | "virtualbox_guest_os_type": "Debian_64", 191 | "vm_name": "debian82", 192 | "vmware_guest_os_type": "debian8-64" 193 | } 194 | } 195 | -------------------------------------------------------------------------------- /debian10.json: -------------------------------------------------------------------------------- 1 | { 2 | "_comment": "Build with `packer build -var-file=debian10.json debian.json`", 3 | "vm_name": "debian10", 4 | "cpus": "1", 5 | "disk_size": "8192", 6 | "iso_checksum": "d808985468652393cf31d30fe7d6f60f5041337980b25dd00f2ab9553248b564cf38174c8251f410ddbe221e57fefc78849f9879141e25a5dfb31d8043fccc5c", 7 | "iso_checksum_type": "sha512", 8 | "iso_name": "debian-10.0.0-amd64-netinst.iso", 9 | "iso_url": "https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-10.0.0-amd64-netinst.iso", 10 | "memory": "1024", 11 | "preseed" : "preseed-buster.cfg", 12 | "headless": "false" 13 | } 14 | -------------------------------------------------------------------------------- /debian7-i386.json: -------------------------------------------------------------------------------- 1 | { 2 | "_comment": "Build with `packer build -var-file=debian7-i386.json debian.json`", 3 | "vm_name": "debian7-i386", 4 | "cpus": "1", 5 | "disk_size": "65536", 6 | "iso_checksum": "cddad7d1660d6c093fa01b542b7bcd9444faf740", 7 | "iso_checksum_type": "sha1", 8 | "iso_name": "debian-7.11.0-i386-DVD-1.iso", 9 | "iso_url": "http://cdimage.debian.org/cdimage/archive/7.11.0/i386/iso-dvd/debian-7.11.0-i386-DVD-1.iso", 10 | "memory": "512", 11 | "preseed": "preseed-jessie.cfg", 12 | "virtualbox_guest_os_type": "Debian", 13 | "vmware_guest_os_type": "debian7" 14 | } 15 | -------------------------------------------------------------------------------- /debian7.json: -------------------------------------------------------------------------------- 1 | { 2 | "_comment": "Build with `packer build -var-file=debian7.json debian.json`", 3 | "vm_name": "debian7", 4 | "cpus": "1", 5 | "disk_size": "65536", 6 | "iso_checksum": "b61a24d3f9ec7016600ee17c68a3f416af29b729", 7 | "iso_checksum_type": "sha1", 8 | "iso_name": "debian-7.11.0-amd64-DVD-1.iso", 9 | "iso_url": "http://cdimage.debian.org/cdimage/archive/7.11.0/amd64/iso-dvd/debian-7.11.0-amd64-DVD-1.iso", 10 | "memory": "512", 11 | "preseed" : "preseed-jessie.cfg", 12 | "vmware_guest_os_type": "debian7-64" 13 | } 14 | -------------------------------------------------------------------------------- /debian8-desktop.json: -------------------------------------------------------------------------------- 1 | { 2 | "_comment": "Build with `packer build -var-file=debian8-desktop.json debian.json`", 3 | "vm_name": "debian8-desktop", 4 | "desktop": "true", 5 | "cpus": "1", 6 | "disk_size": "65536", 7 | "iso_checksum": "a2e3bf4dfce4a1fd6756049cb272d7f5e86bf0da", 8 | "iso_checksum_type": "sha1", 9 | "iso_name": "debian-8.10.0-amd64-DVD-1.iso", 10 | "iso_url": "https://cdimage.debian.org/mirror/cdimage/archive/8.10.0/amd64/iso-dvd/debian-8.10.0-amd64-DVD-1.iso", 11 | "memory": "1024", 12 | "preseed" : "preseed-jessie.cfg", 13 | "vagrantfile_template": "tpl/vagrantfile-debian-desktop.tpl" 14 | } 15 | -------------------------------------------------------------------------------- /debian8-i386.json: -------------------------------------------------------------------------------- 1 | { 2 | "_comment": "Build with `packer build -var-file=debian8-i386.json debian.json`", 3 | "vm_name": "debian8-i386", 4 | "cpus": "1", 5 | "disk_size": "65536", 6 | "iso_checksum": "ba6ffe2abc76696bca755cbd68c2b8bc651f80e4", 7 | "iso_checksum_type": "sha1", 8 | "iso_name": "debian-8.10.0-i386-DVD-1.iso", 9 | "iso_url": "https://cdimage.debian.org/mirror/cdimage/archive/8.10.0/i386/iso-dvd/debian-8.10.0-i386-DVD-1.iso", 10 | "memory": "512", 11 | "preseed": "preseed-jessie.cfg", 12 | "virtualbox_guest_os_type": "Debian", 13 | "vmware_guest_os_type": "debian8" 14 | } 15 | -------------------------------------------------------------------------------- /debian8.json: -------------------------------------------------------------------------------- 1 | { 2 | "_comment": "Build with `packer build -var-file=debian8.json debian.json`", 3 | "vm_name": "debian8", 4 | "cpus": "1", 5 | "disk_size": "65536", 6 | "iso_checksum": "a2e3bf4dfce4a1fd6756049cb272d7f5e86bf0da", 7 | "iso_checksum_type": "sha1", 8 | "iso_name": "debian-8.10.0-amd64-DVD-1.iso", 9 | "iso_url": "https://cdimage.debian.org/mirror/cdimage/archive/8.10.0/amd64/iso-dvd/debian-8.10.0-amd64-DVD-1.iso", 10 | "memory": "512", 11 | "preseed" : "preseed-jessie.cfg" 12 | } 13 | -------------------------------------------------------------------------------- /debian9-desktop.json: -------------------------------------------------------------------------------- 1 | { 2 | "_comment": "Build with `packer build -var-file=debian9-desktop.json debian.json`", 3 | "vm_name": "debian9-desktop", 4 | "desktop": "true", 5 | "cpus": "1", 6 | "disk_size": "65536", 7 | "iso_checksum": "345c4e674dc10476e8c4f1571fbcdba4ce9788aa5584c5e2590ab3e89e7bb9acb370536f41a3ac740eb92b6aebe3cb8eb9734874dd1658c68875981b8351bc38", 8 | "iso_checksum_type": "sha512", 9 | "iso_name": "debian-9.4.0-amd64-netinst.iso", 10 | "iso_url": "https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-9.4.0-amd64-netinst.iso", 11 | "memory": "1024", 12 | "preseed" : "preseed-jessie.cfg", 13 | "vagrantfile_template": "tpl/vagrantfile-debian-desktop.tpl", 14 | "headless": "false" 15 | } 16 | -------------------------------------------------------------------------------- /debian9-i386.json: -------------------------------------------------------------------------------- 1 | { 2 | "_comment": "Build with `packer build -var-file=debian9-i386.json debian.json`", 3 | "vm_name": "debian9-i386", 4 | "cpus": "1", 5 | "disk_size": "65536", 6 | "iso_checksum": "8ecdc0c76f8d55a7d3e57007909449b10b0353b4f4867b9a0caab47f5c5d31a651ab91221e4d908662b74033545eeda885ea8c009213c844bc0ce2447d7d06cc", 7 | "iso_checksum_type": "sha512", 8 | "iso_name": "debian-9.4.0-i386-netinst.iso", 9 | "iso_url": "https://cdimage.debian.org/debian-cd/current/i386/iso-cd/debian-9.4.0-i386-netinst.iso", 10 | "memory": "512", 11 | "preseed": "preseed-jessie.cfg", 12 | "virtualbox_guest_os_type": "Debian", 13 | "vmware_guest_os_type": "debian9" 14 | } 15 | -------------------------------------------------------------------------------- /debian9.json: -------------------------------------------------------------------------------- 1 | { 2 | "_comment": "Build with `packer build -var-file=debian9.json debian.json`", 3 | "vm_name": "debian9", 4 | "cpus": "1", 5 | "disk_size": "65536", 6 | "iso_checksum": "345c4e674dc10476e8c4f1571fbcdba4ce9788aa5584c5e2590ab3e89e7bb9acb370536f41a3ac740eb92b6aebe3cb8eb9734874dd1658c68875981b8351bc38", 7 | "iso_checksum_type": "sha512", 8 | "iso_name": "debian-9.4.0-amd64-netinst.iso", 9 | "iso_url": "https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-9.4.0-amd64-netinst.iso", 10 | "memory": "512", 11 | "preseed" : "preseed-jessie.cfg", 12 | "headless": "false" 13 | } 14 | -------------------------------------------------------------------------------- /http/preseed-buster.cfg: -------------------------------------------------------------------------------- 1 | # Debian 10 (buster) preseed file - preseed-buster.cfg 2 | # 3 | # For more information on preseed syntax and commands, refer to: 4 | # http://www.debian.org/releases/stable/amd64/apbs01.html.en 5 | # 6 | # For testing, you can fire up a local http server temporary. 7 | # Download the preseed.cfg file locally, cd to the directory where the 8 | # preseed.cfg resides and run hte following command: 9 | # $ python -m SimpleHTTPServer 10 | # You don't have to restart the server every time you make changes. Python 11 | # will reload the file from disk every time there is a request. As long as you 12 | # save your changes they will be reflected in the next HTTP download. Then to 13 | # test with a PXE boot server, use the following kernel boot parameters: 14 | # > linux auto url=http://:8000/preseed.cfg hostname= locale=en_US keyboard-configuration/modelcode=SKIP 15 | # 16 | # NOTE: If you netboot/PXE boot Debian, it will ignore the value in hostname, 17 | # but you must provide a hostname as a boot parameter to prevent the Debian 18 | # install from prompting for a hostname 19 | 20 | # Account setup 21 | d-i passwd/root-login boolean false 22 | d-i passwd/user-fullname string Vagrant User 23 | d-i passwd/username string vagrant 24 | d-i passwd/user-password password vagrant 25 | d-i passwd/user-password-again password vagrant 26 | d-i user-setup/encrypt-home boolean false 27 | d-i user-setup/allow-password-weak boolean true 28 | # Clock and time zone setup 29 | d-i clock-setup/utc boolean true 30 | d-i time/zone string UTC 31 | d-i clock-setup/ntp boolean true 32 | # Partitioning 33 | d-i partman-auto/method string lvm 34 | d-i partman-lvm/device_remove_lvm boolean true 35 | d-i partman-md/device_remove_md boolean true 36 | d-i partman-lvm/confirm boolean true 37 | d-i partman-lvm/confirm_nooverwrite boolean true 38 | d-i partman/choose_partition select finish 39 | d-i partman-auto-lvm/guided_size string max 40 | d-i partman-auto/choose_recipe select atomic 41 | d-i partman/default_filesystem string ext4 42 | d-i partman/confirm_write_new_label boolean true 43 | d-i partman/confirm boolean true 44 | d-i partman/confirm_nooverwrite boolean true 45 | # Scan another CD or DVD? 46 | apt-cdrom-setup apt-setup/cdrom/set-first boolean false 47 | # Package mirror 48 | d-i mirror/country string manual 49 | d-i mirror/http/hostname string deb.debian.org 50 | d-i mirror/http/directory string /debian 51 | d-i mirror/http/proxy string 52 | d-i apt-setup/use_mirror boolean true 53 | # Don't send reports back to the project 54 | popularity-contest popularity-contest/participate boolean false 55 | # Package selection 56 | tasksel tasksel/first multiselect standard 57 | # Automatically install grub to the MBR 58 | d-i grub-installer/only_debian boolean true 59 | d-i grub-installer/bootdev string default 60 | # Turn off last message about the install being complete 61 | d-i finish-install/reboot_in_progress note 62 | d-i pkgsel/include string openssh-server ntp curl nfs-common linux-headers-$(uname -r) build-essential perl dkms net-tools 63 | # This first command is run as early as possible, just after 64 | # preseeding is read. 65 | # Prevent packaged version of VirtualBox Guest Additions being installed: 66 | d-i preseed/early_command string sed -i \ 67 | '/in-target/idiscover(){/sbin/discover|grep -v VirtualBox;}' \ 68 | /usr/lib/pre-pkgsel.d/20install-hwpackages 69 | -------------------------------------------------------------------------------- /http/preseed-jessie.cfg: -------------------------------------------------------------------------------- 1 | # Debian 8 (jessie) preseed file - preseed-jessie.cfg 2 | # Built from stock jessie configuration file 3 | # https://www.debian.org/releases/jessie/example-preseed.txt 4 | # 5 | # For more information on preseed syntax and commands, refer to: 6 | # http://www.debian.org/releases/stable/i386/apbs01.html.en 7 | # 8 | # For testing, you can fire up a local http server temporary. 9 | # Download the preseed.cfg file locally, cd to the directory where the 10 | # preseed.cfg resides and run hte following command: 11 | # $ python -m SimpleHTTPServer 12 | # You don't have to restart the server every time you make changes. Python 13 | # will reload the file from disk every time there is a request. As long as you 14 | # save your changes they will be reflected in the next HTTP download. Then to 15 | # test with a PXE boot server, use the following kernel boot parameters: 16 | # > linux auto url=http://:8000/preseed.cfg hostname= locale=en_US keyboard-configuration/modelcode=SKIP 17 | # 18 | # NOTE: If you netboot/PXE boot Debian, it will ignore the value in hostname, 19 | # but you must provide a hostname as a boot parameter to prevent the Debian 20 | # install from prompting for a hostname 21 | 22 | # Account setup 23 | d-i passwd/root-login boolean false 24 | d-i passwd/user-fullname string Vagrant User 25 | d-i passwd/username string vagrant 26 | d-i passwd/user-password password vagrant 27 | d-i passwd/user-password-again password vagrant 28 | d-i user-setup/encrypt-home boolean false 29 | d-i user-setup/allow-password-weak boolean true 30 | # Clock and time zone setup 31 | d-i clock-setup/utc boolean true 32 | d-i time/zone string UTC 33 | d-i clock-setup/ntp boolean true 34 | # Partitioning 35 | d-i partman-auto/method string lvm 36 | d-i partman-lvm/device_remove_lvm boolean true 37 | d-i partman-md/device_remove_md boolean true 38 | d-i partman-lvm/confirm boolean true 39 | d-i partman-lvm/confirm_nooverwrite boolean true 40 | d-i partman/choose_partition select finish 41 | d-i partman-auto-lvm/guided_size string max 42 | d-i partman-auto/choose_recipe select atomic 43 | d-i partman/default_filesystem string ext3 44 | d-i partman/confirm_wirte_new_label boolean true 45 | d-i partman/confirm boolean true 46 | d-i partman/confirm_nooverwrite boolean true 47 | # Scan another CD or DVD? 48 | apt-cdrom-setup apt-setup/cdrom/set-first boolean false 49 | # Package mirror 50 | d-i mirror/country string manual 51 | d-i mirror/http/hostname string http.debian.net 52 | d-i mirror/http/directory string /debian 53 | d-i mirror/http/proxy string 54 | d-i apt-setup/use_mirror boolean true 55 | # Don't send reports back to the project 56 | popularity-contest popularity-contest/participate boolean false 57 | # Package selection 58 | tasksel tasksel/first multiselect standard 59 | # Automatically install grub to the MBR 60 | d-i grub-installer/only_debian boolean true 61 | d-i grub-installer/bootdev string default 62 | # Turn off last message about the install being complete 63 | d-i finish-install/reboot_in_progress note 64 | d-i pkgsel/include string openssh-server ntp curl nfs-common linux-headers-$(uname -r) build-essential perl dkms net-tools 65 | # This first command is run as early as possible, just after 66 | # preseeding is read. 67 | # Prevent packaged version of VirtualBox Guest Additions being installed: 68 | d-i preseed/early_command string sed -i \ 69 | '/in-target/idiscover(){/sbin/discover|grep -v VirtualBox;}' \ 70 | /usr/lib/pre-pkgsel.d/20install-hwpackages 71 | -------------------------------------------------------------------------------- /http/preseed.cfg: -------------------------------------------------------------------------------- 1 | # Debian 7.1.0 preseed file - preseed.cfg 2 | # 3 | # For more information on preseed syntax and commands, refer to: 4 | # http://www.debian.org/releases/stable/i386/apbs01.html.en 5 | # 6 | # For testing, you can fire up a local http server temporary. 7 | # Download the preseed.cfg file locally, cd to the directory where the 8 | # preseed.cfg resides and run hte following command: 9 | # $ python -m SimpleHTTPServer 10 | # You don't have to restart the server every time you make changes. Python 11 | # will reload the file from disk every time there is a request. As long as you 12 | # save your changes they will be reflected in the next HTTP download. Then to 13 | # test with a PXE boot server, use the following kernel boot parameters: 14 | # > linux auto url=http://:8000/preseed.cfg hostname= locale=en_US keyboard-configuration/modelcode=SKIP 15 | # 16 | # NOTE: If you netboot/PXE boot Debian, it will ignore the value in hostname, 17 | # but you must provide a hostname as a boot parameter to prevent the Debian 18 | # install from prompting for a hostname 19 | 20 | # Account setup 21 | d-i passwd/root-login boolean false 22 | d-i passwd/user-fullname string Vagrant User 23 | d-i passwd/username string vagrant 24 | d-i passwd/user-password password vagrant 25 | d-i passwd/user-password-again password vagrant 26 | d-i user-setup/encrypt-home boolean false 27 | d-i user-setup/allow-password-weak boolean true 28 | # Clock and time zone setup 29 | d-i clock-setup/utc boolean true 30 | d-i time/zone string UTC 31 | d-i clock-setup/ntp boolean true 32 | # Partitioning 33 | d-i partman-auto/method string lvm 34 | d-i partman-lvm/device_remove_lvm boolean true 35 | d-i partman-md/device_remove_md boolean true 36 | d-i partman-lvm/confirm boolean true 37 | d-i partman-lvm/confirm_nooverwrite boolean true 38 | d-i partman/choose_partition select finish 39 | d-i partman-auto-lvm/guided_size string max 40 | d-i partman-auto/choose_recipe select atomic 41 | d-i partman/default_filesystem string ext3 42 | d-i partman/confirm_wirte_new_label boolean true 43 | d-i partman/confirm boolean true 44 | d-i partman/confirm_nooverwrite boolean true 45 | # Scan another CD or DVD? 46 | apt-cdrom-setup apt-setup/cdrom/set-first boolean false 47 | # Package mirror 48 | d-i mirror/country string manual 49 | d-i mirror/http/hostname string http.debian.net 50 | d-i mirror/http/directory string /debian 51 | d-i mirror/http/proxy string 52 | d-i apt-setup/use_mirror boolean true 53 | # Don't send reports back to the project 54 | popularity-contest popularity-contest/participate boolean false 55 | # Package selection 56 | tasksel tasksel/first multiselect standard 57 | # Automatically install grub to the MBR 58 | d-i grub-installer/only_debian boolean true 59 | # Turn off last message about the install being complete 60 | d-i finish-install/reboot_in_progress note 61 | d-i pkgsel/include string openssh-server ntp curl nfs-common linux-headers-$(uname -r) build-essential perl dkms 62 | # This first command is run as early as possible, just after 63 | # preseeding is read. 64 | # Prevent packaged version of VirtualBox Guest Additions being installed: 65 | d-i preseed/early_command string sed -i \ 66 | '/in-target/idiscover(){/sbin/discover|grep -v VirtualBox;}' \ 67 | /usr/lib/pre-pkgsel.d/20install-hwpackages 68 | -------------------------------------------------------------------------------- /script/cleanup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eux 2 | 3 | # Make sure Udev doesn't block our network 4 | # http://6.ptmc.org/?p=164 5 | echo "cleaning up udev rules" 6 | rm -rf /dev/.udev/ 7 | # Better fix that persists package updates: http://serverfault.com/a/485689 8 | touch /etc/udev/rules.d/75-persistent-net-generator.rules 9 | 10 | echo "==> Cleaning up leftover dhcp leases" 11 | if [ -d "/var/lib/dhcp" ]; then 12 | rm /var/lib/dhcp/* 13 | fi 14 | 15 | echo "==> Cleaning up tmp" 16 | rm -rf /tmp/* 17 | 18 | # Cleanup apt cache 19 | apt-get -y autoremove --purge 20 | apt-get -y clean 21 | apt-get -y autoclean 22 | 23 | echo "==> Installed packages" 24 | dpkg --get-selections | grep -v deinstall 25 | 26 | DISK_USAGE_BEFORE_CLEANUP=$(df -h) 27 | 28 | # Remove Bash history 29 | unset HISTFILE 30 | rm -f /root/.bash_history 31 | rm -f /home/vagrant/.bash_history 32 | 33 | # Clean up log files 34 | find /var/log -type f | while read f; do echo -ne '' > $f; done; 35 | 36 | echo "==> Clearing last login information" 37 | >/var/log/lastlog 38 | >/var/log/wtmp 39 | >/var/log/btmp 40 | 41 | # Whiteout root 42 | echo '==> Clear out root fs' 43 | count=$(df --sync -kP / | tail -n1 | awk -F ' ' '{print $4}') 44 | let count-- 45 | dd if=/dev/zero of=/tmp/whitespace bs=1024 count=$count 46 | rm /tmp/whitespace 47 | 48 | # Whiteout /boot 49 | echo '==> Clear out /boot' 50 | count=$(df --sync -kP /boot | tail -n1 | awk -F ' ' '{print $4}') 51 | let count-- 52 | dd if=/dev/zero of=/boot/whitespace bs=1024 count=$count 53 | rm /boot/whitespace 54 | 55 | echo '==> Clear out swap and disable until reboot' 56 | set +e 57 | swapuuid=$(/sbin/blkid -o value -l -s UUID -t TYPE=swap) 58 | case "$?" in 59 | 2|0) ;; 60 | *) exit 1 ;; 61 | esac 62 | set -e 63 | if [ "x${swapuuid}" != "x" ]; then 64 | # Whiteout the swap partition to reduce box size 65 | # Swap is disabled till reboot 66 | swappart=$(readlink -f /dev/disk/by-uuid/$swapuuid) 67 | /sbin/swapoff "${swappart}" 68 | dd if=/dev/zero of="${swappart}" bs=1M || echo "dd exit code $? is suppressed" 69 | /sbin/mkswap -U "${swapuuid}" "${swappart}" 70 | fi 71 | 72 | # Make sure we wait until all the data is written to disk, otherwise 73 | # Packer might quite too early 74 | sync 75 | 76 | echo "==> Disk usage before cleanup" 77 | echo ${DISK_USAGE_BEFORE_CLEANUP} 78 | 79 | echo "==> Disk usage after cleanup" 80 | df -h 81 | -------------------------------------------------------------------------------- /script/desktop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ ! "$DESKTOP" =~ ^(true|yes|on|1|TRUE|YES|ON])$ ]]; then 4 | exit 5 | fi 6 | 7 | apt-get install -y task-gnome-desktop 8 | 9 | # just in case the previous command failed to download all packages do it again 10 | apt-get install -y task-gnome-desktop 11 | 12 | GDM_CONFIG=/etc/gdm3/daemon.conf 13 | 14 | # Configure gdm autologin. 15 | 16 | if [ -f $GDM_CONFIG ]; then 17 | sed -i s/"daemon]$"/"daemon]\nAutomaticLoginEnable=true\nAutomaticLogin=vagrant"/ $GDM_CONFIG 18 | fi 19 | 20 | # Need to disable NetworkManager because it overwrites vagrant's 21 | # settings in /etc/resolv.conf with empty content in the first boot. 22 | # So, DNS doesn't work on the first boot. 23 | # 24 | # Maybe there is a better solution then disabling the service. 25 | systemctl disable NetworkManager.service 26 | 27 | echo "==> Removing desktop components" 28 | apt-get -y purge gnome-getting-started-docs 29 | apt-get -y purge $(dpkg --get-selections | grep -v deinstall | grep libreoffice | cut -f 1) 30 | -------------------------------------------------------------------------------- /script/minimize.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eux 2 | 3 | if [[ "$DESKTOP" =~ ^(true|yes|on|1|TRUE|YES|ON])$ ]]; then 4 | exit 5 | fi 6 | 7 | echo "==> Disk usage before minimization" 8 | df -h 9 | 10 | echo "==> Installed packages before cleanup" 11 | dpkg --get-selections | grep -v deinstall 12 | 13 | # Remove some packages to get a minimal install 14 | echo "==> Removing all linux kernels except the currrent one" 15 | dpkg --list | awk '{ print $2 }' | grep 'linux-image-3.*-generic' | grep -v $(uname -r) | xargs apt-get -y purge 16 | echo "==> Removing linux headers" 17 | dpkg --list | awk '{ print $2 }' | grep linux-headers | xargs apt-get -y purge 18 | rm -rf /usr/src/linux-headers* 19 | echo "==> Removing linux source" 20 | dpkg --list | awk '{ print $2 }' | grep linux-source | xargs apt-get -y purge 21 | echo "==> Removing development packages" 22 | dpkg --list | awk '{ print $2 }' | grep -- '-dev$' | xargs apt-get -y purge 23 | 24 | if [[ "$REMOVE_DOCS" =~ ^(true|yes|on|1|TRUE|YES|ON])$ ]]; then 25 | echo "==> Removing documentation" 26 | dpkg --list | awk '{ print $2 }' | grep -- '-doc$' | xargs apt-get -y purge 27 | fi 28 | 29 | apt-get -y purge build-essential 30 | echo "==> Removing X11 libraries" 31 | apt-get -y purge libx11-data xauth libxmuu1 libxcb1 libx11-6 libxext6 32 | echo "==> Removing desktop components" 33 | apt-get -y purge gnome-getting-started-docs 34 | apt-get -y purge $(dpkg --get-selections | grep -v deinstall | grep libreoffice | cut -f 1) 35 | echo "==> Removing obsolete networking components" 36 | apt-get -y purge ppp pppconfig pppoeconf 37 | echo "==> Removing other oddities" 38 | apt-get -y purge popularity-contest installation-report wireless-tools wpasupplicant 39 | echo "==> Removing default system Ruby" 40 | apt-get -y purge ruby ri doc libffi5 41 | echo "==> Removing default system Python" 42 | apt-get -y purge python-dbus libnl1 python-smartpm python-twisted-core libiw30 python-twisted-bin libdbus-glib-1-2 python-pexpect python-pycurl python-serial python-gobject python-pam python-openssl 43 | 44 | # Clean up the apt cache 45 | echo "==> Cleaning up the apt cache" 46 | apt-get -y autoremove --purge 47 | apt-get -y autoclean 48 | apt-get -y clean 49 | 50 | echo "==> Removing APT files" 51 | find /var/lib/apt -type f -delete 52 | 53 | if [[ "$REMOVE_DOCS" =~ ^(true|yes|on|1|TRUE|YES|ON])$ ]]; then 54 | echo "==> Removing man pages" 55 | find /usr/share/man -type f -delete 56 | echo "==> Removing any docs" 57 | find /usr/share/doc -type f -delete 58 | echo "==> Removing info" 59 | rm -rf /usr/share/info/* 60 | fi 61 | 62 | echo "==> Removing caches" 63 | find /var/cache -type f -delete 64 | echo "==> Removing lintian linda" 65 | rm -rf /usr/share/lintian/* /usr/share/linda/* 66 | 67 | echo "==> Disk usage after cleanup" 68 | df -h 69 | -------------------------------------------------------------------------------- /script/motd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eux 2 | 3 | echo "==> Recording box generation date" 4 | date > /etc/vagrant_box_build_date 5 | 6 | echo "==> Customizing message of the day" 7 | MOTD_FILE=/etc/motd 8 | BANNER_WIDTH=64 9 | PLATFORM_RELEASE=$(lsb_release -sd) 10 | PLATFORM_MSG=$(printf '%s' "$PLATFORM_RELEASE") 11 | BUILT_MSG=$(printf 'built %s' $(date +%Y-%m-%d)) 12 | printf '%0.1s' "-"{1..64} > ${MOTD_FILE} 13 | printf '\n' >> ${MOTD_FILE} 14 | printf '%2s%-30s%30s\n' " " "${PLATFORM_MSG}" "${BUILT_MSG}" >> ${MOTD_FILE} 15 | printf '%0.1s' "-"{1..64} >> ${MOTD_FILE} 16 | printf '\n' >> ${MOTD_FILE} 17 | -------------------------------------------------------------------------------- /script/parallels.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eux 2 | 3 | SSH_USER=${SSH_USERNAME:-vagrant} 4 | 5 | if [[ $PACKER_BUILDER_TYPE =~ parallels ]]; then 6 | echo "==> Installing Parallels tools" 7 | mount -o loop /home/${SSH_USER}/prl-tools-lin.iso /mnt 8 | /mnt/install --install-unattended-with-deps 9 | umount /mnt 10 | rm -rf /home/${SSH_USER}/prl-tools-lin.iso 11 | rm -f /home/${SSH_USER}/.prlctl_version 12 | fi 13 | -------------------------------------------------------------------------------- /script/remove-cdrom-sources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eux 2 | 3 | echo "==> Disabling CDROM entries to avoid prompts to insert a disk" 4 | sed -i "/^deb cdrom:/s/^/#/" /etc/apt/sources.list 5 | -------------------------------------------------------------------------------- /script/systemd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -eux 2 | 3 | if dpkg-query -W -f='${Status}' systemd 2>/dev/null | cut -f 3 -d ' ' | grep -q '^installed$'; then 4 | echo "==> Installing PAM module for systemd to prevent Vagrant/SSH hangs" 5 | apt-get -y install libpam-systemd 6 | fi 7 | -------------------------------------------------------------------------------- /script/update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eux 2 | 3 | if [[ $UPDATE =~ true || $UPDATE =~ 1 || $UPDATE =~ yes ]]; then 4 | echo "==> Updating list of repositories" 5 | # apt-get update does not actually perform updates, it just downloads and indexes the list of packages 6 | apt-get -y update 7 | 8 | echo "==> Performing dist-upgrade (all packages and kernel)" 9 | apt-get -y dist-upgrade --force-yes 10 | ifdown --all 11 | shutdown -r now 12 | fi 13 | -------------------------------------------------------------------------------- /script/vagrant.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eux 2 | 3 | echo '==> Configuring settings for vagrant' 4 | 5 | SSH_USERNAME=${SSH_USERNAME:-vagrant} 6 | SSH_USER_HOME=${SSH_USER_HOME:-/home/${SSH_USER}} 7 | VAGRANT_INSECURE_KEY="ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key" 8 | 9 | # Add vagrant user (if it doesn't already exist) 10 | if ! id -u $SSH_USERNAME >/dev/null 2>&1; then 11 | echo '==> Creating Vagrant user' 12 | /usr/sbin/groupadd $SSH_USERNAME 13 | /usr/sbin/useradd $SSH_USERNAME -g $SSH_USERNAME -G sudo -d $SSH_USER_HOME --create-home 14 | echo "${SSH_USERNAME}:${SSH_USERNAME}" | chpasswd 15 | fi 16 | 17 | # Set up sudo. Be careful to set permission BEFORE copying file to sudoers.d 18 | ( cat < /tmp/vagrant 22 | chmod 0440 /tmp/vagrant 23 | mv /tmp/vagrant /etc/sudoers.d/ 24 | 25 | # Packer passes boolean user variables through as '1', but this might change in 26 | # the future, so also check for 'true'. 27 | if [ "$INSTALL_VAGRANT_KEY" = "true" ] || [ "$INSTALL_VAGRANT_KEY" = "1" ]; then 28 | echo '==> Installing Vagrant SSH key' 29 | mkdir -pm 700 $SSH_USER_HOME/.ssh 30 | # https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub 31 | echo "${VAGRANT_INSECURE_KEY}" > $SSH_USER_HOME/.ssh/authorized_keys 32 | chmod 600 $SSH_USER_HOME/.ssh/authorized_keys 33 | chown -R $SSH_USER:$SSH_USER $SSH_USER_HOME/.ssh 34 | fi 35 | -------------------------------------------------------------------------------- /script/virtualbox.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eux 2 | 3 | if [[ $PACKER_BUILDER_TYPE =~ virtualbox ]]; then 4 | echo "==> Installing VirtualBox guest additions" 5 | apt-get install -y linux-headers-$(uname -r) build-essential perl 6 | apt-get install -y dkms 7 | 8 | VBOX_VERSION=$(cat /home/vagrant/.vbox_version) 9 | mount -o loop /home/vagrant/VBoxGuestAdditions_${VBOX_VERSION}.iso /mnt 10 | sh /mnt/VBoxLinuxAdditions.run --nox11 11 | umount /mnt 12 | rm /home/vagrant/VBoxGuestAdditions_${VBOX_VERSION}.iso 13 | rm /home/vagrant/.vbox_version 14 | fi 15 | -------------------------------------------------------------------------------- /script/vmware.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eux 2 | 3 | SSH_USERNAME=${SSH_USERNAME:-vagrant} 4 | 5 | if [[ $PACKER_BUILDER_TYPE =~ vmware ]]; then 6 | echo "==> Installing VMware Tools" 7 | apt-get install -y linux-headers-$(uname -r) build-essential perl 8 | 9 | cd /tmp 10 | mkdir -p /mnt/cdrom 11 | mount -o loop /home/vagrant/linux.iso /mnt/cdrom 12 | 13 | VMWARE_TOOLS_PATH=$(ls /mnt/cdrom/VMwareTools-*.tar.gz) 14 | VMWARE_TOOLS_VERSION=$(echo "${VMWARE_TOOLS_PATH}" | cut -f2 -d'-') 15 | VMWARE_TOOLS_BUILD=$(echo "${VMWARE_TOOLS_PATH}" | cut -f3 -d'-') 16 | VMWARE_TOOLS_BUILD=$(basename ${VMWARE_TOOLS_BUILD} .tar.gz) 17 | echo "==> VMware Tools Path: ${VMWARE_TOOLS_PATH}" 18 | echo "==> VMware Tools Version: ${VMWARE_TOOLS_VERSION}" 19 | echo "==> VMWare Tools Build: ${VMWARE_TOOLS_BUILD}" 20 | 21 | tar zxf /mnt/cdrom/VMwareTools-*.tar.gz -C /tmp/ 22 | VMWARE_TOOLS_MAJOR_VERSION=$(echo ${VMWARE_TOOLS_VERSION} | cut -d '.' -f 1) 23 | if [ "${VMWARE_TOOLS_MAJOR_VERSION}" -lt "10" ]; then 24 | /tmp/vmware-tools-distrib/vmware-install.pl -d 25 | else 26 | /tmp/vmware-tools-distrib/vmware-install.pl --force-install 27 | fi 28 | 29 | rm /home/${SSH_USERNAME}/linux.iso 30 | umount /mnt/cdrom 31 | rmdir /mnt/cdrom 32 | rm -rf /tmp/VMwareTools-* 33 | fi 34 | -------------------------------------------------------------------------------- /test/debian_spec.rb: -------------------------------------------------------------------------------- 1 | require_relative 'spec_helper' 2 | 3 | describe 'box' do 4 | it 'should have a root user' do 5 | expect(user 'root').to exist 6 | end 7 | 8 | has_docker = command('command -v docker').exit_status == 0 9 | it 'should make vagrant a member of the docker group', :if => has_docker do 10 | expect(user 'vagrant').to belong_to_group 'docker' 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /test/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | require 'net/ssh' 3 | 4 | set :backend, :ssh 5 | -------------------------------------------------------------------------------- /tpl/vagrantfile-debian-desktop.tpl: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | Vagrant.configure("2") do |config| 5 | config.vm.define "vagrant-ubuntu1404-desktop" 6 | config.vm.box = "ubuntu1404-desktop" 7 | 8 | config.vm.provider :virtualbox do |v, override| 9 | v.gui = true 10 | v.customize ["modifyvm", :id, "--memory", 1024] 11 | v.customize ["modifyvm", :id, "--cpus", 1] 12 | v.customize ["modifyvm", :id, "--vram", "256"] 13 | v.customize ["setextradata", "global", "GUI/MaxGuestResolution", "any"] 14 | v.customize ["setextradata", :id, "CustomVideoMode1", "1024x768x32"] 15 | v.customize ["modifyvm", :id, "--ioapic", "on"] 16 | v.customize ["modifyvm", :id, "--rtcuseutc", "on"] 17 | v.customize ["modifyvm", :id, "--accelerate3d", "on"] 18 | v.customize ["modifyvm", :id, "--clipboard", "bidirectional"] 19 | end 20 | 21 | ["vmware_fusion", "vmware_workstation"].each do |provider| 22 | config.vm.provider provider do |v, override| 23 | v.gui = true 24 | v.vmx["memsize"] = "1024" 25 | v.vmx["numvcpus"] = "1" 26 | v.vmx["cpuid.coresPerSocket"] = "1" 27 | v.vmx["ethernet0.virtualDev"] = "vmxnet3" 28 | v.vmx["RemoteDisplay.vnc.enabled"] = "false" 29 | v.vmx["RemoteDisplay.vnc.port"] = "5900" 30 | v.vmx["scsi0.virtualDev"] = "lsilogic" 31 | v.vmx["mks.enable3d"] = "TRUE" 32 | end 33 | end 34 | end 35 | --------------------------------------------------------------------------------