-
-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
180 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |