forked from alanbjohnston/CubeSatSim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·179 lines (107 loc) · 3.85 KB
/
install
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#!/bin/bash
echo -e "\ninstallation script for CubeSatSim v1.2\n"
FILE=/home/pi/CubeSatSim/sim.cfg
if [ -f "$FILE" ]; then
echo "$FILE exists."
else
echo "creating $FILE"
echo "AMSAT 1 0.0 0.0" > /home/pi/CubeSatSim/sim.cfg
fi
cd
CubeSatSim/config -c -n
CubeSatSim/config -l -n
sudo apt-get update && sudo apt-get dist-upgrade -y
# removed wiringpi and python-picamera python3-picamera
sudo apt-get install -y git libasound2-dev i2c-tools build-essential libgd-dev libmagic-dev minicom
cd /tmp
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
cd
#changed to python3-smbus
sudo apt install -y python3-pip python3-smbus
sudo pip3 install --upgrade setuptools
sudo pip3 install adafruit-blinka RPI.GPIO adafruit-extended-bus adafruit-circuitpython-ina219
cd ~/CubeSatSim
git pull
make debug
FILE=/home/pi/CubeSatSim/.mode
if [ -f "$FILE" ]; then
echo "$FILE exists."
else
echo "creating $FILE"
echo "ARG1=f" > .mode
fi
cd
git clone https://github.com/alanbjohnston/direwolf.git
cd direwolf
make -j
sudo make install
make install-rpi
cd
git clone https://github.com/alanbjohnston/pi-power-button.git
cd pi-power-button
git checkout master
./script/install
cd
git clone https://github.com/alanbjohnston/PiSSTVpp.git
cd PiSSTVpp
make pisstvpp
echo "Copying SSTV image 1"
cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg
echo "Copying SSTV image 2"
cp /home/pi/CubeSatSim/sstv/sstv_image_2_320_x_256.jpg /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg
cd
git clone https://github.com/alanbjohnston/rpitx.git
cd rpitx
./install.sh
cd
sudo cp ~/CubeSatSim/systemd/cubesatsim.service /etc/systemd/system/cubesatsim.service
sudo systemctl enable cubesatsim
sudo cp ~/CubeSatSim/systemd/rpitx.service /etc/systemd/system/rpitx.service
sudo systemctl enable rpitx
sudo cp /boot/config.txt /boot/config.txt.0
sudo cp /boot/cmdline.txt /boot/cmdline.txt.0
sudo raspi-config nonint do_i2c 0
sudo raspi-config nonint do_camera 0
sudo raspi-config nonint do_legacy 0
#if [ "$1" = "u" ]; then
#fi
sudo sed -i 's/console=serial0,115200 //g' /boot/cmdline.txt
sudo sed -i 's/#dtparam=i2c_arm=on/dtparam=i2c_arm=on/g' /boot/config.txt
if [[ $(grep 'dtoverlay=i2c-gpio,bus=3,i2c_gpio_delay_us=1,i2c_gpio_sda=23,i2c_gpio_scl=24' /boot/config.txt) ]]; then
echo "dtoverlay=i2c-gpio already in /boot/config.txt"
else
echo "adding dtoverlay=i2c-gpio to /boot/config.txt"
sudo sh -c 'echo "\ndtoverlay=i2c-gpio,bus=3,i2c_gpio_delay_us=1,i2c_gpio_sda=23,i2c_gpio_scl=24" >> /boot/config.txt'
fi
if [[ $(grep 'enable_uart=1' /boot/config.txt) ]]; then
echo "enable_uart=1 already in /boot/config.txt"
else
echo "adding enable_uart=1 to /boot/config.txt"
sudo sh -c 'echo "\nenable_uart=1" >> /boot/config.txt'
fi
if [[ $(grep 'dtoverlay=disable-bt' /boot/config.txt) ]]; then
echo "dtoverlay=disable-bt already in /boot/config.txt"
else
echo "adding dtoverlay=disable-bt to /boot/config.txt"
sudo sh -c 'echo "\ndtoverlay=disable-bt" >> /boot/config.txt'
fi
if [[ $(grep 'dtoverlay=dwc2' /boot/config.txt) ]]; then
echo "dtoverlay=dwc2 aalready in /boot/config.txt"
else
echo "adding dtoverlay=dwc2 to /boot/config.txt"
sudo sh -c 'echo "\ndtoverlay=dwc2" >> /boot/config.txt'
fi
if [[ $(grep 'modules-load=dwc2,g_ether' /boot/cmdline.txt) ]]; then
echo "modules-load=dwc2,g_ether already in /boot/cmdline.txt"
else
echo "adding modules-load=dwc2,g_ether to /boot/cmdline.txt"
sudo sed -i 's/ rootwait/ rootwait modules-load=dwc2,g_ether/g' /boot/cmdline.txt
fi
echo "Would you like to reboot to complete the installation (y/n)?"
read -r ANS
if [ "$ANS" = "y" ]; then
sudo reboot now
else
echo "The CubeSatSim software will start next time you reboot"
fi