Skip to content

Commit

Permalink
Added 18.04 and made it default
Browse files Browse the repository at this point in the history
  • Loading branch information
fasmat committed Oct 30, 2018
1 parent 9de3ba5 commit 20d4764
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 56 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Howard Roark <howie@codingcoop.org>
Irving Popovetsky <irving@getchef.com>
Jonathan Oliver <jonathan.s.oliver42@gmail.com>
Lorenzo Villani <lvillani@develer.com>
Matthias Fasching <fasching.matthias@gmail.com>
Michael Leggles <beelzebutt@gmail.com>
Michael Stämpfli <michael.staempfli@gmail.com>
Mikhail Zholobov <legal90@gmail.com>
Expand Down
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ be installed as an additional preqrequisite.
We make use of JSON files containing user variables to build specific versions of Ubuntu.
You tell `packer` to use a specific user variable file via the `-var-file=` command line
option. This will override the default options on the core `ubuntu.json` packer template,
which builds Ubuntu 16.04 by default.
which builds Ubuntu 18.04 by default.

For example, to build Ubuntu 16.04, use the following:
For example, to build Ubuntu 18.04, use the following:

$ packer build -var-file=ubuntu1604.json ubuntu.json
$ packer build -var-file=ubuntu1804.json ubuntu.json

If you want to make boxes for a specific desktop virtualization platform, use the `-only`
parameter. For example, to build Ubuntu 16.04 for VirtualBox:
parameter. For example, to build Ubuntu 18.04 for VirtualBox:

$ packer build -only=virtualbox-iso -var-file=ubuntu1604.json ubuntu.json
$ packer build -only=virtualbox-iso -var-file=ubuntu1804.json ubuntu.json

The boxcutter templates currently support the following desktop virtualization strings:

Expand All @@ -41,13 +41,13 @@ The boxcutter templates currently support the following desktop virtualization s
## Building the Vagrant boxes with the box script

We've also provided a wrapper script `bin/box` for ease of use, so alternatively, you can use
the following to build Ubuntu 16.04 for all providers:
the following to build Ubuntu 18.04 for all providers:

$ bin/box build ubuntu1604
$ bin/box build ubuntu1804

Or if you just want to build Ubuntu 16.04 for VirtualBox:
Or if you just want to build Ubuntu 18.04 for VirtualBox:

$ bin/box build ubuntu1604 virtualbox
$ bin/box build ubuntu1804 virtualbox

## Building the Vagrant boxes with the Makefile

Expand Down Expand Up @@ -88,15 +88,15 @@ The `bin/box` script has subcommands for running both the automated tests
and for performing exploratory testing.

Use the `bin/box test` subcommand to run the automated Serverspec tests.
For example to execute the tests for the Ubuntu 14.04 box on VirtualBox, use
For example to execute the tests for the Ubuntu 18.04 box on VirtualBox, use
the following:

bin/box test ubuntu1604 virtualbox
bin/box test ubuntu1804 virtualbox

Similarly, to perform exploratory testing on the VirtualBox image via ssh,
run the following command:

bin/box ssh ubuntu1604 virtualbox
bin/box ssh ubuntu1804 virtualbox

### Variable overrides

Expand Down Expand Up @@ -141,9 +141,9 @@ The default is `custom-script.sh` which does nothing.

1. Fork and clone the repo.
2. Create a new branch, please don't work in your `master` branch directly.
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`).
4. Fix stuff. Use `make ssh` to interactively test your box (like `make ssh-virtualbox/ubuntu1404`).
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.
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/ubuntu1804`).
4. Fix stuff. Use `make ssh` to interactively test your box (like `make ssh-virtualbox/ubuntu1804`).
5. Run `make test` on a relevant template (like `make test-virtualbox/ubuntu1804`) to see if the tests pass. Repeat steps 3-5 until done.
6. Update `README.md` and `AUTHORS` to reflect any changes.
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).
8. Push to your fork and submit a pull request.
Expand Down
43 changes: 13 additions & 30 deletions script/desktop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,32 @@ fi

SSH_USER=${SSH_USERNAME:-vagrant}

configure_ubuntu1204_autologin()
{
USERNAME=${SSH_USER}
LIGHTDM_CONFIG=/etc/lightdm/lightdm.conf

echo "==> Configuring lightdm autologin"
if [ -f $LIGHTDM_CONFIG ]; then
echo "" >> $LIGHTDM_CONFIG
echo "autologin-user=${USERNAME}" >> $LIGHTDM_CONFIG
echo "autologin-user-timeout=0" >> $LIGHTDM_CONFIG
fi
}

echo "==> Checking version of Ubuntu"
. /etc/lsb-release

