forked from senthurayyappan/neurobionicspi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Raspberry-Pi-4.Pifile
98 lines (62 loc) · 2.53 KB
/
Raspberry-Pi-4.Pifile
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
source .env
source ./Raspberry-Pi-4/${ARCHITECTURE}.Pifile
PUMP 800M
RUN touch /boot/ssh
hostname="${HOSTNAME}"
user="${USER}"
password="${USERPASSWORD}"
entssid="${ENTNETWORK_SSID}"
entpriority="${ENTNETWORK_PRIORITY:-10}"
entidentity="${ENTNETWORK_IDENTITY}"
entpassword=$(echo -n "${ENTNETWORK_PASSWORD}" | iconv -t utf16le | openssl dgst -md4 -provider legacy | awk '{print $2}')
countrycode="${WIFI_CC}"
wifissid="${HOMENETWORK_SSID}"
wifipsk="${HOMENETWORK_PASSWORD}"
apssid="${AP_SSID}"
appsk="${AP_PASSWORD}"
email="${EMAIL}"
##################################
# Modifying hostname and password
RUN sed -i "s/raspberrypi/${hostname}/g" /etc/hostname
RUN sed -i "s/raspberrypi/${hostname}/g" /etc/hosts
RUN bash -c "echo ${user}:${password} | chpasswd"
##################################
# Changing default timezone and keyboard layout
RUN bash -c "echo America/New_York > /etc/timezone"
RUN sed -i "s/gb/us/g" /etc/default/keyboard
##################################
RUN apt-get update
# Upgrade takes considerably more memory and time to build the image.
# RUN apt-get upgrade -y
##################################
# Configuring wpa_supplicant with systemd-networkd
RUN apt-get install -y wpasupplicant
source ./Raspberry-Pi-4/wpa_supplicant.Pifile
##################################
# Installing essential packages
source ./Raspberry-Pi-4/packages.Pifile
##################################
# Installing neurobionicspi-cli
INSTALL "neurobionicspi-cli" "/etc/neurobionicspi-cli"
# Adding the right enterprise network information
RUN sed -i "s/entnetworkssid=\"\"/entnetworkssid=\"${entssid}\"/g" /etc/neurobionicspi-cli/install.sh
RUN sed -i "s/entnetworkssid=\"\"/entnetworkssid=\"${entssid}\"/g" /etc/neurobionicspi-cli/neurobionicspi-cli
RUN sh -c "sudo chown -R ${user} /etc/neurobionicspi-cli"
##################################
# Configuring message of the day (motd)
RUN bash -c "sudo rm -rf /etc/motd"
INSTALL "./Raspberry-Pi-4/motd" "/etc/motd"
RUN sh -c "cp /etc/motd /home/${user}/.bash_profile"
##################################
# Enable i2c and set baud rate
RUN bash -c "touch /etc/modules"
RUN bash -c "echo 'i2c-dev' >> /etc/modules"
RUN bash -c "echo 'i2c-bcm2708' >> /etc/modules"
RUN bash -c "echo 'dtparam=i2c_arm=on,i2c_arm_baudrate=400000' >> /boot/config.txt"
RUN bash -c "echo 'dtparam=i2c1=on' >> /boot/config.txt"
##################################
# Setting up startup_mailer and rc.local
source ./Raspberry-Pi-4/startup_mailer.Pifile
source ./Raspberry-Pi-4/rc_local.Pifile
##################################
echo "DONE!"