-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild_release.bash
160 lines (131 loc) · 4.76 KB
/
build_release.bash
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
set -eEuo pipefail
bash build_root.bash clean_all
bash build_root.bash build_all
bash build_root.bash package_sdk
SHOULD_CLEAN=1 bash build.bash
bash build_root.bash build_linux
rm -rf /build/release
mkdir -p /build/release/debugging
cp /build/supervisor.pi0wfast.exec /build/release/debugging/
cp /build/supervisor.pi0wfast.exec /build/release/supervisor.exec
/build/root-pi0w-dev-sdk/host/arm-buildroot-linux-uclibcgnueabihf/bin/strip /build/release/supervisor.exec
cp /build/shed3.pi0wfast.exec /build/release/debugging/
cp /build/shed3.pi0wfast.exec /build/release/shed.exec
/build/root-pi0w-dev-sdk/host/arm-buildroot-linux-uclibcgnueabihf/bin/strip /build/release/shed.exec
cp -r \
/build/root-pi0w-dev/images/rpi-firmware/overlays \
/build/root-pi0w-dev/images/rpi-firmware/bootcode.bin \
/build/root-pi0w-dev/images/rpi-firmware/fixup.dat \
/build/root-pi0w-dev/images/rpi-firmware/start.elf \
/build/root-pi0w-dev/images/bcm2708-rpi-zero-w.dtb \
/build/root-pi0w-dev/images/rootfs.squashfs \
/build/root-pi0w-dev/images/zImage \
/build/release/
cat << 'EOF' > /build/release/config.txt
boot_delay=0
kernel=zImage
disable_overscan=1
gpu_mem_256=50
gpu_mem_512=50
gpu_mem_1024=50
dtoverlay=miniuart-bt
dtoverlay=pwm-2chan
EOF
echo "root=/dev/mmcblk0p2 rootwait console=tty1 -- /dev/mmcblk0p1 rootfs.squashfs" > /build/release/cmdline.txt
cat << 'EOF' > /build/release/shed.config
# This is the config file used by the main SHED process
# This is the email address that notifications are sent from:
EmailAddress: [email protected]
# SMTP Server for outgoing mail:
EmailServer: smtps://smtp.example.com:465
# SMTP Server credentials:
EmailUserPass: example-user:example-password
# Destication email address where notifications are sent to:
DestinationEmailAddress: [email protected]
# Url where configuration is pulled from:
ConfigURL: https://example.com/config
EOF
cat << 'EOF' > /build/release/supervisor.config
# This is the config file used by the supervisor process
# This is the email address that notifications are sent from:
EmailAddress: [email protected]
# SMTP Server for outgoing mail:
EmailServer: smtps://smtp.example.com:465
# SMTP Server credentials:
EmailUserPass: example-user:example-password
# Destication email address where notifications are sent to:
DestinationEmailAddress: [email protected]
DebugSupervisorArg: /mnt/physical/shed.exec
DebugSupervisorArg: /mnt/physical/shed.config
EOF
cat << 'EOF' > /build/release/wifi_action.sh
#!/bin/sh
# This script is run everytime we associate to a WIFI network, edit network ip settings here:
if [ "$2" = "CONNECTED" ]; then
ip addr add 1.2.3.4/24 dev wlan0 # Set static IP address
ip route add default via 1.2.3.1 # Set static default route
echo "nameserver 8.8.8.8" > /etc/resolv.conf # Use Google DNS servers
fi
EOF
cat << 'EOF' > /build/release/wpa_supplicant.conf
# This is the config file used by the WIFI stack, configure WIFI settings here. Some
# documentation on this file can be found here: https://linux.die.net/man/5/wpa_supplicant.conf
update_config=1
ctrl_interface=/var/run/wpa_supplicant
ap_scan=1
network={
key_mgmt=WPA-PSK
ssid="Some WPA network"
psk="Some Passphrase"
}
network={
key_mgmt=NONE
ssid="Some open entwork"
}
EOF
cat << 'EOF' > /build/release/autoexec.sh
haveged
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -i wlan0 -j DROP # comment to disable firewall
date --set "$( date -r /mnt/physical/shed-config '+%F %T' )"
/mnt/physical/supervisor.exec /mnt/physical/supervisor.config 2>&1 | tee -a /var/log/supervisor.log &
hostname shed-unconfigured
modprobe brcmfmac
wpa_supplicant -B -i wlan0 -c /mnt/physical/wpa_supplicant.conf
wpa_cli -Ba /mnt/physical/wifi_action.sh
ntpd -p 0.us.pool.ntp.org -p 1.us.pool.ntp.org -p 2.us.pool.ntp.org -p 3.us.pool.ntp.org
# /usr/sbin/telnetd -l sh # Uncomment to enable shell access via telnet
while true; do {
echo -e "\n\n\n\n\n"
date
ip link
echo
ip addr
sleep 5
}; done
EOF
cp /workspaces/the-bike-shed/LICENSE /build/release/
cat << 'EOF' > /build/release/README-release.txt
License and disclaimers can be found in LICENSE.
The contents of this release zip should be extracted to an SD card for
running on the PI0w as part of the interrior module.
The debugging/ directory can be omitted, and is only there in-case we
need to troublshoot a specific release.
SHED Releases come unconfigured, so you should probably edit these files:
- shed.config
- supervisor.config
- wifi_action.sh
- wpa_supplicant.conf
EOF
(
echo "Git HEAD: $(git rev-parse HEAD)"
echo "Git Status:"
git status
echo
find /build/release -type f -exec sha384sum {} +
) > /build/release/debugging/info
( cd /build/release; zip -r /build/release-$(date +%s).zip .; )
exit -1
# QA Check list:
# - can ping it
# - basic badge in test