Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ TB_BURN_TOOL="$TB_FLASH_TOOL_DIR/tone-burn-tool"
KHADAS_BURN_TOOL="$BASE/burn-tool"
INSTALL_DIR="/usr/local/bin"

DISTRIB=$(cat /etc/lsb-release | grep "DISTRIB_ID" | awk -F "=" '{print $2}')
DISTRIB_RELEASE=$(cat /etc/lsb-release | grep "DISTRIB_RELEASE" | awk -F "=" '{print $2}')
echo $INSTALL_DIR
DISTRIB=$(cat /etc/os-release | grep "^ID=" | awk -F "=" '{print $2}')
echo $DISTRIB
DISTRIB_RELEASE=$(cat /etc/os-release | grep "^VERSION_ID=" | awk -F "=" '{print $2}')
echo $DISTRIB_RELEASE


RED='\033[0;31m'
Expand All @@ -23,6 +26,27 @@ error_msg() {
echo -e ${RED}Error:${RESET} $1
}

setup_fedora_host() {
local hostdeps="git parted lib32z1 lib32stdc++6 libusb1-devel libusb1 ccache libncurses5 pv base-files linux-base xz-utils"
local deps=()
# local installed=$(dpkg-query -W -f '${db:Status-Abbrev}|${binary:Package}\n' '*' 2>/dev/null | grep '^ii' | awk -F '|' '{print $2}' | cut -d ':' -f 1)
echo "Checking installed packages"
local installed=$(dnf list --installed ${hostdeps} | tail -n +2)

for packet in $hostdeps; do
if ! grep -q -x -e "$packet" <<< "$installed"; then deps+=("$packet"); fi
done

if [[ ${#deps[@]} -gt 0 ]]; then
echo "Installing dependencies"
echo "Requires root privileges, please enter your password!"
sudo dnf -y --no-install-recommends install "${deps[@]}"
sudo update-ccache-symlinks
else
echo "All packages present"
fi
}

setup_ubuntu_host() {
local hostdeps="libusb-dev git parted lib32z1 lib32stdc++6 libusb-0.1-4 libusb-1.0-0-dev libusb-1.0-0 ccache libncurses5 pv base-files linux-base xz-utils"
local deps=()
Expand Down Expand Up @@ -74,11 +98,15 @@ prepare_host() {
"\"Ubuntu\"")
setup_ubuntu_host
;;
"\"fedora\"")
setup_fedora_host
;;
*)
echo "$DISTRIB is unsupported"
esac
}

echo "Preparing ${DISTRIB}"
prepare_host

echo -e "Installing Amlogic flash-tool..."
Expand Down
14 changes: 7 additions & 7 deletions aml-flash-tool/INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ BASE=$(dirname "$(readlink -fm "$0")")
FLASH_TOOL="$BASE/flash-tool"
KHADAS_TOOL="$BASE/aml-burn-tool"
RULES_DIR="$BASE/rules"
DISTRIB=$(cat /etc/lsb-release | grep "DISTRIB_ID" | awk -F "=" '{print $2}')
DISTRIB_RELEASE=$(cat /etc/lsb-release | grep "DISTRIB_RELEASE" | awk -F "=" '{print $2}')
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=
Expand All @@ -33,27 +33,27 @@ warning_msg() {
}

if [ "$DISTRIB" != "Ubuntu" ]; then
warning_msg "This flash tool just support Ubuntu now, other distributions haven't been verified!"
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 be failed!!!"
warning_msg "You choose to not check the system environment, the installation may fail!"
fi
fi

echo "Installing USB rules..."

if [[ "$DISTRIB_RELEASE" =~ "12" ]]; then
if [[ "$DISTRIB" == "Ubuntu" && "$DISTRIB_RELEASE" =~ "12" ]]; then
RULE="$RULES_DIR/70-persistent-usb-ubuntu12.rules"
sudo cp $RULE /etc/udev/rules.d
sudo sed -i s/OWNER=\"amlogic\"/OWNER=\"`whoami`\"/g /etc/udev/rules.d/$(basename $RULE)
elif [[ "$IGNORE_CHECK" == "yes" || "$DISTRIB_RELEASE" =~ "14" || "$DISTRIB_RELEASE" =~ "16" || "$DISTRIB_RELEASE" =~ "18" || "$DISTRIB_RELEASE" =~ "19" || "$DISTRIB_RELEASE" =~ "20" || "$DISTRIB_RELEASE" =~ "22" || "$DISTRIB_RELEASE" =~ "24" ]]; then
elif [[ "$IGNORE_CHECK" == "yes" || "$DISTRIB" == "Ubuntu" && ("$DISTRIB_RELEASE" =~ "14" || "$DISTRIB_RELEASE" =~ "16" || "$DISTRIB_RELEASE" =~ "18" || "$DISTRIB_RELEASE" =~ "19" || "$DISTRIB_RELEASE" =~ "20" || "$DISTRIB_RELEASE" =~ "22" || "$DISTRIB_RELEASE" =~ "24") ]]; then
RULE="$RULES_DIR/70-persistent-usb-ubuntu14.rules"
sudo cp $RULE /etc/udev/rules.d
else
error_msg "Ubuntu $DISTRIB_RELEASE haven't been verified!"
error_msg "Distribution $DISTRIB $DISTRIB_RELEASE hasn't been verified!"
exit 1
fi

Expand Down
12 changes: 6 additions & 6 deletions rk-flash-tool/INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ 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/lsb-release | grep "DISTRIB_ID" | awk -F "=" '{print $2}')
DISTRIB_RELEASE=$(cat /etc/lsb-release | grep "DISTRIB_RELEASE" | awk -F "=" '{print $2}')
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=
Expand All @@ -34,23 +34,23 @@ warning_msg() {
}

