On Mon, Feb 08, 2021 at 11:40:51AM +0800, Wang Yong wrote:
[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 | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/sbin/install-dependencies.sh b/sbin/install-dependencies.sh index b5b070f01..ed8aeb927 100755 --- a/sbin/install-dependencies.sh +++ b/sbin/install-dependencies.sh @@ -5,28 +5,36 @@ 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
- 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
- pacman)
;; *)sudo "$installer" -Sy --noconfirm --needed ruby rubygems gcc make git lftp util-linux
echo "$ID not support! please install dependencies manually." && exit 1
echo "Unknown Package Manager! please install dependencies manually." && exit 1
echo the $installer?
Thanks, Xueliang
;;
esac }
+get_package_manager() +{
- has_cmd "yum" && installer="yum"
- has_cmd "dnf" && installer="dnf" && return
- has_cmd "apt-get" && installer="apt-get" && return
- has_cmd "pacman" && installer="pacman" && return
+}
mac_dep() { brew install ruby -- 2.23.0