Skip to content

Commit

Permalink
Draft of 16.04 support
Browse files Browse the repository at this point in the history
  • Loading branch information
NSkelsey committed Oct 28, 2016
1 parent c0f3761 commit 116e64c
Show file tree
Hide file tree
Showing 4 changed files with 180 additions and 63 deletions.
13 changes: 12 additions & 1 deletion appliance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ Planned methods:


### Ubuntu 14.04

On your local machine:

```bash
> /path/to/packer build templates/ubuntu-14.04/template.json
> packer build templates/ubuntu-14.04/template.json
> vagrant init
> vagrant add box --name=gl-ubuntu-14.04 dist/packer_virtualbox_globaleaks-ubuntu-14.04.box
# Name box, edit Vagrant file add ip=191.168.33.10
> vagrant up
# Check everything is working
Expand All @@ -55,3 +57,12 @@ On your local machine:
> ./node_modules/protractor/bin/protractor --baseUrl http://191.168.33.10:8082 tests/end2end/protractor-coverage.config.js
```

### Ubuntu 16.04

```bash
# reterieve or create the globaleaks debian package you intend to install
# place it in
> cp path/to/gl.deb templates/ubuntu-16.04/http/
> packer build templates/ubuntu-16.04/template.json
> # blocked on line: [y-n] cond of templates/ubuntu-16.04/virtualbox.sh mnt iso
```
63 changes: 63 additions & 0 deletions appliance/templates/ubuntu-16.04/http/preseed.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# The Source of this file is from:
# - https://github.com/kaorimatz/packer-templates/blob/master/http/ubuntu/preseed.cfg
# - https://github.com/kaorimatz/packer-templates/tree/master/http/ubuntu-16.04/preseed.cfg

d-i debian-installer/locale string en_US
d-i time/zone string UTC

d-i keyboard-configuration/xkb-keymap select us

d-i partman-auto/method string regular
d-i partman-auto/expert_recipe string \
scheme :: \
200 0 200 ext4 \
$primary{ } \
$bootable{ } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ /boot } . \
200% 0 200% linux-swap \
$primary{ } \
method{ swap } \
format{ } . \
1 0 -1 ext4 \
$primary{ } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ / } .
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true

d-i base-installer/excludes string laptop-detect

d-i passwd/root-password-again password vagrant
d-i passwd/root-password password vagrant
d-i passwd/user-fullname string vagrant
d-i passwd/username string vagrant
d-i passwd/user-password password vagrant
d-i passwd/user-password-again password vagrant
d-i user-setup/allow-password-weak boolean true

d-i pkgsel/include string curl openssh-server sudo
d-i pkgsel/language-packs multiselect

d-i finish-install/reboot_in_progress note

d-i preseed/early_command string \
mkdir -p /usr/lib/post-base-installer.d && \
echo "sed -i -e 's/^in-target.*tasksel.*/#\\0/' /var/lib/dpkg/info/pkgsel.postinst" > /usr/lib/post-base-installer.d/90skip-tasksel && \
chmod +x /usr/lib/post-base-installer.d/90skip-tasksel

d-i preseed/late_command string \
echo 'Defaults:vagrant !requiretty' > /target/etc/sudoers.d/vagrant; \
echo 'vagrant ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers.d/vagrant; \
chmod 440 /target/etc/sudoers.d/vagrant; \
ln -sf /dev/null /target/etc/systemd/network/99-default.link; \
in-target update-initramfs -u

