|
| 1 | +# Copyright 2019 The Kubernetes Authors. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +# Configure the locale |
| 16 | +d-i debian-installer/locale string en_US.utf8 |
| 17 | +d-i console-setup/ask_detect boolean false |
| 18 | +d-i console-setup/layout string us |
| 19 | + |
| 20 | +# Configure the clock |
| 21 | +d-i time/zone string UTC |
| 22 | +d-i clock-setup/utc-auto boolean true |
| 23 | +d-i clock-setup/utc boolean true |
| 24 | + |
| 25 | +# Configure the keyboard |
| 26 | +d-i kbd-chooser/method select American English |
| 27 | + |
| 28 | +# Configure networking |
| 29 | +d-i netcfg/wireless_wep string |
| 30 | + |
| 31 | +# Select the kernel |
| 32 | +d-i base-installer/kernel/override-image string linux-virtual |
| 33 | + |
| 34 | +# Configure a non-interactive install |
| 35 | +debconf debconf/frontend select Noninteractive |
| 36 | + |
| 37 | +# Configure the base installation |
| 38 | +d-i pkgsel/install-language-support boolean false |
| 39 | +d-i pkgsel/language-packs multiselect |
| 40 | +tasksel tasksel/first multiselect # standard, ubuntu-server |
| 41 | + |
| 42 | + |
| 43 | +### Simple GPT configuration w/o LVM |
| 44 | +d-i partman-auto/disk string /dev/sda |
| 45 | + |
| 46 | +d-i partman/alignment string cylinder |
| 47 | +d-i partman/confirm_write_new_label boolean true |
| 48 | +d-i partman-basicfilesystems/choose_label string gpt |
| 49 | +d-i partman-basicfilesystems/default_label string gpt |
| 50 | +d-i partman-partitioning/choose_label string gpt |
| 51 | +d-i partman-partitioning/default_label string gpt |
| 52 | +d-i partman/choose_label string gpt |
| 53 | +d-i partman/default_label string gpt |
| 54 | + |
| 55 | +d-i partman-auto/method string regular |
| 56 | +d-i partman-auto/choose_recipe select gpt-boot-root-swap |
| 57 | +d-i partman-auto/expert_recipe string \ |
| 58 | + gpt-boot-root-swap :: \ |
| 59 | + 1 1 1 free \ |
| 60 | + $bios_boot{ } \ |
| 61 | + method{ biosgrub } . \ |
| 62 | + 200 200 200 fat32 \ |
| 63 | + $primary{ } \ |
| 64 | + method{ efi } format{ } . \ |
| 65 | + 512 512 512 ext3 \ |
| 66 | + $primary{ } $bootable{ } \ |
| 67 | + method{ format } format{ } \ |
| 68 | + use_filesystem{ } filesystem{ ext3 } \ |
| 69 | + mountpoint{ /boot } . \ |
| 70 | + 1000 20000 -1 ext4 \ |
| 71 | + $primary{ } \ |
| 72 | + method{ format } format{ } \ |
| 73 | + use_filesystem{ } filesystem{ ext4 } \ |
| 74 | + mountpoint{ / } . |
| 75 | + |
| 76 | +d-i partman-partitioning/confirm_write_new_label boolean true |
| 77 | +d-i partman/choose_partition select finish |
| 78 | +d-i partman/confirm boolean true |
| 79 | +d-i partman/confirm_nooverwrite boolean true |
| 80 | + |
| 81 | +# Create the default user. |
| 82 | +d-i passwd/user-fullname string builder |
| 83 | +d-i passwd/username string builder |
| 84 | +d-i passwd/user-password password builder |
| 85 | +d-i passwd/user-password-again password builder |
| 86 | +d-i user-setup/encrypt-home boolean false |
| 87 | +d-i user-setup/allow-password-weak boolean true |
| 88 | + |
| 89 | +# Disable upgrading packages upon installation. |
| 90 | +d-i pkgsel/upgrade select none |
| 91 | +d-i grub-installer/only_debian boolean true |
| 92 | +d-i grub-installer/with_other_os boolean true |
| 93 | +d-i finish-install/reboot_in_progress note |
| 94 | +d-i pkgsel/update-policy select none |
| 95 | + |
| 96 | +# Disable use of the apt mirror during base install |
| 97 | +# This means only packages available in the ISO can be installed |
| 98 | +d-i apt-setup/use_mirror boolean false |
| 99 | + |
| 100 | +# Disable the security repo as well (it's on by default) |
| 101 | +d-i apt-setup/services-select multiselect none |
| 102 | + |
| 103 | +# Customize the list of packages installed. |
| 104 | +d-i pkgsel/include string openssh-server open-vm-tools |
| 105 | + |
| 106 | + |
| 107 | +# Ensure questions about these packages do not bother the installer. |
| 108 | +libssl1.1 libssl1.1/restart-without-asking boolean true |
| 109 | +libssl1.1:amd64 libssl1.1/restart-without-asking boolean true |
| 110 | +libssl1.1 libssl1.1/restart-services string |
| 111 | +libssl1.1:amd64 libssl1.1/restart-services string |
| 112 | + |
| 113 | + |
| 114 | +# This command runs after all other steps; it: |
| 115 | +# 1. Ensures the "builder" user doesn't require a password to use sudo |
| 116 | +# 2. Cleans up any packages that are no longer required |
| 117 | +# 3. Cleans the package cache |
| 118 | +# 4. Removes the cached list of packages |
| 119 | +# 5. Disables swapfiles |
| 120 | +# 6. Removes the existing swapfile |
| 121 | +# 7. Removes the swapfile entry from /etc/fstab |
| 122 | +d-i preseed/late_command string \ |
| 123 | + echo 'builder ALL=(ALL) NOPASSWD: ALL' >/target/etc/sudoers.d/builder ; \ |
| 124 | + in-target chmod 440 /etc/sudoers.d/builder ; \ |
| 125 | + in-target swapoff -a ; \ |
| 126 | + in-target rm -f /swapfile ; \ |
| 127 | + in-target sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab ; \ |
| 128 | + in-target rm -f /etc/udev/rules.d/70-persistent-net.rules |
0 commit comments