-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·81 lines (60 loc) · 1.82 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
#!/bin/bash
set -e
echo_red() {
echo -e "\r\033[31m$1\033[0m"
}
echo_green() {
echo -e "\r\033[32m$1\033[0m"
}
echo_blue() {
echo -e "\r\033[36m$1\033[0m"
}
PATH_PWD="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
VERSION=$(uname -r)
VERSION_digit=${VERSION:0:1}
# # 判断linux版本是否支持
# case $VERSION_digit in
# 5|6)
# echo_green "[OK]\t linux version is $VERSION "
# ;;
# *)
# echo_red "\n\nERROR: no support you linux version : \t$VERSION \n\n"
# exit -1
# ;;
# esac
# 树莓派要安装kernel-headers
if [[ -f /proc/device-tree/model ]]; then
Board_model=$(cat "/proc/device-tree/model")
if [[ ${Board_model} == "Raspberry" ]]; then
sudo apt-get update
sudo apt-get install cmake -y
echo_blue "Start to install the raspberrypi-kernel-headers"
apt install raspberrypi-kernel-headers xserver-xorg-input-evdev
if [[ -f /usr/lib/modules/$(uname -r)//build/Makefile ]]; then
echo_green "[OK]\t kernel-headers has been installed"
else
echo_red "\n\nERROR: can not find kernel-headers \n\n"
fi
fi
fi
# 为系统添加set-lcd命令
chmod +x $PATH_PWD/set-lcd
bin_path="/usr/bin/set-lcd"
if [ -f $bin_path ]; then
rm $bin_path
fi
if [ ! -e $bin_path ]; then
ln -s ${PATH_PWD}/set-lcd ${bin_path}
fi
if [[ ! -d /etc/bash_completion.d/ ]]; then
mkdir /etc/bash_completion.d/
fi
cp ${PATH_PWD}/completion.sh /etc/bash_completion.d/set-lcd
bash_str="source /etc/bash_completion.d/set-lcd"
if ! grep -q ${bash_str} /etc/bash.bashrc; then
echo ${bash_str} >> /etc/bash.bashrc
fi
echo_green "[OK]\t set-lcd is ready"
echo_green "\n\nplease run this command :"
echo_green "\n\t source /etc/bash_completion.d/set-lcd \n\n"
# echo -e "\033[32m[ok]\033[0m"