Cleanup and update Ubuntu and Debian scripts
Some checks reported errors
continuous-integration/drone/push Build was killed

This commit is contained in:
2023-06-04 03:20:35 -04:00
parent 8e70eabfb3
commit 64a5f39b75
10 changed files with 251 additions and 119 deletions

View File

@ -1,15 +1,51 @@
#_preseed_V1
# Automatic installation
d-i auto-install/enable boolean true
# Preseeding only locale sets language, country and locale.
d-i debian-installer/language string en
d-i debian-installer/country string US
d-i debian-installer/locale string en_US.UTF-8
d-i console-setup/ask_detect boolean false
d-i debconf/frontend select noninteractive
# Keyboard selection.
d-i keyboard-configuration/xkb-keymap select us
d-i keymap select us
choose-mirror-bin mirror/http/proxy string
d-i pkgsel/install-language-support boolean false
d-i apt-setup/use_mirror boolean true
d-i base-installer/kernel/override-image string linux-server
### Clock and time zone setup
d-i clock-setup/utc boolean true
d-i clock-setup/utc-auto boolean true
d-i time/zone string UTC
# Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note
# This is fairly safe to set, it makes grub install automatically to the MBR
# if no other operating system is detected on the machine.
d-i grub-installer/only_debian boolean true
# This one makes grub-installer install to the MBR if it also finds some other
# OS, which is less safe as it might not be able to boot that other OS.
d-i grub-installer/with_other_os boolean true
# Set dev for grub boot
d-i grub-installer/bootdev string /dev/sda
### Mirror settings
# If you select ftp, the mirror/country string does not need to be set.
d-i mirror/country string manual
d-i mirror/http/directory string /ubuntu/
d-i mirror/http/hostname string archive.ubuntu.com
d-i mirror/http/proxy string
# This makes partman automatically partition without confirmation.
d-i partman-efi/non_efi_system boolean true
d-i partman-auto-lvm/guided_size string max
d-i partman-auto/choose_recipe select atomic
d-i partman-auto/method string lvm
@ -20,16 +56,35 @@ d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman/confirm_write_new_label boolean true
d-i passwd/user-fullname string vagrant
### Account setup
d-i passwd/root-login boolean false
d-i passwd/user-fullname string ubuntu
d-i passwd/user-uid string 1000
d-i passwd/user-password password vagrant
d-i passwd/user-password-again password vagrant
d-i passwd/username string vagrant
d-i pkgsel/include string openssh-server cryptsetup libssl-dev libreadline-dev zlib1g-dev linux-source dkms nfs-common linux-headers-$(uname -r) perl cifs-utils software-properties-common rsync ifupdown
d-i pkgsel/install-language-support boolean false
d-i pkgsel/update-policy select none
d-i pkgsel/upgrade select full-upgrade
d-i time/zone string UTC
d-i passwd/user-password password ubuntu
d-i passwd/user-password-again password ubuntu
d-i passwd/username string ubuntu
# The installer will warn about weak passwords. If you are sure you know
# what you're doing and want to override it, uncomment this.
d-i user-setup/allow-password-weak boolean true
d-i user-setup/encrypt-home boolean false
### Package selection
tasksel tasksel/first multiselect standard, server
d-i pkgsel/include string openssh-server sudo cryptsetup libssl-dev libreadline-dev zlib1g-dev linux-source dkms nfs-common linux-headers-$(uname -r) perl cifs-utils software-properties-common rsync ifupdown
d-i pkgsel/install-language-support boolean false
# disable automatic package updates
d-i pkgsel/update-policy select none
d-i pkgsel/upgrade select full-upgrade
# Disable polularity contest
popularity-contest popularity-contest/participate boolean false
# Select base install
tasksel tasksel/first multiselect standard, ssh-server
# Setup passwordless sudo for packer user
d-i preseed/late_command string \
echo "ubuntu ALL=(ALL:ALL) NOPASSWD:ALL" > /target/etc/sudoers.d/ubuntu && chmod 0440 /target/etc/sudoers.d/ubuntu

View File

@ -5,13 +5,39 @@ autoinstall:
hostname: ubuntu-server
password: '$6$wdAcoXrU039hKYPd$508Qvbe7ObUnxoj15DRCkzC3qO7edjH0VV7BPNRDYK4QR8ofJaEEF2heacn0QgD.f8pO8SNp83XNdWG6tocBM1'
username: ubuntu
network:
network:
version: 2
ethernets:
eth0:
dhcp4: yes
early-commands:
# otherwise packer tries to connect and exceed max attempts:
- systemctl stop ssh
packages:
- ca-certificates
- cloud-guest-utils
- cloud-init
ssh:
install-server: true
allow-pw: yes
storage:
swap:
size: 0
config:
- { type: disk, id: disk-0, ptable: gpt, wipe: superblock-recursive, grub_device: true }
- { type: partition, id: partition-0, number: 1, device: disk-0, size: 1M, wipe: superblock, flag: bios_grub }
- { type: partition, id: partition-1, number: 2, device: disk-0, size: 4096M, wipe: superblock, flag: boot }
- { type: partition, id: partition-2, number: 3, device: disk-0, size: 8192M, wipe: superblock, flag: swap }
- { type: partition, id: partition-3, number: 4, device: disk-0, size: -1, wipe: superblock }
- { type: format, id: format-0, volume: partition-1, fstype: ext4 }
- { type: format, id: format-1, volume: partition-2, fstype: swap }
- { type: format, id: format-2, volume: partition-3, fstype: ext4 }
- { type: mount, id: mount-0, device: format-0, path: /boot }
- { type: mount, id: mount-1, device: format-1, path: none }
- { type: mount, id: mount-2, device: format-2, path: / }
late-commands:
- echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/ubuntu
- |
curtin in-target --target=/target -- /bin/bash -c ' \
sed -ie "s/^[#\s]*UseDNS.*$/UseDNS no/g" /etc/ssh/sshd_config; \
@ -22,10 +48,5 @@ autoinstall:
sed -ie "s/^GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=\"net.ifnames=0 biosdevname=0 systemd.unified_cgroup_hierarchy=0\"/g" /etc/default/grub; \
update-grub; \
update-initramfs -c -k all; \
apt-get -y purge snapd; \
systemctl disable apt-daily.service; \
systemctl disable apt-daily.timer; \
systemctl disable apt-daily-upgrade.service; \
systemctl disable apt-daily-upgrade.timer; \
exit 0 \
'