142 changes: 80 additions & 62 deletions appliance/templates/ubuntu-16.04/template.json
Original file line number Diff line number Diff line change
@@ -1,66 +1,84 @@
{
"variables": {
"machine_name": "globaleaks-ubuntu-16.04"
},

"builders": [
{
"type": "virtualbox-iso",
"iso_url": "http://cdimage.ubuntu.com/daily-live/current/xenial-desktop-amd64.iso",
"iso_checksum": "weekly",
"iso_checksum_type": "none",
"guest_os_type": "Ubuntu_64",
"guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso",
"http_directory": "http",
"shutdown_command": "echo 'vagrant' | sudo -S shutdown -P now",
"virtualbox_version_file": ".vbox_version",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"ssh_wait_timeout": "20m",
"output_directory": "../../../dist/{{user `machine_name`}}",
"vm_name": "{{user `machine_name`}}",
"boot_wait": "5s",
"boot_command": [
"<esc><esc><enter><wait>",
"/install/vmlinuz noapic preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ",
"debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
"hostname={{ .Name }} ",
"fb=false debconf/frontend=noninteractive ",
"keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA keyboard-configuration/variant=USA console-setup/ask_detect=false ",
"initrd=/install/initrd.gz -- <enter>"
]
}
],

"provisioners": [
{
"type": "shell",
"scripts": [
"../../scripts/vagrant.sh",
"../../scripts/virtualbox.sh"
],
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S '{{.Path}}'"
},
{
"type": "file",
"source": "../../data",
"destination": "/data/globaleaks"
},
{
"type": "shell",
"scripts": [
"../../scripts/globaleaks.sh",
"../../scripts/cleanup.sh",
"../../scripts/zerodisk.sh"
],
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S '{{.Path}}'"
}
"builders": [{
"type": "virtualbox-iso",
"guest_os_type": "Ubuntu_64",
"iso_url": "{{user `mirror`}}/16.04/ubuntu-16.04.1-server-amd64.iso",
"iso_checksum": "{{user `iso_checksum`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"output_directory": "../../../dist/{{user `machine_name`}}",
"vm_name": "packer-ubuntu-16.04-amd64",
"disk_size": "{{user `disk_size`}}",
"headless": "{{user `headless`}}",
"http_directory": "http",
"boot_wait": "5s",
"boot_command": [
"<enter><wait>",
"<f6><esc>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs>",
"/install/vmlinuz ",
"initrd=/install/initrd.gz ",
"net.ifnames=0 ",
"auto-install/enable=true ",
"debconf/priority=critical ",
"preseed/url=http://{{.HTTPIP}}:{{.HTTPPort}}/preseed.cfg ",
"<enter>"
],

"post-processors": [
{
"type": "vagrant",
"output": "../../dist/packer_{{.Provider}}_{{user `machine_name`}}.box"
}
"ssh_timeout": "{{user `ssh_timeout`}}",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"shutdown_command": "sudo systemctl poweroff",
"vboxmanage": [
["modifyvm", "{{.Name}}", "--memory", "{{user `memory`}}"],
["modifyvm", "{{.Name}}", "--cpus", "{{user `cpus`}}"]
]
}],
"provisioners": [
{
"type": "shell",
"scripts": [
"../../scripts/vagrant.sh",
"virtualbox.sh"
],
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S '{{.Path}}'"
},
{
"type": "file",
"source": "../../data",
"destination": "/data/globaleaks"
},
{
"type": "shell",
"scripts": [
"../../scripts/globaleaks.sh",
"../../scripts/cleanup.sh",
"../../scripts/zerodisk.sh"
],
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S '{{.Path}}'"
}
],
"post-processors": [{
"type": "vagrant",
"compression_level": "{{user `compression_level`}}",
"output": "../../dist/packer_{{.Provider}}_{{ user `machine_name`}}.box"
}],
"variables": {
"machine_name": "globaleaks-ubuntu-16.04",
"compression_level": "6",
"cpus": "1",
"disk_size": "10240",
"headless": "false",
"iso_checksum": "29a8b9009509b39d542ecb229787cdf48f05e739a932289de9e9858d7c487c80",
"iso_checksum_type": "sha256",
"memory": "512",
"mirror": "http://releases.ubuntu.com",
"ssh_timeout": "60m"
}
}
25 changes: 25 additions & 0 deletions appliance/templates/ubuntu-16.04/virtualbox.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

set -e
set -x

if [ "$PACKER_BUILDER_TYPE" != "virtualbox-iso" ]; then
exit 0
fi

sudo apt-get -y install dkms
sudo apt-get -y install make

# Uncomment this if you want to install Guest Additions with support for X
#sudo apt-get -y install xserver-xorg

sudo mount -o loop,ro ~/VBoxGuestAdditions.iso /mnt/
sudo /mnt/VBoxLinuxAdditions.run || :
sudo umount /mnt/
rm -f ~/VBoxGuestAdditions.iso

VBOX_VERSION=$(cat ~/.vbox_version)
if [ "$VBOX_VERSION" == '4.3.10' ]; then
# https://www.virtualbox.org/ticket/12879
sudo ln -s "/opt/VBoxGuestAdditions-$VBOX_VERSION/lib/VBoxGuestAdditions" /usr/lib/VBoxGuestAdditions
fi

0 comments on commit 116e64c

Please sign in to comment.