1 Star 1 Fork 3

blue/falcon

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
common 2.12 KB
一键复制 编辑 原始数据 按行查看 历史
blue 提交于 2021-02-22 17:48 . Add files via upload
#!/bin/bash
declare -g os_VENDOR os_RELEASE os_PACKAGE os_CODENAME
# Make a *best effort* attempt to install lsb_release packages for the
# user if not available. Note can't use generic install_package*
# because they depend on this!
function _ensure_lsb_release {
if [[ -x $(command -v lsb_release 2>/dev/null) ]]; then
return
fi
if [[ -x $(command -v apt-get 2>/dev/null) ]]; then
sudo apt-get install -y lsb-release
elif [[ -x $(command -v yum 2>/dev/null) ]]; then
sudo yum install -y redhat-lsb-core
else
die $LINENO "Unable to find or auto-install lsb_release"
fi
}
# GetOSVersion
# Set the following variables:
# - os_RELEASE
# - os_CODENAME
# - os_VENDOR
# - os_PACKAGE
function GetOSVersion {
# We only support distros that provide a sane lsb_release
_ensure_lsb_release
os_RELEASE=$(lsb_release -r -s)
os_CODENAME=$(lsb_release -c -s)
os_VENDOR=$(lsb_release -i -s)
if [[ $os_VENDOR =~ (Debian|Ubuntu|LinuxMint) ]]; then
os_PACKAGE="deb"
else
os_PACKAGE="rpm"
fi
typeset -xr os_VENDOR
typeset -xr os_RELEASE
typeset -xr os_PACKAGE
typeset -xr os_CODENAME
}
declare -g HOSTNAME PASSWORD MASK_LEN MASTERNAME HOST_IP LOCAL_IP
init_lib_common()
{
TOP_DIR=$(cd $(dirname "$0") && pwd)
if [ ! -f $TOP_DIR/config ]; then
echo "config does not exit"
exit 0
fi
source $TOP_DIR/config
if [ $ALLINONE -eq 0 ] ; then
if [ -z "$SERVER_IP" ]; then
controller=1
computer=0
else
controller=0
compute=1
fi
else
controller=1
compute=1
fi
if [ -z "$SERVER_IP" ] ;then
echo "Server ip not set"
fi
if [ -z "$HOST_IP" ] ;then
echo "Host ip not set,exit"
exit 0
fi
#local_ip used for vxlan local vtep
if [ -z "$LOCAL_IP" ] ;then
echo "local ip not set"
exit 0
fi
HOSTNAME=${HOSTNAME:-controller}
PASSWORD=${PASSWORD:-123456}
MASK_LEN=${MASK_LEN:-24}
typeset -xr HOSTNAME
typeset -xr PASSWORD
typeset -xr MASK_LEN
typeset -xr MASTERNAME
typeset -xr HOST_IP
typeset -xr LOCAL_IP
typeset -xr computer
typeset -xr controller
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/blueGitRepo/falcon.git
[email protected]:blueGitRepo/falcon.git
blueGitRepo
falcon
falcon
main

搜索帮助