26 Star 51 Fork 54

anolis/hygon-devkit

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
common.sh 1.45 KB
一键复制 编辑 原始数据 按行查看 历史
huzhenglang 提交于 2025-04-30 11:35 +08:00 . fix: unlimit install for the hml and compiler
#!/bin/bash
# common functions used in multiple scripts
get_os_release() {
local os_release result
os_release=`grep -i '^name=' /etc/os-release | awk -F \" '{print $2}' | tr "[:upper:]" "[:lower:]"`
if [ "X${os_release:0:6}" = "Xubuntu" ]; then
result="ubuntu"
elif [ "X${os_release:0:6}" = "Xcentos" ]; then
result="centos"
elif [ "X${os_release:0:6}" = "Xanolis" ]; then
result="anolis"
elif [ "X${os_release:0:5}" = "Xkylin" ]; then
result="kylin"
else
echo "Unknown OS release"
exit 1
fi
echo $result
}
get_os_info() {
local PKG_SUFFIX=""
local OS_TYPE=""
local OS_VERSION_ID="unknown"
if [ -f "/etc/os-release" ]; then
source /etc/os-release
dpkg_output=$(dpkg -l 2>/dev/null | grep -v '^Desired=')
if [ -n "$dpkg_output" ]; then
PKG_SUFFIX="deb"
else
rpm_output=$(rpm -qa 2>/dev/null)
if [ -n "$rpm_output" ]; then
PKG_SUFFIX="rpm"
else
PKG_SUFFIX="unknown"
echo "don't have dpkg/rpm package manage"
exit 1
fi
fi
OS_TYPE=$ID
OS_VERSION_ID=${VERSION_ID:-"unknown"}
else
echo "/etc/os-release not found"
exit 1
fi
echo "$PKG_SUFFIX"
echo "$OS_TYPE"
echo "$OS_VERSION_ID"
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/anolis/hygon-devkit.git
git@gitee.com:anolis/hygon-devkit.git
anolis
hygon-devkit
hygon-devkit
master

搜索帮助