19
19
{{def client_packages}}
20
{{if third_party_drivers and driver}}
21
d-i pkgsel/include string cloud-init openssh-server python-software-properties vim avahi-daemon server^ {{driver_package}}
20
23
d-i pkgsel/include string cloud-init openssh-server python-software-properties vim avahi-daemon server^
27
{{def driver_preseed_data}}
28
{{if third_party_drivers and driver}}
29
# Third party driver support.
30
d-i preseed/early_command string \
31
echo -en '{{''.join(['\\x%x' % x for x in map(ord, str(install_udeb))])}}' > /tmp/install_udeb.sh && \
32
chmod +x /tmp/install_udeb.sh && \
35
d-i apt-setup/local0/repository string deb {{driver['repository']}} {{node.get_distro_series()}} main
36
d-i apt-setup/local0/comment string {{driver['comment']}}
37
d-i apt-setup/local0/key string file:///tmp/maas-{{driver['package']}}/repo_key.gpg
43
{{driver_preseed_data}}
27
46
{{def post_scripts}}
29
48
d-i preseed/late_command string true && \
30
49
in-target sh -c 'f=$1; shift; echo $0 > $f && chmod 0440 $f $*' 'ubuntu ALL=(ALL) NOPASSWD: ALL' /etc/sudoers.d/maas && \
31
50
in-target wget --no-proxy "{{node_disable_pxe_url|escape.shell}}" --post-data "{{node_disable_pxe_data|escape.shell}}" -O /dev/null && \
51
{{if third_party_drivers and driver}}
52
in-target sh -c "echo blacklist {{driver['blacklist']}} >> /etc/modprobe.d/maas-{{driver['module']}}.conf" && \
53
in-target sh -c "for file in /lib/modules/*; do depmod ${file##*/}; done"; \
54
in-target update-initramfs -u; \
60
{{if third_party_drivers and driver}}
65
REPO={{driver['repository']}}
66
KERNEL_VERSION=`uname -r`
67
TMPDIR=/tmp/maas-{{driver['package']}}
71
export http_proxy={{http_proxy}} https_proxy={{http_proxy}}
74
echo -en '{{''.join(['\\x%x' % x for x in map(ord, driver['key_binary'])])}}' > $TMPDIR/repo_key.gpg
76
# Retrieve the Release file and verify it against the repository's key.
77
wget -O $TMPDIR/Release $REPO/dists/{{node.get_distro_series()}}/Release
78
wget -O $TMPDIR/Release.gpg $REPO/dists/{{node.get_distro_series()}}/Release.gpg
79
gpgv --keyring $TMPDIR/repo_key.gpg $TMPDIR/Release.gpg $TMPDIR/Release
81
# Retrieve the Packages file and verify it against the Releases file.
82
wget -O $TMPDIR/Packages $REPO/dists/{{node.get_distro_series()}}/main/debian-installer/binary-amd64/Packages
83
expected_sha256=`sed -n -e '/^SHA256:$/,$p' $TMPDIR/Release | grep 'main/debian-installer/binary-amd64/Packages$' | cut -f 2 -d ' '`
84
actual_sha256=`sha256sum $TMPDIR/Packages | cut -f 1 -d ' '`
85
if [ "$expected_sha256" != "$actual_sha256" ]
87
echo "Packages sha256 value mismatch."
88
echo "expected: $expected_sha256, actual: $actual_sha256"
92
# Retrieve the udeb and verify it against the Packages file. This method
93
# of locating the sha256 sum for the udeb within the Packages file
94
# relies on the SHA256 line coming after the Filename line in the udeb's
95
# record in the Packages file.
96
filename=`grep ^Filename.*$KERNEL_VERSION $TMPDIR/Packages | cut -f 2 -d ' ' | sort -ru | head -n 1`
97
wget -O $TMPDIR/driver.udeb $REPO/$filename
98
basename=${filename##*/}
99
sed_expression="/$basename"'$/,$p'
100
expected_udeb_sha256=`sed -n -e $sed_expression $TMPDIR/Packages | grep ^SHA256: | cut -f 2 -d ' ' | head -n 1`
101
actual_udeb_sha256=`sha256sum $TMPDIR/driver.udeb | cut -f 1 -d ' '`
102
if [ "$expected_udeb_sha256" != "$actual_udeb_sha256" ]
104
echo "udeb sha256 value mismatch."
105
echo "expected: $expected_udeb_sha256, actual: $actual_udeb_sha256"
109
# Install the udeb and load the kernel module.
110
udpkg -i $TMPDIR/driver.udeb
112
modprobe {{driver['module']}}