代码拉取完成,页面将自动刷新
#!/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"
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。