-
Notifications
You must be signed in to change notification settings - Fork 4
/
build-rpi-mesh-node-customize
executable file
·85 lines (59 loc) · 2.32 KB
/
build-rpi-mesh-node-customize
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
#!/bin/sh
# Exit on first error
set -e
set -x
LC_ALL=C
export LC_ALL
rootdir="$1"
pkgs=""
cd "$rootdir"
cat <<EOF > etc/apt/sources.list
deb http://http.debian.net/debian/ jessie main contrib non-free
EOF
cat <<EOF > etc/apt/sources.list.d/reinholdtsen-freedombox.list
deb http://www.reinholdtsen.name/freedombox/ wheezy main
EOF
wget http://www.reinholdtsen.name/freedombox/BE1A583D.asc -O - | \
chroot $rootdir apt-key add -
printf "#!/bin/sh\nexit 101\n" > $rootdir/usr/sbin/policy-rc.d
chmod a+rx $rootdir/usr/sbin/policy-rc.d
# Fetch package lists and GPG signatures
chroot $rootdir apt-get update
# Stuff needed by debootstrap (need /etc/hosts)
pkgs="$pkgs netbase"
# Stuff needed for the machine to work well
pkgs="$pkgs udev"
# Install meshfx-node from external repository
pkgs="$pkgs freedombox-reinholdtsen-archive-keyring"
# Install the tools needed to become a mesh node.
pkgs="$pkgs meshfx-node"
# Useful firmware packages to get free hardware working
pkgs="$pkgs firmware-linux-free"
# Include non-free binary blob for various wifi card to get them
# working out of the box. Not installed by debootstrap as debootstrap
# only handle packages in main.
pkgs="$pkgs atmel-firmware firmware-atheros \
firmware-brcm80211 firmware-intelwimax firmware-iwlwifi \
firmware-libertas firmware-linux firmware-ralink firmware-realtek \
prism2-usb-firmware-installer zd1211-firmware"
# Not installing firmware-ipw2x00 because it want license confirmation
# and it is perhaps not nice to give that on behalf of others.
# Include network too
pkgs="$pkgs ifupdown openssh-server tinc"
# rpi-update require some tools
pkgs="$pkgs git-core binutils ca-certificates wget curl kmod"
# Other packages useful to get a debuggable environment
pkgs="$pkgs psmisc usbutils pciutils bootlogd tcpdump iputils-ping iftop vim-tiny"
# Tools needed for becoming a mesh exit node via Tor
pkgs="$pkgs tor dnsmasq"
chroot $rootdir apt-get install -y $pkgs
chroot $rootdir apt-get clean
set -x
# Install non-free binary blob needed to boot Raspberry Pi. This
# install a kernel somewhere too.
wget https://raw.github.com/Hexxeh/rpi-update/master/rpi-update \
-O $rootdir/usr/bin/rpi-update
chmod a+x $rootdir/usr/bin/rpi-update
mkdir -p $rootdir/lib/modules
chroot $rootdir rpi-update | tee $rootdir/root/rpi-update.log
rm $rootdir/usr/sbin/policy-rc.d