Skip to content

Commit 81dfc4f

Browse files
committed
Added Packer & Vagrant stuff
1 parent 9f11d74 commit 81dfc4f

File tree

8 files changed

+518
-0
lines changed

8 files changed

+518
-0
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.box
2+
output-virtualbox-iso/
3+
packer_cache/
4+
.vagrant/

Makefile

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.PHONY: all clean jessie32 jessie64 up packer
2+
3+
all: clean build up
4+
5+
jessie32 jessie64:
6+
@cd debian && \
7+
packer build debian-$@.json && \
8+
vagrant box remove $@ && \
9+
vagrant box add $@ && \
10+
vagrant up $@
11+
12+
up:
13+
vagrant destroy -f && vagrant box remove vagrant_machine && vagrant up || vagrant box remove vagrant_machine && vagrant up || vagrant up
14+
15+
clean:
16+
rm ./packer-debian-stable.box && rm -rf ./packer_cache && vagrant destroy -f && vagrant box remove vagrant_machine || true
17+
18+
packer:
19+
@if [ ! -w /usr/local/bin ]; then \
20+
echo "\nInsufficient permission to write to /usr/local/bin. Try su or sudo.\n"; \
21+
false; \
22+
fi
23+
@cd /usr/local/bin && \
24+
wget --continue --output-document=/tmp/packer.zip \
25+
https://dl.bintray.com/mitchellh/packer/packer_0.7.5_linux_amd64.zip && \
26+
unzip /tmp/packer.zip

debian/Vagrantfile

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5+
VAGRANTFILE_API_VERSION = "2"
6+
7+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
8+
# Documentation at vagrantup.com.
9+
10+
config.vm.box = "jessie64.box"
11+
config.vm.synced_folder "otter-builds", "/home/vagrant/otter-build"
12+
13+
#config.vm.provision :shell, :path => "scripts/bootstrap.sh"
14+
# Call with: BUILD_DEB_ARGS='-s test' vagrant provision
15+
# The single quotes are important.
16+
config.vm.provision :shell, :path => "scripts/build-otter-deb.sh", args: ENV['BUILD_DEB_ARGS']
17+
18+
config.vm.provider "virtualbox" do |v|
19+
v.cpus = 2
20+
end
21+
end

debian/debian-jessie64.json

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"builders": [
3+
{
4+
"boot_command": [
5+
"<esc><wait>",
6+
"install <wait>",
7+
"preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg <wait>",
8+
"debian-installer=en_US <wait>",
9+
"auto <wait>",
10+
"locale=en_US <wait>",
11+
"kbd-chooser/method=us <wait>",
12+
"netcfg/get_hostname={{ .Name }} <wait>",
13+
"netcfg/get_domain=vagrantup.com <wait>",
14+
"fb=false <wait>",
15+
"debconf/frontend=noninteractive <wait>",
16+
"console-setup/ask_detect=false <wait>",
17+
"console-keymaps-at/keymap=us <wait>",
18+
"keyboard-configuration/xkb-keymap=us <wait>",
19+
"<enter><wait>"
20+
],
21+
"headless": false,
22+
"disk_size": 10140,
23+
"guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso",
24+
"guest_os_type": "Debian_64",
25+
"http_directory": "http",
26+
"iso_checksum": "57502e731b81dd243ec3acdc1528601ddcc3e0a7b91934052844b27db16cfea865d1380edfc4da21d60be7fe9997abea6d236baa85ce748b8f6381341d6fd81c",
27+
"iso_checksum_type": "sha512",
28+
"iso_url": "http://cdimage.debian.org/cdimage/jessie_di_beta_2/amd64/iso-cd/debian-jessie-DI-b2-amd64-netinst.iso",
29+
"iso_checksum": "eebd4b1140986592fd1e05f2af8f60241384deb626850f48dd55f7a59bee9e51e5cbf1863e1807aa8d8be2163c854b168966b613517b7db020100a4fe01a301f",
30+
"iso_checksum_type": "sha512",
31+
"iso_url": "http://cdimage.debian.org/cdimage/jessie_di_beta_1/amd64/iso-cd/debian-jessie-DI-b1-amd64-netinst.iso",
32+
"shutdown_command": "echo 'vagrant'|sudo -S /sbin/shutdown -hP now",
33+
"ssh_password": "vagrant",
34+
"ssh_port": 22,
35+
"ssh_username": "vagrant",
36+
"ssh_wait_timeout": "10000s",
37+
"type": "virtualbox-iso",
38+
"vm_name": "debian-8-amd64",
39+
"vboxmanage": [
40+
["modifyvm", "{{.Name}}", "--memory", "256"],
41+
["modifyvm", "{{.Name}}", "--cpus", "2"]
42+
]
43+
}],
44+
"post-processors": [
45+
{
46+
"output": "jessie64.box",
47+
"type": "vagrant"
48+
}],
49+
"provisioners": [
50+
{
51+
"scripts": [
52+
"scripts/bootstrap.sh"
53+
],
54+
"type": "shell",
55+
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S bash '{{.Path}}'"
56+
}
57+
]
58+
}

