-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnodeSetup.sh
More file actions
executable file
·59 lines (59 loc) · 1.78 KB
/
nodeSetup.sh
File metadata and controls
executable file
·59 lines (59 loc) · 1.78 KB
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
#!/bin/bash
echo "Enter a name for this node [Example name: node1]"
read -p "---->" name;
echo "Initializing $name"
echo "Adding user pi to dialout"
usermod -a -G dialout pi
cd /home/pi
echo "Downloading git"
apt-get install -y git
echo "Enabling push down button"
echo 'dtoverlay=gpio-shutdown, gpio_pin=3' >> /boot/config.txt
echo "Installing rpi.gpio"
apt-get install -y rpi.gpio
echo "installing numpy"
apt-get install -y python3-numpy
echo "Installing pip3"
apt-get install -y python3-pip
echo "Installing pyserial"
#pip3 install -y pyserial
apt-get install -y python3-serial
echo "Enabling serial UART"
sed -i -e 's/ console=serial0,115200//g' /boot/cmdline.txt
echo 'enable_uart=1' >> /boot/config.txt
echo "Enabling SPI"
echo 'dtparam=spi=on' >> /boot/config.txt
echo "Downloading LMIC"
git clone https://github.com/jp-chickadee-project/lmic-rpi-lora-gps-hat.git
chown -R pi:pi lmic-rpi-lora-gps-hat
cd /home/pi/lmic-rpi-lora-gps-hat
git checkout $name
cd /home/pi
echo "Downloading Mastercode"
git clone https://github.com/jp-chickadee-project/MasterCode.git
cd MasterCode
mkdir transmit backup
cd ..
chown -R pi:pi MasterCode
echo "Adding brain.py to /etc/rc.local"
sed -i '$i \python3 /home/pi/MasterCode/brain.py &\n' /etc/rc.local
echo "Downloading WiringPi"
apt-get install -y wiringpi
echo "Enabling SSH."
systemctl enable ssh
echo "Changing keyboard layout"
sed -i -e 's/XKBLAYOUT="gb"/XKBLAYOUT="us"/g' /etc/default/keyboard
echo "Changing Hostname"
sed -i -e "s/raspberrypi/$name/g" /etc/hostname
sed -i -e "s/raspberrypi/$name/g" /etc/hosts
echo "Installing fail2ban"
apt-get install -y fail2ban
apt-get install -y figlet
cd /home/pi/node
./login_setup.sh
mv brain.service /lib/systemd/system
systemctl daemon-reload
systemctl enable brain.service
shutdown -r +1
rm /home/pi/node/login_setup.sh
rm -- $0