forked from nabaztag2018/pynab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup
executable file
·105 lines (88 loc) · 3.58 KB
/
setup
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
#!/bin/bash
set -uo pipefail
trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR
IFS=$'\n\t'
# Source for this script:
# https://github.com/kr15h/travis-raspbian-image
# https://disconnected.systems/blog/custom-rpi-image-with-github-travis/
GPU_MEM=16
LC_ALL=C
# Replace /boot/cmdline.txt since it contains root device mapping to a PARTUUID that
# changed during parted resize.
echo "Replace /boot/cmdline.txt"
echo "dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet init=/usr/lib/raspi-config/init_resize.sh" > "/boot/cmdline.txt"
cat "/boot/cmdline.txt"
# Resize partition on first boot.
# https://www.raspberrypi.org/forums/viewtopic.php?p=1503766#p1503766
wget -O /etc/init.d/resize2fs_once https://raw.githubusercontent.com/RPi-Distro/pi-gen/master/stage2/01-sys-tweaks/files/resize2fs_once
chmod +x /etc/init.d/resize2fs_once
systemctl enable resize2fs_once
# Replace /etc/fstab since the non existing PARTUUID has to be changed here as well.
echo "Replace /etc/fstab"
echo "proc /proc proc defaults 0 0" > "/etc/fstab"
echo "/dev/mmcblk0p1 /boot vfat defaults 0 2" >> "/etc/fstab"
echo "/dev/mmcblk0p2 / ext4 defaults,noatime 0 1" >> "/etc/fstab"
cat "/etc/fstab"
echo "Setting gpu_mem."
if grep -q "gpu_mem" /boot/config.txt
then
sed -i "s/gpu_mem.*/gpu_mem=${GPU_MEM}/" /boot/config.txt
else
echo "gpu_mem=${GPU_MEM}" >> /boot/config.txt
fi
cat /boot/config.txt | grep "gpu_mem"
echo "Setting hostname."
sed -i "s/raspberrypi/nabaztag/" /etc/hostname
sed -i "s/raspberrypi/nabaztag/" /etc/hosts
echo "Setting timezone."
echo "Europe/Paris" > /etc/timezone
ln -fs /usr/share/zoneinfo/Europe/Paris /etc/localtime
echo "Disabling onboard sound."
if grep -q "dtparam=audio=on" /boot/config.txt
then
sed -i "s/dtparam=audio=on/#dtparam=audio=on/" /boot/config.txt
fi
cat /boot/config.txt | grep "dtparam=audio=on"
echo "Enabling DAC for Maker Faire 2018 cards"
echo "dtoverlay=hifiberry-dac" >> /boot/config.txt
cat /boot/config.txt | grep "dtoverlay=hifiberry-dac"
echo "Installing required packages"
sudo apt update -y
sudo apt dist-upgrade -y
sudo apt-get install --no-install-recommends -y postgresql libpq-dev git python3 python3-venv python3-dev gettext nginx openssl libssl-dev libffi-dev libmpg123-dev libasound2-dev libatlas-base-dev libgfortran3 libopenblas-dev liblapack-dev gfortran zram-tools
echo "Installing sound driver for Ulule 2019 cards"
sudo apt-get install --no-install-recommends raspberrypi-kernel-headers
cd /home/pi
sudo -u pi git clone -b tagtagtag-sound https://github.com/pguyot/wm8960
cd /home/pi/wm8960
make
sudo make install
echo "Installing ears driver"
cd /home/pi
sudo -u pi git clone https://github.com/pguyot/tagtagtag-ears
cd /home/pi/tagtagtag-ears
make
sudo make install
echo "Installing cr14 driver"
cd /home/pi
sudo -u pi git clone https://github.com/pguyot/cr14
cd /home/pi/cr14
make
sudo make install
branch=release
if [ $TRAVIS_BRANCH = "releng" ]; then
branch=releng
fi
echo "Cloning pynab ${branch} branch"
cd /home/pi
sudo -u pi git clone -b ${branch} https://github.com/nabaztag2018/pynab.git
echo "Installing nabblockly"
sudo apt-get install --no-install-recommends -y erlang
cd /home/pi/pynab
sudo -u pi git clone https://github.com/pguyot/nabblockly
cd nabblockly
sudo -u pi wget https://s3.amazonaws.com/rebar3/rebar3 && chmod +x rebar3
sudo -u pi ./rebar3 release
echo "Running pynab install script"
cd /home/pi/pynab
sudo -u pi /bin/bash install.sh travis-chroot