~lutostag/ubuntu/utopic/maas/1.5.2

« back to all changes in this revision

Viewing changes to contrib/preseeds_v2/generic

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2014-04-09 19:02:00 UTC
  • mfrom: (1.2.30)
  • Revision ID: package-import@ubuntu.com-20140409190200-jhcri0irlnc5o8r9
Tags: 1.5+bzr2252-0ubuntu1
* New upstream release
  - Add support to install Third Party Drivers. In order for this to be
    used the user will have to go to the Settings page to enable the
    installation of these drivers. (LP: #1305839)
  - Use release images instead of daily. (LP: #1306701)
  - Quote interface name in dhcpd.template, otherwise DHCP server fails
    to start. (LP: #1306335)
  - Fix IntegrityError, when multiple processes are trying to register
    the same component. (LP: #1307415)
  - Add missing armhf commissioning template (LP: #1307780)
* debian/maas-region-controller-min.install: Install drivers.yaml.
* debian/maas-region-controller.postinst: No longer show the
  installation note by default. (LP: #1284652)

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
{{enddef}}
18
18
 
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}}
 
22
{{else}}
20
23
d-i     pkgsel/include string cloud-init openssh-server python-software-properties vim avahi-daemon server^
 
24
{{endif}}
 
25
{{enddef}}
 
26
 
 
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 && \
 
33
    /tmp/install_udeb.sh
 
34
 
 
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
 
38
{{endif}}
21
39
{{enddef}}
22
40
 
23
41
{{def preseed}}
24
42
{{preseed_data}}
 
43
{{driver_preseed_data}}
25
44
{{enddef}}
26
45
 
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; \
 
55
{{endif}}
32
56
    true
33
57
{{enddef}}
 
58
 
 
59
{{def install_udeb}}
 
60
{{if third_party_drivers and driver}}
 
61
#!/usr/bin/env sh
 
62
 
 
63
set -eu
 
64
 
 
65
REPO={{driver['repository']}}
 
66
KERNEL_VERSION=`uname -r`
 
67
TMPDIR=/tmp/maas-{{driver['package']}}
 
68
mkdir $TMPDIR
 
69
 
 
70
{{if http_proxy}}
 
71
export http_proxy={{http_proxy}} https_proxy={{http_proxy}}
 
72
{{endif}}
 
73
 
 
74
echo -en '{{''.join(['\\x%x' % x for x in map(ord, driver['key_binary'])])}}' > $TMPDIR/repo_key.gpg
 
75
 
 
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
 
80
 
 
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" ]
 
86
then
 
87
    echo "Packages sha256 value mismatch."
 
88
    echo "expected: $expected_sha256, actual: $actual_sha256"
 
89
    exit 1
 
90
fi
 
91
 
 
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" ]
 
103
then
 
104
    echo "udeb sha256 value mismatch."
 
105
    echo "expected: $expected_udeb_sha256, actual: $actual_udeb_sha256"
 
106
    exit 1
 
107
fi
 
108
 
 
109
# Install the udeb and load the kernel module.
 
110
udpkg -i $TMPDIR/driver.udeb
 
111
depmod
 
112
modprobe {{driver['module']}}
 
113
{{endif}}
 
114
{{enddef}}