forked from sunfounder/SunFounder_Dragit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·98 lines (86 loc) · 2.92 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
#!/bin/bash
##Tested on:
#- Raspbian (RaspberryPi - think of those possibilities)
if [ "$(whoami)" != "root" ] ; then
echo -e "You must run this script as root."
end
fi
###################################
# install Django #
###################################
echo -e "\nInstalling django \n"
if sudo pip install 'django<2.0' ; then
echo -e " Successfully installed django runtime \n"
else
echo -e " Failed to installed django."
end
fi
###################################
# python setup.py Emo #
###################################
echo -e "\nInstalling django \n"
if sudo pip install SunFounder_Emo ; then
echo -e " Successfully setup SunFounder_Emo \n"
else
echo -e " Failed to setup SunFounder_Emo."
end
fi
###################################
# install python-pylirc #
###################################
echo -e "\nInstalling lirc"
if sudo apt-get install -y lirc ; then
echo -e " Successfully installed python-pylirc runtime \n"
else
echo -e " Failed to installed python-pylirc."
end
fi
sudo cp ./Dragit/Dragit/libs/modules/hardware.conf /etc/lirc/
sudo cp ./Dragit/Dragit/libs/modules/lircd.conf /etc/lirc/
sudo cp ./Dragit/Dragit/libs/modules/pylirc_conf /etc/lirc/
echo -e "\nInstalling python-pylirc \n"
if sudo apt-get install -y python-pylirc ; then
echo -e " Successfully installed python-pylirc runtime \n"
else
echo -e " Failed to installed python-pylirc."
end
fi
###################################
# setup /boot/config.txt Enable I2C1 #
###################################
# Add lines to /boot/config.txt
echo -e "\nEnalbe interfaces..."
egrep -v "^#|^$" /boot/config.txt > config.txt.temp # pick up all uncomment configrations
if grep -q 'dtparam=i2c_arm=on' config.txt.temp; then # whether i2c_arm in uncomment configrations or not
echo -e ' Seem i2c_arm parameter already set, skip this step \n'
else
echo -e ' dtparam=i2c_arm=on \n' >> /boot/config.txt
fi
if grep -q 'dtparam=spi=on' config.txt.temp; then # whether spi in uncomment configrations or not
echo -e ' Seem spi parameter already set, skip this step \n'
else
echo -e ' dtparam=spi=on \n' >> /boot/config.txt
fi
if grep -q 'dtoverlay=w1-gpio' config.txt.temp; then
echo -e ' Seem w1-gpio parameter already set, skip this step \n'
else
echo -e ' dtoverlay=w1-gpio \n' >> /boot/config.txt
fi
if grep -q 'dtoverlay=lirc-rpi:gpio_in_pin=26' config.txt.temp; then
echo -e ' Seem lirc gpio_in_pin=26 parameter already set, skip this step \n'
else
echo -e ' dtoverlay=lirc-rpi:gpio_in_pin=26 \n' >> /boot/config.txt
fi
rm config.txt.temp
echo -e " Done\n"
###################################
# Startup Dragit #
###################################
echo -e "\nSetting up Dragit..."
cd bin
sudo chmod +x dragit
sudo cp dragit /etc/init.d/dragit
sudo update-rc.d dragit defaults
echo -e " Done \n"
echo -e" Reboot your pi to take effect or do it later"
#sudo reboot