-
Notifications
You must be signed in to change notification settings - Fork 32
/
install_new_DIY.sh
executable file
·81 lines (59 loc) · 2.96 KB
/
install_new_DIY.sh
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
#!/bin/bash
# Welcome!
# Just want to get a few things out of the way. This script assumes you're running this on a raspberry pi 4 with raspberian lite freshly installed.
sudo apt update -y
sudo apt upgrade -y
sudo apt install curl jq docker.io git vim gcc build-essential -y
sudo usermod -aG docker pi
mkdir ~/miner_data
cd ~
git clone https://github.com/Lora-net/packet_forwarder
git clone https://github.com/Lora-net/lora_gateway
cd packet_forwarder/lora_pkt_fwd
mv ~/packet_forwarder/lora_pkt_fwd/global_conf.json ~/packet_forwarder/lora_pkt_fwd/global_conf.json.1
curl -s -o ~/packet_forwarder/lora_pkt_fwd/global_conf.json 'https://helium-media.s3-us-west-2.amazonaws.com/global_conf.json'
#wget https://helium-media.s3-us-west-2.amazonaws.com/global_conf.json --backups
#sed link
sed -i 's/#define SPI_SPEED 8000000/#define SPI_SPEED 2000000/' /home/pi/lora_gateway/libloragw/src/loragw_spi.native.c
cd /home/pi/packet_forwarder/
./compile.sh
sudo cp ~/helium_miner_scripts/service_files/lora-gw-restart.service /etc/systemd/system/lora-gw-restart.service
sudo cp ~/helium_miner_scripts/service_files/lora-pkt-fwd.service /etc/systemd/system/lora-pkt-fwd.service
sudo systemctl enable lora-gw-restart.service
sudo systemctl enable lora-pkt-fwd.service
sudo systemctl start lora-gw-restart.service
sudo systemctl start lora-pkt-fwd.service
#i'm an idiot for including this
#cd ~
#git clone https://github.com/Wheaties466/helium_miner_scripts.git
sudo touch ~/crondump
sudo chmod 777 ~/crondump
sudo crontab -l > ~/crondump
echo "0 */4 * * * /home/pi/helium_miner_scripts/miner_latest.sh 2>&1 >> /var/log/miner_latest.log" >> ~/crondump
echo "0 0 * * * cd /home/pi/helium_miner_scripts && git pull" >> ~/crondump
sudo crontab -u pi ~/crondump
sudo touch /var/log/miner_latest.log
sudo chmod 777 /var/log/miner_latest.log
echo "remember to backup your swarm key found here: /home/pi/miner_data/miner/swarm_key"
echo "use WinSCP(or another program) to transfer this file to another computer and back it up. This is VERY IMPORTANT"
ip=$(hostname -I | cut -d" " -f1)
echo "if you want to download the file in the web browser, run the following command after reboot."
echo "/home/pi/helium_miner_scripts/miner_latest.sh && cd /home/pi/miner_data/miner/ && python -m SimpleHTTPServer 3000"
echo " CTRL + C will cancel the webserver, but open a web browser and go to http://"$ip":3000/swarm_key"
echo "Save the file locally"
# I think one of these was causing issues booting after applying.
sudo raspi-config nonint do_spi 0
sudo raspi-config nonint do_i2c 0
sudo raspi-config nonint do_serial 0
#sudo raspi-config nonint do_wifi_country US
#sudo raspi-config nonint do_ssh 0
locale=en_US.UTF-8
layout=us
sudo raspi-config nonint do_change_locale $locale
sudo raspi-config nonint do_configure_keyboard $layout
#add swap
sudo dphys-swapfile swapoff
sudo sed -i -e 's/CONF_SWAPSIZE=100/CONF_SWAPSIZE=1024/g' /etc/dphys-swapfile
echo "rebooting the pi in 10 seconds, CTRL + C to stop"
sleep 10
sudo reboot