1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/anolis-ancert

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
install.sh 2.5 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
smj01095381 Отправлено 12.04.2024 12:07 7c498a9
#!/usr/bin/env bash
PKGS=
BASEDIR=$(cd `dirname $0`; pwd)
function get_all_depend_pkgs() {
local dist_ver=$(rpm -E %{?dist}|awk '{sub(".an","");print}')
cd $BASEDIR
PKGS=$(awk -v RS=" " '!a[$1]++' <<<"`cat ancert.spec|grep -w "Requires:"|awk -F ':' '{print $2}'|awk '/,/gsub(/,/," ")'|xargs echo`")
# Support different Anolis OS version
if test "$dist_ver" -ge 7 && test "$dist_ver" -lt 8;then
PKGS="$(echo $PKGS|sed -e 's/\(python3-pyyaml\|clang\|x11perf\|xdpyinfo\|xvinfo\|xset\|memstrack\)//g')"
elif test "$dist_ver" -ge 8 && test "$dist_ver" -lt 23;then
PKGS="$(echo $PKGS|sed -e 's/\(python36-PyYAML\|x11perf\|xdpyinfo\|xvinfo\|xset\)//g')"
elif test "$dist_ver" -ge 23;then
PKGS="$(echo $PKGS|sed -e 's/\(xorg-x11-utils\|xorg-x11-server-utils\|xorg-x11-apps\|stress-ng\|python36-PyYAML\)//g')"
fi
echo -e "Get all dependent package information:\n${PKGS}"
}
function install_all_depend_pkgs() {
get_all_depend_pkgs
if test -f /etc/os-release;then
if ! cat /etc/os-release|grep PRETTY_NAME|grep -iwq Anolis;then
echo "Error: please install it in Anolis OS system!" && exit 1
fi
else
echo "Error: no such file /etc/os-release, please install it in Anolis OS system!" && exit 1
fi
echo -e "\ninstall dependent package information:"
for pkg in $PKGS;do
yum list installed |grep -Ewq "^`echo $pkg|sed -e 's|\+|\\\+|g'`\.(`arch`|noarch)" && continue ||:
cmd="yum install ${pkg} -y"
echo -e "\033[1;40;32m\n${cmd}\033[0m"
eval $cmd
[ $? -eq 0 ] || exit 1
done
}
function source_code_to_install() {
cd $BASEDIR
_ancert=$(rpmspec -P ancert.spec|egrep "Name"|awk '{print $NF}')
[ X"${_ancert}" = X"" ] && echo "Failed to get Name from ancert.spec." && exit 1
# rpm installation
if rpm -qa|grep "$_ancert" >/dev/null 2>&1;then
rpm -e $_ancert || { echo -e "\nFaild to uninstall $_ancert, please execute the command: rpm -e $_ancert";exit 1; }
else
# Source unload
if which ancert &>/dev/null;then
make uninstall || { echo "Failed to make uninstall";exit 1; }
fi
fi
echo "make install."
make install || { echo -e "\nSource code installation failed, please execute the command:make uninstall && make install";exit 1; }
[ -f "`rpm -E %{_datadir}`/${_ancert}/${_ancert}.spec" ] && rm -rf "`rpm -E %{_datadir}`/${_ancert}/${_ancert}.spec"
}
# # # # # # # # # # # # # # main # # # # # # # # # # # #
install_all_depend_pkgs
source_code_to_install

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/anolis-ancert.git
git@api.gitlife.ru:oschina-mirror/anolis-ancert.git
oschina-mirror
anolis-ancert
anolis-ancert
master