if [[ $DISTRIB_RELEASE == 12.04 ]]; then
echo "==> Installing ubuntu-desktop"
apt-get install -y ubuntu-desktop

configure_ubuntu1204_autologin
USERNAME=${SSH_USER}
LIGHTDM_CONFIG=/etc/lightdm/lightdm.conf
GDM_CUSTOM_CONFIG=/etc/gdm/custom.conf

elif [[ $DISTRIB_RELEASE == 14.04 || $DISTRIB_RELEASE == 15.04 || $DISTRIB_RELEASE == 16.04 || $DISTRIB_RELEASE == 16.10 || $DISTRIB_RELEASE == 17.04 ]]; then
echo "==> Installing ubuntu-desktop"
apt-get install -y ubuntu-desktop

USERNAME=${SSH_USER}
LIGHTDM_CONFIG=/etc/lightdm/lightdm.conf
GDM_CUSTOM_CONFIG=/etc/gdm/custom.conf

mkdir -p $(dirname ${GDM_CUSTOM_CONFIG})
echo "[daemon]" >> $GDM_CUSTOM_CONFIG
echo "# Enabling automatic login" >> $GDM_CUSTOM_CONFIG
echo "AutomaticLoginEnable=True" >> $GDM_CUSTOM_CONFIG
echo "AutomaticLoginEnable=${USERNAME}" >> $GDM_CUSTOM_CONFIG
mkdir -p $(dirname ${GDM_CUSTOM_CONFIG})
echo "[daemon]" >> $GDM_CUSTOM_CONFIG
echo "# Enabling automatic login" >> $GDM_CUSTOM_CONFIG
echo "AutomaticLoginEnable=True" >> $GDM_CUSTOM_CONFIG
echo "AutomaticLoginEnable=${USERNAME}" >> $GDM_CUSTOM_CONFIG

if [ -f $LIGHTDM_CONFIG ]; then
echo "==> Configuring lightdm autologin"
echo "[SeatDefaults]" >> $LIGHTDM_CONFIG
echo "autologin-user=${USERNAME}" >> $LIGHTDM_CONFIG
echo "autologin-user-timeout=0" >> $LIGHTDM_CONFIG
fi

if [ -d /etc/xdg/autostart/ ]; then
echo "==> Disabling screen blanking"
NODPMS_CONFIG=/etc/xdg/autostart/nodpms.desktop
NODPMS_CONFIG=/etc/xdg/autostart/nodpms.desktop
echo "[Desktop Entry]" >> $NODPMS_CONFIG
echo "Type=Application" >> $NODPMS_CONFIG
echo "Exec=xset -dpms s off s noblank s 0 0 s noexpose" >> $NODPMS_CONFIG
Expand All @@ -59,4 +43,3 @@ NODPMS_CONFIG=/etc/xdg/autostart/nodpms.desktop
echo "Comment[en_US]=" >> $NODPMS_CONFIG
echo "Comment=" >> $NODPMS_CONFIG
fi

3 changes: 1 addition & 2 deletions script/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ sed -i.bak 's/^Prompt=.*$/Prompt=never/' /etc/update-manager/release-upgrades
echo "==> Checking version of Ubuntu"
. /etc/lsb-release

if [[ $DISTRIB_RELEASE == 16.04 || $DISTRIB_RELEASE == 16.10 ]]; then
if [[ $DISTRIB_RELEASE == 16.04 || $DISTRIB_RELEASE == 18.04 ]]; then
echo "==> Disabling periodic apt upgrades"
echo 'APT::Periodic::Enable "0";' >> /etc/apt/apt.conf.d/10periodic
fi


echo "==> Updating list of repositories"
# apt-get update does not actually perform updates, it just downloads and indexes the list of packages
apt-get -y update
Expand Down
34 changes: 34 additions & 0 deletions tpl/vagrantfile-ubuntu1804-desktop.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
config.vm.define "vagrant-ubuntu1804-desktop"
config.vm.box = "ubuntu1804-desktop"

config.vm.provider :virtualbox do |v, override|
v.gui = true
v.customize ["modifyvm", :id, "--memory", 1024]
v.customize ["modifyvm", :id, "--cpus", 1]
v.customize ["modifyvm", :id, "--vram", "256"]
v.customize ["setextradata", "global", "GUI/MaxGuestResolution", "any"]
v.customize ["setextradata", :id, "CustomVideoMode1", "1024x768x32"]
v.customize ["modifyvm", :id, "--ioapic", "on"]
v.customize ["modifyvm", :id, "--rtcuseutc", "on"]
v.customize ["modifyvm", :id, "--accelerate3d", "on"]
v.customize ["modifyvm", :id, "--clipboard", "bidirectional"]
end

