-
Notifications
You must be signed in to change notification settings - Fork 91
Expand file tree
/
Copy pathINSTALL
More file actions
executable file
·68 lines (54 loc) · 1.85 KB
/
INSTALL
File metadata and controls
executable file
·68 lines (54 loc) · 1.85 KB
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
#!/bin/bash
set -e -o pipefail
BASE=$(dirname "$(readlink -fm "$0")")
FLASH_TOOL="$BASE/flash-tool"
ANDROID_TOOL_CONFIG="$BASE/tools/Linux_Upgrade_Tool/config.ini"
KHADAS_TOOL="$BASE/rk-burn-tool"
RULES_DIR="$BASE/rules"
DISTRIB=$(cat /etc/os-release | grep "^ID=" | awk -F "=" '{print $2}')
DISTRIB_RELEASE=$(cat /etc/os-release | grep "^VERSION_ID=" | awk -F "=" '{print $2}')
INSTALL_DIR="/usr/local/bin"
RULE=
RED='\033[0;31m'
YELLOW="\e[0;33m"
RESET='\033[m'
echo ""
echo "==============================================="
echo ""
echo "Host PC: $DISTRIB $DISTRIB_RELEASE"
echo ""
echo "==============================================="
echo ""
error_msg() {
echo -e ${RED}Error:${RESET} $1
}
warning_msg() {
echo -e ${YELLOW}Warning:${RESET} $1
}
if [ "$DISTRIB" != "Ubuntu" ]; then
warning_msg "This flash tool only officially supports Ubuntu now, other distributions haven't been verified!"
read -p "Continue any way? [No/yes] " answer
if [[ "$answer" != "yes" && "$answer" != "Yes" ]]; then
exit 1
else
IGNORE_CHECK=yes
warning_msg "You choose to not check the system environment, the installation may fail!"
fi
fi
echo "Installing USB rules..."
if [[ "$IGNORE_CHECK" == "yes" || "$DISTRIB" == "Ubuntu" && ("$DISTRIB_RELEASE" =~ "16" || "$DISTRIB_RELEASE" =~ "18" || "$DISTRIB_RELEASE" =~ "20" || "$DISTRIB_RELEASE" =~ "22" || "$DISTRIB_RELEASE" =~ "24") ]]; then
RULE="$RULES_DIR/80-rockchip-usb.rules"
sudo cp $RULE /etc/udev/rules.d
else
error_msg "Distribution $DISTRIB $DISTRIB_RELEASE hasn't been verified!"
exit 1
fi
sudo udevadm control --reload-rules
echo "Installing flash-tool..."
mkdir -p $INSTALL_DIR
sudo ln -fs $KHADAS_TOOL $INSTALL_DIR/$(basename $KHADAS_TOOL)
# Install configuration for Linux_Upgrade_Tool
echo "Installing configuration..."
mkdir -p ~/.config/upgrade_tool
cp $ANDROID_TOOL_CONFIG ~/.config/upgrade_tool/
echo "Done!"