if [ "$DISTRIB" != "Ubuntu" ]; then
warning_msg "This flash tool just support Ubuntu now, other distributions haven't been verified!"
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 be failed!!!"
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_RELEASE" =~ "16" || "$DISTRIB_RELEASE" =~ "18" || "$DISTRIB_RELEASE" =~ "20" || "$DISTRIB_RELEASE" =~ "22" || "$DISTRIB_RELEASE" =~ "24" ]]; then
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 "Ubuntu $DISTRIB_RELEASE haven't been verified!"
error_msg "Distribution $DISTRIB $DISTRIB_RELEASE hasn't been verified!"
exit 1
fi

Expand Down
12 changes: 6 additions & 6 deletions tone-dfu-tool/INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ set -e -o pipefail
BASE=$(dirname "$(readlink -fm "$0")")
KHADAS_TOOL="$BASE/tone-burn-tool"
RULES_DIR="$BASE/rules"
DISTRIB=$(cat /etc/lsb-release | grep "DISTRIB_ID" | awk -F "=" '{print $2}')
DISTRIB_RELEASE=$(cat /etc/lsb-release | grep "DISTRIB_RELEASE" | awk -F "=" '{print $2}')
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=
Expand All @@ -32,23 +32,23 @@ warning_msg() {
}

if [ "$DISTRIB" != "Ubuntu" ]; then
warning_msg "This burn tool just support Ubuntu now, other distributions haven't been verified!"
warning_msg "This burn 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 be failed!!!"
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_RELEASE" =~ "16" || "$DISTRIB_RELEASE" =~ "18" || "$DISTRIB_RELEASE" =~ "20" || "$DISTRIB_RELEASE" =~ "22" || "$DISTRIB_RELEASE" =~ "24" ]]; then
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-tone-usb.rules"
sudo cp $RULE /etc/udev/rules.d
else
error_msg "Ubuntu $DISTRIB_RELEASE haven't been verified!"
error_msg "Distribution $DISTRIB $DISTRIB_RELEASE hasn't been verified!"
exit 1
fi

Expand Down