Skip to content

Commit 07790d0

Browse files
authored
Merge pull request #29 from Wenzel/ubuntu_desktop
Ubuntu desktop
2 parents c13fcef + e2657fe commit 07790d0

File tree

4 files changed

+46
-4
lines changed

4 files changed

+46
-4
lines changed

packer-templates/build_ubuntu_series.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Options:
77
-h --help Display this message
88
-d --debug Enable debug output
9-
-f --flavor=FLAVOR Specify Ubuntu flavor (server, desktop...) [Default: server]
9+
-f --flavor=FLAVOR Specify Ubuntu flavor (server OR desktop) [Default: server]
1010
-a --arch=ARCH Specify architecture (i386, amd64...) [Default: amd64]
1111
-c --cpus=CPUS Specify the number of cpus to use for QEMU [Default: 2]
1212
"""
@@ -127,15 +127,19 @@ def main(args):
127127
logging.info('Building Ubuntu %s', version)
128128
logging.debug('URL : %s', dir_url)
129129
with NamedTemporaryFile(mode='w') as tmp_varfile:
130+
flavor_real = flavor
131+
if flavor == 'desktop':
132+
# we have to use the alternate iso
133+
flavor_real = 'alternate'
130134
varfile = {
131135
'vm_name': 'ubuntu-{}-{}-{}.qcow2'.format(version, flavor, arch),
132136
'memory': '512',
133137
'cpus': str(cpus),
134138
'disk_size': '65536',
135139
'iso_checksum_url': '{}/SHA1SUMS'.format(dir_url),
136140
'iso_checksum_type': 'sha1',
137-
'iso_url': '{}/ubuntu-{}-{}-{}.iso'.format(dir_url, version, flavor, arch),
138-
'preseed': 'ubuntu/preseed.cfg',
141+
'iso_url': '{}/ubuntu-{}-{}-{}.iso'.format(dir_url, version, flavor_real, arch),
142+
'preseed': 'ubuntu/preseed-{}.cfg'.format(flavor),
139143
'version': '1'
140144
}
141145
json.dump(varfile, tmp_varfile)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
d-i debian-installer/locale string en_US
2+
d-i time/zone string UTC
3+
4+
d-i keyboard-configuration/xkb-keymap select us
5+
6+
d-i partman-auto/method string regular
7+
d-i partman-auto/choose_recipe select atomic
8+
d-i partman/default_filesystem string ext4
9+
d-i partman-partitioning/confirm_write_new_label boolean true
10+
d-i partman/choose_partition select finish
11+
d-i partman/confirm boolean true
12+
d-i partman/confirm_nooverwrite boolean true
13+
14+
d-i base-installer/excludes string laptop-detect
15+
16+
d-i passwd/root-password-again password vagrant
17+
d-i passwd/root-password password vagrant
18+
d-i passwd/user-fullname string vagrant
19+
d-i passwd/username string vagrant
20+
d-i passwd/user-password password vagrant
21+
d-i passwd/user-password-again password vagrant
22+
d-i user-setup/allow-password-weak boolean true
23+
24+
d-i pkgsel/include string curl openssh-server sudo
25+
d-i pkgsel/language-packs multiselect
26+
tasksel tasksel/first multiselect ubuntu-desktop
27+
28+
d-i finish-install/reboot_in_progress note
29+
30+
d-i preseed/late_command string \
31+
echo 'Defaults:vagrant !requiretty' > /target/etc/sudoers.d/vagrant; \
32+
echo 'vagrant ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers.d/vagrant; \
33+
chmod 440 /target/etc/sudoers.d/vagrant; \
34+
ln -sf /dev/null /target/etc/systemd/network/99-default.link; \
35+
in-target update-initramfs -u
File renamed without changes.

packer-templates/ubuntu.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
"vm_name": "{{ user `vm_name` }}",
77
"cpus": "{{ user `cpus`}}",
88
"memory": "{{ user `memory` }}",
9+
"boot_wait": "{{ user `boot_wait` }}",
910
"boot_command": [
10-
"<enter><wait>",
11+
"{{ user `boot_command_prefix` }}",
1112
"<f6><esc>",
1213
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
1314
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
@@ -46,6 +47,8 @@
4647
"variables": {
4748
"cpus": "1",
4849
"memory": "512",
50+
"boot_command_prefix": "<enter><wait>",
51+
"boot_wait": "5s",
4952
"install_vagrant_key": "true",
5053
"install_dev_packages": "false",
5154
"disk_size": "65536",

0 commit comments

Comments
 (0)