aboutsummaryrefslogtreecommitdiff
path: root/in-chroot.sh
blob: a72b6cf4b4fce96b5c7ceb364d5da497fa2cee27 (plain)
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
#!/bin/bash -x
dpkg-divert --local --add /usr/share/flash-kernel/bootscript/bootscr.xgene-mustang
diff -u /usr/share/flash-kernel/bootscript/bootscr.xgene-mustang /boot.script
mv /boot.script /usr/share/flash-kernel/bootscript/bootscr.xgene-mustang
type -p mkimage || apt-get install -y u-boot-tools
type -p wget || apt-get install -y wget
type -p md5sum || apt-get install -y md5sum

DISTRO=$(lsb_release -cs)

if [[ ${DISTRO} =~ (trusty|utopic|vivid|wily) ]]; then
    wget --progress=dot -e dotbytes=10M -O new-kernel.tar.bz2 http://people.linaro.org/leg-openstack/mustang-deploy/prebuilt-linux-4.1.2.tar.bz2
    md5sum new-kernel.tar.bz2
    tar -C / -xf new-kernel.tar.bz2
fi

ls -l /boot
flash-kernel
ls -l /boot
sed -e 's/ttyAMA0/ttyS0/g' /etc/init/ttyAMA0.conf > /etc/init/ttyS0.conf
if [ -x /extra ]; then
    /extra
fi
cat /boot/boot.scr
adduser --disabled-password --gecos "" ubuntu
echo "ubuntu:password" | chpasswd
echo "ubuntu ALL=(ALL) NOPASSWD:ALL" | tee -a /etc/sudoers
sed -i -e 's/APT::Periodic::Update-Package-Lists "1"/APT::Periodic::Update-Package-Lists "0"/' /etc/apt/apt.conf.d/10periodic

# Why do we futz with cat(z)?
#   https://bugs.linaro.org/show_bug.cgi?id=1275

mv /bin/cat /bin/cat.real
cat.real <<\EOF > /bin/cat
#!/bin/sh

if [ "$CAT_NOWRAP" = "1" ]; then
	exec cat.real "$@"
elif [ "$1" = "/proc/net/pnp" ]; then
	echo "nameserver 10.0.0.1"
	echo "search lavalab"
else
	exec cat.real "$@"
fi
EOF
chmod 555 /bin/cat
cat /bin/cat