On Sun, Feb 07, 2021 at 07:40:24PM +0800, Wang Yong wrote:
pls ignore
Thanks, Yong
[before] install packages from $DISTRO detect
[after] install packages from Package Manager
it's not convenient when install packages in a new $DISTRO
Signed-off-by: Wang Yong wangyong0117@qq.com
sbin/install-dependencies.sh | 40 +++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 12 deletions(-)
diff --git a/sbin/install-dependencies.sh b/sbin/install-dependencies.sh index b5b070f01..ac2974ef1 100755 --- a/sbin/install-dependencies.sh +++ b/sbin/install-dependencies.sh @@ -5,28 +5,44 @@ PROJECT_DIR=$(dirname $SCRIPT_DIR)
. $PROJECT_DIR/lib/env.sh
-# choose install function base on DISTRIBUTION +# choose install function base on common Package Manager linux_dep() {
- source /etc/os-release
- case $ID in
- ubuntu|debian)
- get_package_manager
- case "$installer" in
- apt-get) export DEBIAN_FRONTEND=noninteractive
sudo apt-get install -yqm ruby-dev libssl-dev gcc g++ uuid-runtime
sudo "$installer" install -yqm ruby-dev libssl-dev gcc g++ uuid-runtime
;;
- dnf|yum)
sudo "$installer" install -y --skip-broken ruby rubygems gcc gcc-c++ make ruby-devel git lftp util-linux
;;
- pacman)
sudo "$installer" -Sy --noconfirm --needed ruby rubygems gcc make git lftp util-linux
;;
- zypper)
;;sudo "$installer" install -y ruby ruby-devel gcc gcc-c++ make git lftp util-linux
- openEuler|fedora|rhel|centos)
if type dnf > /dev/null 2>&1; then
sudo dnf install -y --skip-broken ruby rubygems gcc gcc-c++ make ruby-devel git lftp util-linux
else
sudo yum install -y --skip-broken ruby rubygems gcc gcc-c++ make ruby-devel git lftp util-linux
fi
- emerge)
;; *)sudo "$installer" ruby rubygems gcc make dev-vcs/git lftp util-linux
echo "$ID not support! please install dependencies manually." && exit 1
;; esacecho "Unknown Package Manager! please install dependencies manually." && exit 1
}
+get_package_manager() +{
- has_cmd "yum" && installer="yum"
- has_cmd "dnf" && installer="dnf"
- has_cmd "apt-get" && installer="apt-get"
- has_cmd "pacman" && installer="pacman"
- has_cmd "zypper" && installer="zypper"
- has_cmd "emerge" && installer="emerge"
+}
mac_dep() { brew install ruby -- 2.23.0