["vmware_fusion", "vmware_workstation"].each do |provider|
config.vm.provider provider do |v, override|
v.gui = true
v.vmx["memsize"] = "1024"
v.vmx["numvcpus"] = "1"
v.vmx["cpuid.coresPerSocket"] = "1"
v.vmx["ethernet0.virtualDev"] = "vmxnet3"
v.vmx["RemoteDisplay.vnc.enabled"] = "false"
v.vmx["RemoteDisplay.vnc.port"] = "5900"
v.vmx["scsi0.virtualDev"] = "lsilogic"
v.vmx["mks.enable3d"] = "TRUE"
end
end
end
10 changes: 5 additions & 5 deletions ubuntu.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
}
],
"variables": {
"boot_command_prefix": "<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>",
"boot_command_prefix": "<esc><esc><enter><wait>",
"cleanup_pause": "",
"cpus": "1",
"custom_script": "custom-script.sh",
Expand All @@ -203,11 +203,11 @@
"http_proxy": "{{env `http_proxy`}}",
"https_proxy": "{{env `https_proxy`}}",
"install_vagrant_key": "true",
"iso_checksum": "c94de1cc2e10160f325eb54638a5b5aa38f181d60ee33dae9578d96d932ee5f8",
"iso_checksum": "a5b0ea5918f850124f3d72ef4b85bda82f0fcd02ec721be19c1a6952791c8ee8",
"iso_checksum_type": "sha256",
"iso_name": "ubuntu-16.04.5-server-amd64.iso",
"iso_name": "ubuntu-18.04.1-server-amd64.iso",
"iso_path": "/Volumes/Storage/software/ubuntu",
"iso_url": "http://releases.ubuntu.com/16.04/ubuntu-16.04.5-server-amd64.iso",
"iso_url": "http://cdimage.ubuntu.com/ubuntu/releases/18.04/release/ubuntu-18.04.1-server-amd64.iso",
"locale": "en_US",
"memory": "512",
"no_proxy": "{{env `no_proxy`}}",
Expand All @@ -222,7 +222,7 @@
"vagrantfile_template": "",
"version": "0.1.0",
"virtualbox_guest_os_type": "Ubuntu_64",
"vm_name": "ubuntu1604",
"vm_name": "ubuntu1804",
"vmware_guest_os_type": "ubuntu-64"
}
}
3 changes: 2 additions & 1 deletion ubuntu1604-desktop.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
"iso_url": "http://releases.ubuntu.com/16.04/ubuntu-16.04.5-server-amd64.iso",
"memory": "1024",
"preseed": "preseed-desktop.cfg",
"vagrantfile_template": "tpl/vagrantfile-ubuntu1604-desktop.tpl"
"vagrantfile_template": "tpl/vagrantfile-ubuntu1604-desktop.tpl",
"boot_command_prefix": "<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>"
}
3 changes: 2 additions & 1 deletion ubuntu1604.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"iso_name": "ubuntu-16.04.5-server-amd64.iso",
"iso_url": "http://releases.ubuntu.com/16.04/ubuntu-16.04.5-server-amd64.iso",
"memory": "512",
"preseed" : "preseed.cfg"
"preseed" : "preseed.cfg",
"boot_command_prefix": "<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>"
}
15 changes: 15 additions & 0 deletions ubuntu1804-desktop.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"_comment": "Build with `packer build -var-file=ubuntu1804-desktop.json ubuntu.json`",
"vm_name": "ubuntu1804-desktop",
"desktop": "true",
"locale": "en_US.UTF-8",
"cpus": "1",
"disk_size": "130048",
"iso_checksum": "a5b0ea5918f850124f3d72ef4b85bda82f0fcd02ec721be19c1a6952791c8ee8",
"iso_checksum_type": "sha256",
"iso_name": "ubuntu-18.04.1-server-amd64.iso",
"iso_url": "http://cdimage.ubuntu.com/ubuntu/releases/18.04/release/ubuntu-18.04.1-server-amd64.iso",
"memory": "1024",
"preseed" : "preseed-desktop.cfg",
"vagrantfile_template": "tpl/vagrantfile-ubuntu1804-desktop.tpl"
}
3 changes: 1 addition & 2 deletions ubuntu1804.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@
"iso_name": "ubuntu-18.04.1-server-amd64.iso",
"iso_url": "http://cdimage.ubuntu.com/ubuntu/releases/18.04/release/ubuntu-18.04.1-server-amd64.iso",
"memory": "512",
"preseed" : "preseed.cfg",
"boot_command_prefix": "<esc><esc><enter><wait>"
"preseed" : "preseed.cfg"
}

0 comments on commit 20d4764

Please sign in to comment.