debian/http/preseed.cfg

+221
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
#### Contents of the preconfiguration file (for wheezy)
2+
### Localization
3+
# Locale sets language and country.
4+
d-i debian-installer/locale string en_US
5+
6+
# Keyboard selection.
7+
#d-i keymap select us
8+
d-i keyboard-configuration/xkb-keymap select us
9+
10+
### Network configuration
11+
# netcfg will choose an interface that has link if possible. This makes it
12+
# skip displaying a list if there is more than one interface.
13+
d-i netcfg/choose_interface select auto
14+
d-i netcfg/get_domain string vagrantup.com
15+
16+
### Mirror settings
17+
# If you select ftp, the mirror/country string does not need to be set.
18+
#d-i mirror/protocol string ftp
19+
d-i mirror/country string manual
20+
d-i mirror/http/hostname string http.us.debian.org
21+
d-i mirror/http/directory string /debian
22+
d-i mirror/http/proxy string
23+
24+
# Suite to install.
25+
#d-i mirror/suite string testing
26+
# Suite to use for loading installer components (optional).
27+
#d-i mirror/udeb/suite string testing
28+
29+
### Clock and time zone setup
30+
# Controls whether or not the hardware clock is set to UTC.
31+
d-i clock-setup/utc boolean true
32+
33+
# You may set this to any valid setting for $TZ; see the contents of
34+
# /usr/share/zoneinfo/ for valid values.
35+
d-i time/zone string UTC
36+
37+
# Controls whether to use NTP to set the clock during the install
38+
d-i clock-setup/ntp boolean true
39+
40+
### Partitioning
41+
# If the system has free space you can choose to only partition that space.
42+
#d-i partman-auto/init_automatically_partition select biggest_free
43+
44+
# Alternatively, you can specify a disk to partition. The device name must
45+
# be given in traditional non-devfs format.
46+
# Note: A disk must be specified, unless the system has only one disk.
47+
# For example, to use the first SCSI/SATA hard disk:
48+
#d-i partman-auto/disk string /dev/sda
49+
# In addition, you'll need to specify the method to use.
50+
# The presently available methods are: "regular", "lvm" and "crypto"
51+
d-i partman-auto/method string lvm
52+
53+
# If one of the disks that are going to be automatically partitioned
54+
# contains an old LVM configuration, the user will normally receive a
55+
# warning. This can be preseeded away...
56+
d-i partman-lvm/device_remove_lvm boolean true
57+
# The same applies to pre-existing software RAID array:
58+
d-i partman-md/device_remove_md boolean true
59+
60+
# And the same goes for the confirmation to write the lvm partitions.
61+
d-i partman-lvm/confirm boolean true
62+
d-i partman-lvm/confirm_nooverwrite boolean true
63+
64+
d-i partman/choose_partition select finish
65+
d-i partman-auto-lvm/guided_size string max
66+
67+
# You can choose one of the three predefined partitioning recipes:
68+
# - atomic: all files in one partition
69+
# - home: separate /home partition
70+
# - multi: separate /home, /usr, /var, and /tmp partitions
71+
d-i partman-auto/choose_recipe select atomic
72+
d-i partman/default_filesystem string ext4
73+
74+
#The preseed line that "selects finish" needs to be in a certain order in your preseed, the example-preseed does not follow this.
75+
#http://ubuntuforums.org/archive/index.php/t-1504045.html
76+
77+
# This makes partman automatically partition without confirmation, provided
78+
# that you told it what to do using one of the methods above.
79+
d-i partman/confirm_write_new_label boolean true
80+
d-i partman/confirm boolean true
81+
d-i partman/confirm_nooverwrite boolean true
82+
83+
84+
### Base system installation
85+
# Select the initramfs generator used to generate the initrd for 2.6 kernels.
86+
#d-i base-installer/kernel/linux/initramfs-generators string yaird
87+
88+
# The kernel image (meta) package to be installed; "none" can be used if no
89+
# kernel is to be installed.
90+
#d-i base-installer/kernel/image string linux-image-2.6-486
91+
92+
### Account setup
93+
# Skip creation of a root account (normal user account will be able to
94+
# use sudo).
95+
d-i passwd/root-login boolean false
96+
# Alternatively, to skip creation of a normal user account.
97+
#d-i passwd/make-user boolean false
98+
99+
# Root password, either in clear text
100+
d-i passwd/root-password password vagrant
101+
d-i passwd/root-password-again password vagrant
102+
# or encrypted using an MD5 hash.
103+
#d-i passwd/root-password-crypted password [MD5 hash]
104+
105+
# To create a normal user account.
106+
d-i passwd/user-fullname string Vagrant User
107+
d-i passwd/username string vagrant
108+
# Normal user's password, either in clear text
109+
d-i passwd/user-password password vagrant
110+
d-i passwd/user-password-again password vagrant
111+
# or encrypted using an MD5 hash.
112+
#d-i passwd/user-password-crypted password [MD5 hash]
113+
# Create the first user with the specified UID instead of the default.
114+
#d-i passwd/user-uid string 1010
115+
d-i user-setup/encrypt-home boolean false
116+
d-i user-setup/allow-password-weak boolean true
117+
118+
# The user account will be added to some standard initial groups. To
119+
# override that, use this.
120+
d-i passwd/user-default-groups string audio cdrom video admin
121+
122+
### Apt setup
123+
# You can choose to install non-free and contrib software.
124+
#d-i apt-setup/non-free boolean true
125+
d-i apt-setup/contrib boolean true
126+
# Uncomment this if you don't want to use a network mirror.
127+
#d-i apt-setup/use_mirror boolean false
128+
# Select which update services to use; define the mirrors to be used.
129+
# Values shown below are the normal defaults.
130+
#d-i apt-setup/services-select multiselect security, volatile
131+
#d-i apt-setup/security_host string security.debian.org
132+
#d-i apt-setup/volatile_host string volatile.debian.org
133+
134+
135+
# By default the installer requires that repositories be authenticated
136+
# using a known gpg key. This setting can be used to disable that
137+
# authentication. Warning: Insecure, not recommended.
138+
#d-i debian-installer/allow_unauthenticated string true
139+
140+
### Package selection
141+
tasksel tasksel/first multiselect standard
142+
# If the desktop task is selected, install the kde and xfce desktops
143+
# instead of the default gnome desktop.
144+
#tasksel tasksel/desktop multiselect kde, xfce
145+
146+
# Individual additional packages to install
147+
d-i pkgsel/include string openssh-server virtualbox-guest-utils sudo git build-essential devscripts ccache cmake qtbase5-dev libqt5webkit5-dev qtdeclarative5-dev qtscript5-dev qtmultimedia5-dev
148+
149+
# Whether to upgrade packages after debootstrap.
150+
# Allowed values: none, safe-upgrade, full-upgrade
151+
d-i pkgsel/upgrade select full-upgrade
152+
153+
# Some versions of the installer can report back on what software you have
154+
# installed, and what software you use. The default is not to report back,
155+
# but sending reports helps the project determine what software is most
156+
# popular and include it on CDs.
157+
popularity-contest popularity-contest/participate boolean false
158+
159+
### Boot loader installation
160+
# This is fairly safe to set, it makes grub install automatically to the MBR
161+
# if no other operating system is detected on the machine.
162+
d-i grub-installer/only_debian boolean true
163+
164+
# This one makes grub-installer install to the MBR if it also finds some other
165+
# OS, which is less safe as it might not be able to boot that other OS.
166+
d-i grub-installer/with_other_os boolean true
167+
168+
# GRUB install devices:
169+
grub-pc grub-pc/install_devices multiselect /dev/sda
170+
# Choices: Enter device manually, /dev/sda
171+
grub-installer grub-installer/choose_bootdev select /dev/sda
172+
173+
### Finishing up the installation
174+
# During installations from serial console, the regular virtual consoles
175+
# (VT1-VT6) are normally disabled in /etc/inittab. Uncomment the next
176+
# line to prevent this.
177+
#d-i finish-install/keep-consoles boolean true
178+
179+
# Avoid that last message about the install being complete.
180+
d-i finish-install/reboot_in_progress note
181+
182+
# This will prevent the installer from ejecting the CD during the reboot,
183+
# which is useful in some situations.
184+
#d-i cdrom-detect/eject boolean false
185+
186+
# This is how to make the installer shutdown when finished, but not
187+
# reboot into the installed system.
188+
#d-i debian-installer/exit/halt boolean true
189+
# This will power off the machine instead of just halting it.
190+
#d-i debian-installer/exit/poweroff boolean true
191+
192+
### Preseeding other packages
193+
# Depending on what software you choose to install, or if things go wrong
194+
# during the installation process, it's possible that other questions may
195+
# be asked. You can preseed those too, of course. To get a list of every
196+
# possible question that could be asked during an install, do an
197+
# installation, and then run these commands:
198+
# debconf-get-selections --installer > file
199+
# debconf-get-selections >> file
200+
201+
202+
#### Advanced options
203+
### Running custom commands during the installation
204+
# d-i preseeding is inherently not secure. Nothing in the installer checks
205+
# for attempts at buffer overflows or other exploits of the values of a
206+
# preconfiguration file like this one. Only use preconfiguration files from
207+
# trusted locations! To drive that home, and because it's generally useful,
208+
# here's a way to run any shell command you'd like inside the installer,
209+
# automatically.
210+
211+
# This first command is run as early as possible, just after
212+
# preseeding is read.
213+
# Prevent packaged version of VirtualBox Guest Additions being installed:
214+
#d-i preseed/early_command string sed -i \
215+
# '/in-target/idiscover(){/sbin/discover|grep -v VirtualBox;}' \
216+
# /usr/lib/pre-pkgsel.d/20install-hwpackages
217+
218+
# This command is run just before the install finishes, but when there is
219+
# still a usable /target directory. You can chroot to /target and use it
220+
# directly, or use the apt-install and in-target commands to easily install
221+
# packages and run commands in the target system.

debian/otter-builds/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*

debian/scripts/bootstrap.sh

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
3+
#apt-get update
4+
#takes a long time
5+
#apt-get dist-upgrade -y
6+
7+
#apt-get install -y \
8+
# git \
9+
# build-essential devscripts ccache \
10+
# cmake qtbase5-dev libqt5webkit5-dev qtdeclarative5-dev qtscript5-dev qtmultimedia5-dev
11+
12+
#Install Vagrant ssh key
13+
#mkdir /home/vagrant/.ssh
14+
mkdir .ssh
15+
#wget -O /home/vagrant/.ssh/authorized_keys 'https://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub'
16+
wget -O .ssh/authorized_keys 'https://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub'
17+
#chown -R vagrant /home/vagrant/.ssh
18+
#chmod -R go-rwsx /home/vagrant/.ssh
19+
20+
# Set up sudo
21+
#grep -q 'secure_path' /etc/sudoers || sed -i -e '/Defaults\s\+env_reset/a Defaults\tsecure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"' /etc/sudoers
22+
#sed -i -e 's/^%sudo.*/%sudo ALL=(ALL) NOPASSWD: ALL/' /etc/sudoers
23+
echo 'vagrant ALL=NOPASSWD:ALL' > /etc/sudoers.d/vagrant
24+
25+
# Tweak sshd to prevent DNS resolution (speed up logins)
26+
echo "UseDNS no" >> /etc/ssh/sshd_config
27+
echo "GSSAPIAuthentication no" >> /etc/ssh/sshd_config
28+
29+
# Remove Grub timeout to speed up booting
30+
sed -i 's/GRUB_TIMEOUT=[0-9]\{,2\}/GRUB_TIMEOUT=0/' /etc/default/grub
31+
32+
update-grub

0 commit comments

Comments
 (0)