forked from brickbots/PiFinder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pifinder_post_update.sh
51 lines (41 loc) · 1.65 KB
/
pifinder_post_update.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
git submodule update --init --recursive
sudo pip install -r /home/pifinder/PiFinder/python/requirements.txt
# GPSD
sudo apt install -y gpsd
sudo dpkg-reconfigure -plow gpsd
sudo cp ~/PiFinder/pi_config_files/gpsd.conf /etc/default/gpsd
# PWM
sudo sed -zi '/dtoverlay=pwm,pin=13,func=4\n/!s/$/\ndtoverlay=pwm,pin=13,func=4\n/' /boot/config.txt
# Uart for GPS
sudo sed -zi '/dtoverlay=uart3\n/!s/$/\ndtoverlay=uart3\n/' /boot/config.txt
# Migrate DB
if [ -f "/home/pifinder/PiFinder/astro_data/observations.db" ]
then
echo "Migrating astro_data DB"
python -c "from PiFinder import setup;setup.create_logging_tables();"
sqlite3 < /home/pifinder/PiFinder/migrate_db.sql
rm /home/pifinder/PiFinder/astro_data/observations.db
fi
# Migrate Config files
if ! [ -f "/home/pifinder/PiFinder_data/config.json" ]
then
echo "Migrating config.json"
mv /home/pifinder/PiFinder/config.json /home/pifinder/PiFinder_data/config.json
fi
# Adjust service definition
sudo systemctl disable pifinder
sudo rm /etc/systemd/system/pifinder.service
sudo cp /home/pifinder/PiFinder/pi_config_files/pifinder.service /lib/systemd/system/pifinder.service
sudo systemctl daemon-reload
sudo systemctl enable pifinder
# add PiFinder_splash if not already in place
if ! [ -f "/lib/systemd/system/pifinder_spash.service" ]
then
sudo cp /home/pifinder/PiFinder/pi_config_files/pifinder_splash.service /lib/systemd/system/pifinder_splash.service
sudo systemctl daemon-reload
sudo systemctl enable pifinder_splash
fi
# open permissisons on wpa_supplicant file so we can adjust network config
sudo chmod 666 /etc/wpa_supplicant/wpa_supplicant.conf
# DONE
echo "Post Update Complete"