-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·121 lines (99 loc) · 3.39 KB
/
install.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
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
#!/bin/bash
USER=moi
DIR=`pwd`
DIR_LIB=$DIR/lib
# ----------------------------------
function install_Sound(){
echo "\n** Enable the Audio code ..................................
- Run armbian-config , enable audio codec in System/Hardware
"
}
# ----------------------------------
function install_WiringOP(){
# for direct gpio command
echo "\n** Install : WiringOP ................................"
cd $DIR_LIB
git clone https://github.com/zhaolei/WiringOP.git -b h3
cd WiringOP
chmod +x ./build
./build
gpio readall
}
# ----------------------------------
function install_RPI_for_Matrix(){
#https://forum.armbian.com/topic/840-h3-spi/?page=2
echo "\n** Enable the RPI module ..................................
- Run armbian-config , enable rpi-rpidev in System/Hardware
- add the following in /boot/armbianEnv.txt
param_spidev_spi_bus=0
#param_spidev_spi_cs=0
param_spidev_max_freq=1000000
"
}
# ----------------------------------
function install_Matrix(){
#https://luma-led-matrix.readthedocs.io/en/latest/install.html
echo "\n** Install Led Matrix .................................."
apt-get install build-essential python-dev python-pip libfreetype6-dev libjpeg-dev python-setuptools
pip --version
pip install wheel
pip install --upgrade luma.led_matrix
#https://projetsdiy.fr/orange-pi-onelite-gpio-python-broches-pinout/
echo "\n** Install OrangePi GPIO .................................."
pip install pyA20
cd $DIR_LIB
git clone https://github.com/duxingkei33/orangepi_PC_gpio_pyH3
#git clone https://github.com/nvl1109/orangepi_zero_gpio
cd orangepi_PC_gpio_pyH3
python setup.py install
}
# ----------------------------------
function install_tm1637(){
echo "\n** Install : tm1637 ................................"
cd $DIR_LIB
git clone https://github.com/soif/tm1637-python.git
cd python-tm1637
pip install --upgrade OPi.GPIO
}
# ----------------------------------
function install_nginx_php(){
echo "\n** Install : php ................................"
apt-get install nginx
apt-get install nginx php-cli php-fpm php-curl
systemctl enable php7.0-fpm
ln -s $DIR/var/etc/nginx/nestor_site /etc/nginx/sites-available/nestor_site
ln -s /etc/nginx/sites-available/nestor_site /etc/nginx/sites-enabled/nestor_site
rm /etc/nginx/sites-enabled/default
service nginx restart
chmod 755 /root/
}
# ----------------------------------
function fix_dhcp(){
echo "\n** Prevent DHCP to write in resolv.conf ................................"
echo 'make_resolv_conf() { :; }' > /etc/dhcp/dhclient-enter-hooks.d/leave_my_resolv_conf_alone
chmod 755 /etc/dhcp/dhclient-enter-hooks.d/leave_my_resolv_conf_alone
}
# ----------------------------------
function install_daemon(){
echo "\n** Install daemon ................................"
ln -s $DIR/var/etc/systemd/nestor.service /etc/systemd/system/nestor.service
ln -s $DIR/var/etc/systemd/nestor_clock.service /etc/systemd/system/nestor_clock.service
systemctl enable nestor.service
systemctl enable nestor_clock.service
#service nestor start
#service nestor_clock start
}
##########################################################################################
# MAIN
##########################################################################################
echo ""
echo " ## Installing required packages ##"
echo ""
#install_Sound
#install_WiringOP
#install_RPI_for_Matrix
#install_Matrix
#install_tm1637
#install_nginx_php
#fix_dhcp
#install_daemon