/etc/maas/preseeds/generic is in maas-region-controller-min 1.5+bzr2252-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | {{inherit "preseed_master"}}
{{def proxy}}
d-i mirror/country string manual
{{if node.architecture in {'i386/generic', 'amd64/generic'} }}
d-i mirror/http/hostname string {{main_archive_hostname}}
d-i mirror/http/directory string {{main_archive_directory}}
{{else}}
d-i mirror/http/hostname string {{ports_archive_hostname}}
d-i mirror/http/directory string {{ports_archive_directory}}
{{endif}}
{{if http_proxy }}
d-i mirror/http/proxy string {{http_proxy}}
{{else}}
d-i mirror/http/proxy string http://{{server_host}}:8000/
{{endif}}
{{enddef}}
{{def client_packages}}
{{if third_party_drivers and driver}}
d-i pkgsel/include string cloud-init openssh-server python-software-properties vim avahi-daemon server^ {{driver_package}}
{{else}}
d-i pkgsel/include string cloud-init openssh-server python-software-properties vim avahi-daemon server^
{{endif}}
{{enddef}}
{{def driver_preseed_data}}
{{if third_party_drivers and driver}}
# Third party driver support.
d-i preseed/early_command string \
echo -en '{{''.join(['\\x%x' % x for x in map(ord, str(install_udeb))])}}' > /tmp/install_udeb.sh && \
chmod +x /tmp/install_udeb.sh && \
/tmp/install_udeb.sh
d-i apt-setup/local0/repository string deb {{driver['repository']}} {{node.get_distro_series()}} main
d-i apt-setup/local0/comment string {{driver['comment']}}
d-i apt-setup/local0/key string file:///tmp/maas-{{driver['package']}}/repo_key.gpg
{{endif}}
{{enddef}}
{{def preseed}}
{{preseed_data}}
{{driver_preseed_data}}
{{enddef}}
{{def post_scripts}}
# Executes late command and disables PXE.
d-i preseed/late_command string true && \
in-target sh -c 'f=$1; shift; echo $0 > $f && chmod 0440 $f $*' 'ubuntu ALL=(ALL) NOPASSWD: ALL' /etc/sudoers.d/maas && \
in-target wget --no-proxy "{{node_disable_pxe_url|escape.shell}}" --post-data "{{node_disable_pxe_data|escape.shell}}" -O /dev/null && \
{{if third_party_drivers and driver}}
in-target sh -c "echo blacklist {{driver['blacklist']}} >> /etc/modprobe.d/maas-{{driver['module']}}.conf" && \
in-target sh -c "for file in /lib/modules/*; do depmod ${file##*/}; done"; \
in-target update-initramfs -u; \
{{endif}}
true
{{enddef}}
{{def install_udeb}}
{{if third_party_drivers and driver}}
#!/usr/bin/env sh
set -eu
REPO={{driver['repository']}}
KERNEL_VERSION=`uname -r`
TMPDIR=/tmp/maas-{{driver['package']}}
mkdir $TMPDIR
{{if http_proxy}}
export http_proxy={{http_proxy}} https_proxy={{http_proxy}}
{{endif}}
echo -en '{{''.join(['\\x%x' % x for x in map(ord, driver['key_binary'])])}}' > $TMPDIR/repo_key.gpg
# Retrieve the Release file and verify it against the repository's key.
wget -O $TMPDIR/Release $REPO/dists/{{node.get_distro_series()}}/Release
wget -O $TMPDIR/Release.gpg $REPO/dists/{{node.get_distro_series()}}/Release.gpg
gpgv --keyring $TMPDIR/repo_key.gpg $TMPDIR/Release.gpg $TMPDIR/Release
# Retrieve the Packages file and verify it against the Releases file.
wget -O $TMPDIR/Packages $REPO/dists/{{node.get_distro_series()}}/main/debian-installer/binary-amd64/Packages
expected_sha256=`sed -n -e '/^SHA256:$/,$p' $TMPDIR/Release | grep 'main/debian-installer/binary-amd64/Packages$' | cut -f 2 -d ' '`
actual_sha256=`sha256sum $TMPDIR/Packages | cut -f 1 -d ' '`
if [ "$expected_sha256" != "$actual_sha256" ]
then
echo "Packages sha256 value mismatch."
echo "expected: $expected_sha256, actual: $actual_sha256"
exit 1
fi
# Retrieve the udeb and verify it against the Packages file. This method
# of locating the sha256 sum for the udeb within the Packages file
# relies on the SHA256 line coming after the Filename line in the udeb's
# record in the Packages file.
filename=`grep ^Filename.*$KERNEL_VERSION $TMPDIR/Packages | cut -f 2 -d ' ' | sort -ru | head -n 1`
wget -O $TMPDIR/driver.udeb $REPO/$filename
basename=${filename##*/}
sed_expression="/$basename"'$/,$p'
expected_udeb_sha256=`sed -n -e $sed_expression $TMPDIR/Packages | grep ^SHA256: | cut -f 2 -d ' ' | head -n 1`
actual_udeb_sha256=`sha256sum $TMPDIR/driver.udeb | cut -f 1 -d ' '`
if [ "$expected_udeb_sha256" != "$actual_udeb_sha256" ]
then
echo "udeb sha256 value mismatch."
echo "expected: $expected_udeb_sha256, actual: $actual_udeb_sha256"
exit 1
fi
# Install the udeb and load the kernel module.
udpkg -i $TMPDIR/driver.udeb
depmod
modprobe {{driver['module']}}
{{endif}}
{{enddef}}
|