15 Star 88 Fork 12

Gitee 极速下载 / pigsty

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/Vonng/pigsty
克隆/下载
bootstrap 22.53 KB
一键复制 编辑 原始数据 按行查看 历史
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
#!/bin/bash
#==============================================================#
# File : bootstrap
# Desc : setup local repo & install boot utils
# Ctime : 2022-10-16
# Mtime : 2024-02-29
# Path : bootstrap
# Author : Ruohang Feng (rh@vonng.com)
# License : AGPLv3
#==============================================================#
PIGSTY_VERSION=v2.7.0
#--------------------------------------------------------------#
# Usage
#--------------------------------------------------------------#
# boostrap [-p <path>] [-y|--yes] [-n|--no]
#
# ./boostrap
# [-r|--region <region] [default,china,europe]
# [-p|--path <path>] specify another offline pkg path
# [-y|--yes] download offline pkg without asking
# [-n|--no] do not download offline pkg.tgz
#
# if neither `-y` or `-n` is specified, Pigsty will ask for
# downloading `pkg.tgz` from the Internet during `bootstrap`
#--------------------------------------------------------------#
# args
# -r --region <region> : mirror region to use (default|china|europe)
# -p --path <path> : offline packages path, /tmp/pkg.tgz by default
# -y --yes : download pkg.tgz from internet, ask by default
# -n --no : do not download pkg.tgz from internet
#--------------------------------------------------------------#
REGION="" # which mirror to use? (default|china)
DOWNLOAD_PKG="ask" # download pkg.tgz ? (ask|yes|no, ask by default)
PKG_PATH=/tmp/pkg.tgz # which pkg to be used ? (/tmp/pkg.tgz by default)
#--------------------------------------------------------------#
# Logic
#--------------------------------------------------------------#
# This script make sure two things:
# 1. ansible is installed
# 2. local repo is prepared
# It perform following tasks:
# 1. check preconditions
# 2. check local repo exists ?
# Y -> create /etc/yum.repos.d/pigsty-local.repo
# N -> Download from Internet? Y -> Download from Github / CDN and add local repo file
# N -> Add basic os upstream repo manually ?
# Y -> add according to region / releasever
# N -> leave it to user
# after step 2, we have yum repo available. Local > Download > Upstream > User Provide
#
# 3. install boot utils from available repo
# nginx,wget,sshpass,createrepo_c,yum-utils
# dnf-utils,modulemd-tools,python3.11-jmespath (el8/9)
#
# 4. Check ansible availability.
#--------------------------------------------------------------#
#--------------------------------------------------------------#
# Utils
#--------------------------------------------------------------#
__CN='\033[0m';__CB='\033[0;30m';__CR='\033[0;31m';__CG='\033[0;32m';
__CY='\033[0;33m';__CB='\033[0;34m';__CM='\033[0;35m';__CC='\033[0;36m';__CW='\033[0;37m';
function log_info() { printf "[${__CG} OK ${__CN}] ${__CG}$*${__CN}\n"; }
function log_warn() { printf "[${__CY}WARN${__CN}] ${__CY}$*${__CN}\n"; }
function log_error() { printf "[${__CR}FAIL${__CN}] ${__CR}$*${__CN}\n"; }
function log_debug() { printf "[${__CB}HINT${__CN}] ${__CB}$*${__CN}\n"; }
function log_input() { printf "[${__CM} IN ${__CN}] ${__CM}$*\n=> ${__CN}"; }
function log_hint() { printf "${__CB}$*${__CN}"; }
ipv4_regexp='(([0-9]|[0-9]{2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[0-9]{2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])'
#--------------------------------------------------------------#
# Param
#--------------------------------------------------------------#
PROG_NAME="$(basename $0)"
PROG_DIR="$(cd $(dirname $0) && pwd)"
PIGSTY_HOME="${PROG_DIR}"
REPO_NAME=pigsty
NGINX_HOME=/www
REPO_DIR=${NGINX_HOME}/${REPO_NAME}
BIN_DIR=${PIGSTY_HOME}/files/bin
# extract os vendor & version from /etc/os-release
OS_VENDOR=""
OS_VERSION=""
OS_PACKAGE=""
OS_MANAGER=""
OS_CODENAME=""
ARCH=$(uname -m)
#----------------------------------------------#
# region
#----------------------------------------------#
# return 0 if behind gfw (inside mainland china), otherwise 1
function behind_gfw() {
local return_code=$(curl -I -s --connect-timeout 1 www.google.com -w %{http_code} | tail -n1)
if [ "${return_code}" = "200" ]; then
return 1
fi
return 0
}
function check_region(){
if [ "${REGION}" == "" ]; then
if behind_gfw; then
REGION=china # mainland china is behind GFW
else
REGION=default # otherwise use default mirror
fi
log_info "region = ${REGION}"
fi
}
#----------------------------------------------#
# kernel
#----------------------------------------------#
function check_kernel(){
local kernel_name=$(uname -s)
if [[ "${kernel_name}" == "Linux" ]]; then
log_info "kernel = ${kernel_name}"
return 0
else
log_error "kernel = ${kernel_name}, not supported, Linux only"
exit 1
fi
}
#----------------------------------------------#
# machine
#----------------------------------------------#
function check_machine(){
local machine_name=$(uname -m)
if [[ "${machine_name}" == "x86_64" ]]; then
log_info "machine = ${machine_name}"
return 0
else
log_error "machine = ${machine_name}, not supported, x86_64 only"
exit 2
fi
}
#----------------------------------------------#
# os package manager (yum|apt|...)
#----------------------------------------------#
function check_package_manager(){
# get package / manager: rpm|deb and dnf|yum|apt|apt-get|zypper
if command -v dpkg >/dev/null 2>&1; then
OS_PACKAGE="deb"
if command -v apt >/dev/null 2>&1; then
OS_MANAGER="apt"
elif command -v apt-get >/dev/null 2>&1; then
OS_MANAGER="apt-get"
else
log_error "fail to determine os package manager for deb"
exit 4
fi
elif command -v rpm >/dev/null 2>&1; then
OS_PACKAGE="rpm"
if command -v dnf >/dev/null 2>&1; then
OS_MANAGER="dnf"
elif command -v yum >/dev/null 2>&1; then
OS_MANAGER="yum"
elif command -v zypper >/dev/null 2>&1; then
OS_MANAGER="zypper"
else
log_error "fail to determine os package manager for rpm"
exit 4
fi
else
log_error "fail to determine os package type"
exit 3
fi
log_info "package = ${OS_PACKAGE},${OS_MANAGER}"
}
#----------------------------------------------#
# os release (Linux|Darwin etc..)
#----------------------------------------------#
function check_vendor_version(){
if [[ -f /etc/os-release ]]; then
. /etc/os-release
OS_VENDOR="$ID"
OS_VERSION="$VERSION_ID"
OS_CODENAME=${VERSION_CODENAME-''}
if [[ $VERSION_ID == *.* ]]; then
OS_VERSION=$(echo "$VERSION_ID" | cut -d. -f1)
else
OS_VERSION="${VERSION_ID}"
fi
log_info "vendor = ${OS_VENDOR} (${NAME})"
log_info "version = ${OS_VERSION} (${VERSION_ID})"
return 0
else
log_error "/etc/os-release file not found, unknown OS"
exit 5
fi
}
#----------------------------------------------#
# sudo
#----------------------------------------------#
function can_nopass_sudo(){
local current_user=$(whoami)
if [[ "${current_user}" == "root" ]]; then
return 0
fi
if sudo -n ls >/dev/null 2>/dev/null; then
return 0
fi
return 1
}
# sudo is required to extract /www/pigsty
function check_sudo(){
local current_user=$(whoami)
if can_nopass_sudo; then
log_info "sudo = ${current_user} ok"
else
log_error "sudo = ${current_user} missing nopasswd"
log_warn "fix nopass sudo for '${current_user}' with sudo:"
log_hint "echo '%%${current_user} ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/${current_user}"
exit 5
fi
}
#----------------------------------------------#
# check pkg.tgz exists (optionally download)
#----------------------------------------------#
# download file from url, if file already exists with same size, skip download
function download_file(){
local data_url=$1
local data_file=$2
if [[ -f ${data_file} ]]; then
size=$(get_file_size ${data_file})
log_warn "data file exists, size: ${size} , path: ${data_file}"
curl_size=$(curl -sI ${data_url} | grep -i 'Content-Length' | awk '{print $2}' | tr -d '\r')
if [[ ${size} -eq ${curl_size} ]]; then
log_info "data url file has same size: ${curl_size} , skip downloading ${data_url}"
return 0
else
log_warn "data url file size ${curl_size} != local ${size}, downloading ${data_url}"
log_info "$ curl ${data_url} -o ${data_file}"
curl -L ${data_url} -o ${data_file}
return $?
fi
else
# log_info "download ${data_url} to ${data_file}"
log_info "$ curl ${data_url} -o ${data_file}"
curl -L ${data_url} -o ${data_file}
return $?
fi
}
function check_pkg(){
local pkg_url=${1-''} # default package url from github
local pkg_path=${2-${PKG_PATH}} # default download path : /tmp/pkg.tgz
local download_pkg=${3-${DOWNLOAD_PKG}} # flag: if set, skip interactive asking
# build pigsty pkg download url
if [[ ${pkg_url} == "" ]]; then
baseurl="https://github.com/Vonng/pigsty/releases/download/${PIGSTY_VERSION}"
if [ "${REGION}" = "china" ]; then
baseurl="https://get.pigsty.cc/${PIGSTY_VERSION}"
fi
if [[ ${OS_PACKAGE} == "rpm" ]]; then
pkg_url="${baseurl}/pigsty-pkg-${PIGSTY_VERSION}.el${OS_VERSION}.x86_64.tgz"
elif [[ ${OS_PACKAGE} == "deb" ]]; then
pkg_url="${baseurl}/pigsty-pkg-${PIGSTY_VERSION}.${OS_VENDOR}${OS_VERSION}.x86_64.tgz"
fi
fi
if [[ -f ${pkg_path} ]]; then
# TODO: checksum validate (but we will use 400MB sanity size check instead)
if (($(stat -c%s ${pkg_path})>409600000)); then
log_info "cache = ${pkg_path} exists"
return 0
else
log_warn "cache = ${pkg_path} exists but invalid"
rm -rf ${pkg_path}
fi
fi
# EL 8, Debian 12, Ubuntu 22 has official offline packages!
if [[ ${OS_PACKAGE} == "rpm" && ${OS_VERSION} == "8" ]]; then
log_info "EL 8.9 has pre-packed offline package available:"
log_hint " ${pkg_url}\n"
elif [[ ${OS_PACKAGE} == "deb" && ${OS_CODENAME} == "jammy" ]]; then
log_info "Ubuntu 22.04 jammy has pre-packed offline package available:"
log_hint " ${pkg_url}\n"
elif [[ ${OS_PACKAGE} == "deb" && ${OS_CODENAME} == "bookworm" ]]; then
log_info "Debian 12 bookworm has pre-packed offline package available:"
log_hint " ${pkg_url}\n"
else
log_warn "${OS_VENDOR} ${OS_VERSION} ${OS_CODENAME} does not have corresponding offline package, use online install"
download_pkg="no"
fi
# ask for confirmation if in interactive mode (and download is not specified)
if [[ ${download_pkg} == "ask" ]]; then
log_input "offline package not exist on /tmp/pkg.tgz, download? (y/n):"
read -r
local reply=$(echo "$REPLY" | tr '[:upper:]' '[:lower:]')
case "${reply}" in
y|yes|ok|true|aye|on) download_pkg=yes ;;
n|no|false|nay|off) download_pkg=no ;;
esac
fi
if [[ ${download_pkg} == "yes" ]]; then
download_file "${pkg_url}" "${pkg_path}"
return $?
else
log_warn "cache = missing and skip download"
fi
return 0
}
#----------------------------------------------#
# check repo
#----------------------------------------------#
# assume user can sudo (pass check_sudo)
function check_repo(){
local pkg_path=${1-${PKG_PATH}} # default download path : /tmp/pkg.tgz
local repo_dir=${2-${REPO_DIR}} # default repo directory: /www/pigsty
local nginx_home=$(dirname ${repo_dir})
local repo_name=$(basename ${repo_dir})
if [[ -f ${repo_dir}/repo_complete ]]; then
log_info "repo = ${repo_dir} ok"
return 0
fi
if [[ ! -f ${pkg_path} ]]; then
log_warn "repo = skip (${pkg_path} not exists)"
return 0
fi
sudo mkdir -p ${nginx_home}
if [[ -d ${repo_dir} ]]; then
log_warn "repo = invalid, remove"
sudo rm -rf ${repo_dir}
fi
log_info "repo = extract from ${pkg_path}"
if ! [ -x "$(command -v tar)" ]; then
log_error 'tar is not installed'
return 1
fi
sudo tar -xf ${pkg_path} -C ${nginx_home} # extract
}
#----------------------------------------------#
# check local file repo
#----------------------------------------------#
# Usage: add_el7_repo [region] (default|china|europe)
function add_el7_repo(){
local region=${1-"default"}
local releasever=7
local basearch=x86_64
if [ "${region}" = "china" ]; then
baseurl="https://mirrors.tuna.tsinghua.edu.cn"
elif [ "${region}" = "europe" ]; then
baseurl="https://mirrors.xtom.de"
else
baseurl="http://mirror.centos.org"
fi
cat > "/tmp/el${releasever}.repo" <<-EOF
[base-default]
name = EL 7 Base 7 - \$basearch
baseurl = ${baseurl}/centos/7/os/\$basearch/
gpgcheck = 0
enabled = 1
skip_if_unavailable = 1
[epel-default]
name = EL 7 EPEL \7 - \$basearch
baseurl = ${baseurl}/epel/7/\$basearch/
gpgcheck = 0
enabled = 1
skip_if_unavailable = 1
[extras-default]
name = EL 7 Extras 7 - \$basearch
baseurl = ${baseurl}/centos/7/extras/\$basearch/
gpgcheck = 0
enabled = 1
skip_if_unavailable = 1
[updates-default]
name = EL 7 Updates 7 - \$basearch
baseurl = ${baseurl}/centos/7/updates/\$basearch/
gpgcheck = 0
enabled = 1
skip_if_unavailable = 1
EOF
sudo mv -f "/tmp/el${releasever}.repo" "/etc/yum.repos.d/el${releasever}.repo"
}
# Usage: add_el89_repo [region] (default|china|europe)
function add_el89_repo(){
local region=${1-"default"}
local suffix=""
if [ "${region}" = "china" ]; then
baseurl="https://mirrors.aliyun.com"
suffix=linux
elif [ "${region}" = "europe" ]; then
baseurl="https://mirrors.xtom.de"
else
baseurl="https://dl.rockylinux.org/pub"
fi
cat > "/tmp/el${releasever}.repo" <<-EOF
[baseos-default]
name = EL ${releasever} BaseOS \$releasever - \$basearch
baseurl = ${baseurl}/rocky${suffix}/\$releasever/BaseOS/\$basearch/os/
gpgcheck = 0
enabled = 1
skip_if_unavailable = 1
module_hotfixes=1
[appstream-default]
name = EL ${releasever} AppStream \$releasever - \$basearch
baseurl = ${baseurl}/rocky${suffix}/\$releasever/AppStream/\$basearch/os/
gpgcheck = 0
enabled = 1
skip_if_unavailable = 1
module_hotfixes=1
[epel-default]
name = EL ${releasever} EPEL \$releasever - \$basearch
baseurl = ${baseurl}/epel/\$releasever/Everything/\$basearch/
gpgcheck = 0
enabled = 1
skip_if_unavailable = 1
module_hotfixes=1
EOF
sudo mv -f "/tmp/el${releasever}.repo" "/etc/yum.repos.d/el${releasever}.repo"
}
# Usage: add_ubuntu_repo [region] (default|china|europe)
function add_ubuntu_repo(){
local region=${1-"default"}
if [ "${region}" = "china" ]; then
baseurl="https://mirrors.aliyun.com/ubuntu/"
else
baseurl="https://mirrors.edge.kernel.org/ubuntu/"
fi
cat > "/tmp/sources.list" <<-EOF
deb [trusted=yes] ${baseurl} ${OS_CODENAME} main universe multiverse restricted
deb [trusted=yes] ${baseurl} ${OS_CODENAME}-backports main restricted universe multiverse
deb [trusted=yes] ${baseurl} ${OS_CODENAME}-security main restricted universe multiverse
deb [trusted=yes] ${baseurl} ${OS_CODENAME}-updates main restricted universe multiverse
EOF
sudo mv -f "/tmp/sources.list" "/etc/apt/sources.list"
}
# Usage: add_debian_repo [region] (default|china|europe)
function add_debian_repo(){
local region=${1-"default"}
if [ "${region}" = "china" ]; then
cat > "/tmp/sources.list" <<-EOF
deb [trusted=yes] https://mirrors.aliyun.com/debian/ ${OS_CODENAME} main restricted universe multiverse
deb [trusted=yes] https://mirrors.aliyun.com/debian/ ${OS_CODENAME}-updates main restricted universe multiverse
deb [trusted=yes] http://security.debian.org/debian-security ${OS_CODENAME}-security main non-free-firmware
EOF
else
cat > "/tmp/sources.list" <<-EOF
deb [trusted=yes] http://deb.debian.org/debian/ ${OS_CODENAME} main non-free-firmware
deb [trusted=yes] http://deb.debian.org/debian/ ${OS_CODENAME}-updates main non-free-firmware
deb [trusted=yes] http://security.debian.org/debian-security ${OS_CODENAME}-security main non-free-firmware
EOF
fi
sudo mv -f "/tmp/sources.list" "/etc/apt/sources.list"
}
#----------------------------------------------#
# add local file repo
#----------------------------------------------#
function add_local_repo(){
local nginx_home=${1-${NGINX_HOME}}
local repo_name=${2-${REPO_NAME}}
# add local repo for el compatible releases
if [[ ${OS_PACKAGE} == "rpm" ]]; then
local releasever=OS_VERSION
cat > /tmp/pigsty-local.repo <<-EOF
[pigsty-local]
name=pigsty local \$releasever - \$basearch
baseurl=file://${nginx_home}/${repo_name}/
enabled=1
gpgcheck=0
EOF
if (( ${OS_VERSION} >= 8 )); then
echo "module_hotfixes=1" >> /tmp/pigsty-local.repo
fi
sudo mkdir -p /etc/yum.repos.d/backup
sudo mv -f /etc/yum.repos.d/*.repo /etc/yum.repos.d/backup/ 2> /dev/null || true
sudo mv -f /tmp/pigsty-local.repo /etc/yum.repos.d/pigsty-local.repo
log_info "repo file = use /etc/yum.repos.d/pigsty-local.repo"
return 0
fi
if [[ ${OS_PACKAGE} == "deb" ]]; then
sudo mkdir -p /etc/apt/backup
sudo mv -f /etc/apt/sources.list.d/* /etc/apt/backup/ 2> /dev/null || true
sudo mv -f /etc/apt/sources.list /etc/apt/backup/ 2> /dev/null || true
sudo rm -rf /tmp/pigsty-local.list;
echo "deb [trusted=yes] file:${nginx_home}/${repo_name}/ ./" > /tmp/pigsty-local.list
sudo mv /tmp/pigsty-local.list /etc/apt/sources.list.d/pigsty-local.list
log_info "repo file = use /etc/apt/sources.list.d/pigsty-local.list"
return 0
fi
log_warn "repo file = unknown"
return 1
}
function check_repo_file(){
local repo_name=${1-${REPO_NAME}}
local nginx_home=${2-${NGINX_HOME}}
local repo_flag=${nginx_home}/${repo_name}/repo_complete
# if repo exists, add local repo file, other wise add upstream repo
if [[ -f ${repo_flag} ]]; then
add_local_repo
else
if [[ ${OS_PACKAGE} == "rpm" ]]; then
if [[ $OS_VERSION == "7" ]]; then
add_el7_repo "${REGION}"
elif [[ $OS_VERSION == "8" || $OS_VERSION == "9" ]]; then
add_el89_repo "${REGION}"
fi
log_info "repo file = add el${OS_VERSION}.${ARCH} ${REGION} upstream"
elif [[ ${OS_PACKAGE} == "deb" ]]; then
if [[ ${OS_VENDOR} == "ubuntu" ]]; then
add_ubuntu_repo "${REGION}"
elif [[ ${OS_VENDOR} == "debian" ]]; then
add_debian_repo "${REGION}"
fi
log_info "repo file = add ${OS_VENDOR} ${OS_CODENAME} ${REGION} upstream"
fi
fi
if [[ ${OS_PACKAGE} == "rpm" ]]; then
log_warn "rpm cache = updating, make take a while"
sudo yum clean all -q
sudo yum makecache -q
elif [[ ${OS_PACKAGE} == "deb" ]]; then
log_warn "apt cache = updating, make take a while"
sudo apt update
fi
log_info "repo cache = created"
}
#----------------------------------------------#
# check utils
#----------------------------------------------#
# install ansible sshpass unzip wget yum , etc...
function check_utils(){
local repo_name=${1-${REPO_NAME}}
local nginx_home=${2-${NGINX_HOME}}
local repo_file=/etc/yum.repos.d/${repo_name}-local.repo
# install el utils
if [[ ${OS_PACKAGE} == "rpm" ]]; then
if [[ $OS_VERSION == "7" ]]; then
log_info "install el7 utils"
sudo yum install -y createrepo_c unzip wget yum-utils sshpass
sudo yum install -y ansible
elif [[ $OS_VERSION == "8" ]]; then
log_info "install el8 utils"
sudo dnf install -y createrepo_c unzip wget dnf-utils sshpass modulemd-tools
sudo dnf install -y ansible python3.11-jmespath python3-cryptography
elif [[ $OS_VERSION == "9" ]]; then
log_info "install el9 utils"
sudo dnf install -y createrepo_c unzip wget dnf-utils sshpass modulemd-tools
sudo dnf install -y ansible python3.11-jmespath python3-jmespath
fi
# restore backup repo
sudo cp -f /etc/yum.repos.d/backup/*.repo /etc/yum.repos.d/ 2> /dev/null || true
fi
# install deb utils
if [[ ${OS_PACKAGE} == "deb" ]]; then
sudo apt install -y unzip wget sshpass acl
sudo apt install -y ansible python3-jmespath
if [[ -f /etc/apt/backup/sources.list ]]; then
sudo mv -f /etc/apt/backup/sources.list /etc/apt/sources.list 2> /dev/null || true
fi
sudo mv -f /etc/apt/backup/* /etc/apt/sources.list.d/ 2> /dev/null || true
fi
# check ansible is installed
if command -v ansible-playbook >/dev/null ; then
log_info "ansible = $(ansible --version | head -n1)"
else
log_error "ansible = not found"
exit 20
fi
}
#--------------------------------------------------------------#
# Main
#--------------------------------------------------------------#
function main(){
# arg parsing
while [ $# -gt 0 ]; do
case $1 in
-h|--help)
echo './bootstrap [-r|--region <region>] [-p|--path <pkg>] [-y|--yes] [-n|--no]'
exit 0;;
-r|--region) REGION="$2" ; shift ;;
-p|--path|--pkg) PKG_PATH="$2" ; shift ;;
-y|--yes) DOWNLOAD_PKG=yes ;;
-n|--no) DOWNLOAD_PKG=no ;;
(--) shift; break;;
(-*) echo "$0: error - unrecognized option $1" 1>&2; exit 1;;
(*) break;;
esac
shift
done
log_hint "bootstrap pigsty ${PIGSTY_VERSION} begin\n"
check_region # region = default
check_kernel # kernel = Linux
check_machine # machine = x86_64
check_package_manager # package = rpm|deb, manager = dnf|yum|zypper|apt|apt-get
check_vendor_version # release = rocky, version = 7,8,9...
check_sudo # current_user = NOPASSWD sudo
check_pkg # check offline installation package exists (INTERACTIVE: ask for download confirmation)
check_repo # create repo from pkg.tgz if exists
check_repo_file # create local file repo file if repo exists
check_utils # check ansible sshpass and other utils installed
log_info "boostrap pigsty complete"
log_hint "proceed with ./configure\n"
}
main $@
Python
1
https://gitee.com/mirrors/pigsty.git
git@gitee.com:mirrors/pigsty.git
mirrors
pigsty
pigsty
master

搜索帮助