fix: repair server-install.sh branch and directory logic
This commit is contained in:
parent
140b4b5df5
commit
a114c6b9a2
@ -7,10 +7,24 @@
|
||||
#==============================================================#
|
||||
|
||||
# Default parameters
|
||||
VERSION="${1:-main}"
|
||||
DOMAIN="${2:-$(hostname)}"
|
||||
VERSION="main"
|
||||
DOMAIN="$(hostname)"
|
||||
|
||||
# Smart parameter parsing
|
||||
if [[ -n "$1" ]]; then
|
||||
# if $1 looks like a version/branch (main, master, v1.0, etc.)
|
||||
if [[ "$1" == "main" || "$1" == "master" || "$1" == v[0-9]* ]]; then
|
||||
VERSION="$1"
|
||||
DOMAIN="${2:-$(hostname)}"
|
||||
else
|
||||
# assume $1 is the DOMAIN
|
||||
DOMAIN="$1"
|
||||
fi
|
||||
fi
|
||||
|
||||
REPO_URL="https://github.com/cloud-neutral-toolkit/observability.svc.plus.git"
|
||||
INSTALL_DIR="${HOME}/pigsty"
|
||||
REPO_NAME=$(basename "${REPO_URL}" .git)
|
||||
INSTALL_DIR="${HOME}/${REPO_NAME}"
|
||||
|
||||
# Colors
|
||||
RED='\033[0;31m'
|
||||
@ -18,7 +32,7 @@ GREEN='\033[0;32m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m'
|
||||
|
||||
echo -e "${BLUE}Installing observability.svc.plus...${NC}"
|
||||
echo -e "${BLUE}Installing ${REPO_NAME}...${NC}"
|
||||
echo -e "${BLUE}Version : ${VERSION}${NC}"
|
||||
echo -e "${BLUE}Domain : ${DOMAIN}${NC}"
|
||||
echo -e "${BLUE}Repo : ${REPO_URL}${NC}"
|
||||
@ -38,16 +52,25 @@ if [ -d "${INSTALL_DIR}" ]; then
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
rm -rf "${INSTALL_DIR}"
|
||||
git clone -b "${VERSION}" "${REPO_URL}" "${INSTALL_DIR}"
|
||||
if ! git clone -b "${VERSION}" "${REPO_URL}" "${INSTALL_DIR}"; then
|
||||
echo -e "${RED}Error: Failed to clone repository.${NC}"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo -e "${BLUE}Updating existing repo...${NC}"
|
||||
cd "${INSTALL_DIR}"
|
||||
git fetch origin
|
||||
git checkout "${VERSION}" || echo -e "${RED}Version ${VERSION} not found${NC}"
|
||||
if ! git checkout "${VERSION}"; then
|
||||
echo -e "${RED}Error: Version ${VERSION} not found${NC}"
|
||||
exit 1
|
||||
fi
|
||||
git pull origin "${VERSION}"
|
||||
fi
|
||||
else
|
||||
git clone -b "${VERSION}" "${REPO_URL}" "${INSTALL_DIR}"
|
||||
if ! git clone -b "${VERSION}" "${REPO_URL}" "${INSTALL_DIR}"; then
|
||||
echo -e "${RED}Error: Failed to clone repository.${NC}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
cd "${INSTALL_DIR}"
|
||||
@ -55,9 +78,11 @@ cd "${INSTALL_DIR}"
|
||||
# Run Bootstrap
|
||||
if [ -f "./bootstrap" ]; then
|
||||
echo -e "${BLUE}Running bootstrap...${NC}"
|
||||
./bootstrap
|
||||
./bootstrap || { echo -e "${RED}Error: Bootstrap failed${NC}"; exit 1; }
|
||||
elif [ -f "./configure" ]; then
|
||||
echo -e "${BLUE}Found configure script, but no bootstrap. Proceeding...${NC}"
|
||||
else
|
||||
echo -e "${RED}bootstrap script not found!${NC}"
|
||||
echo -e "${RED}Warning: Primary setup scripts not found! Check repo content.${NC}"
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}Installation successful!${NC}"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user