Refactor
This commit is contained in:
@@ -11,41 +11,12 @@ build_and_install() {
|
||||
}
|
||||
|
||||
install_build_dependencies() {
|
||||
install_packages cmake gcc
|
||||
ensure_libjpeg_is_fast
|
||||
|
||||
if [ "$DISTRO" = centos ]; then
|
||||
yum install -y cmake gcc
|
||||
return
|
||||
fi
|
||||
if [ "$DISTRO" = oracle ]; then
|
||||
dnf install -y cmake gcc
|
||||
return
|
||||
fi
|
||||
if [ "$DISTRO" = opensuse ]; then
|
||||
zypper install -y cmake gcc
|
||||
return
|
||||
fi
|
||||
|
||||
apt-get update
|
||||
apt-get install -y cmake gcc
|
||||
}
|
||||
|
||||
ensure_libjpeg_is_fast() {
|
||||
if [ "$DISTRO" = centos ]; then
|
||||
yum install -y nasm
|
||||
return
|
||||
fi
|
||||
if [ "$DISTRO" = oracle ]; then
|
||||
dnf install -y nasm
|
||||
return
|
||||
fi
|
||||
if [ "$DISTRO" = opensuse ]; then
|
||||
zypper install -y nasm
|
||||
return
|
||||
fi
|
||||
|
||||
apt-get update
|
||||
apt-get install -y nasm
|
||||
install_packages nasm
|
||||
}
|
||||
|
||||
prepare_libjpeg_source() {
|
||||
|
||||
@@ -12,4 +12,17 @@ detect_distro() {
|
||||
fi
|
||||
}
|
||||
|
||||
install_packages() {
|
||||
local install_cmd=no-command-defined
|
||||
|
||||
case "$DISTRO" in
|
||||
centos) install_cmd="yum install -y" ;;
|
||||
oracle) install_cmd="dnf install -y" ;;
|
||||
opensuse) install_cmd="zypper install -y" ;;
|
||||
*) install_cmd="apt-get update && apt-get install -y"
|
||||
esac
|
||||
|
||||
eval "$install_cmd $*"
|
||||
}
|
||||
|
||||
detect_distro
|
||||
|
||||
Reference in New Issue
Block a user