Update install-ta_proxmenu.sh

This commit is contained in:
2026-07-25 16:30:11 -05:00
parent f5921f04a5
commit 0cfd343809
+116 -37
View File
@@ -1,43 +1,122 @@
#!/usr/bin/env bash
# Install TA-ProxMenu on a Proxmox VE host.
if [ -d /opt/idssys/defaults ]; then
source /opt/idssys/defaults/colors.inc
source /opt/idssys/defaults/default.inc
else
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
set -Eeuo pipefail
readonly INSTALL_ROOT='/opt/idssys'
readonly TAPM_DIR="${INSTALL_ROOT}/ta-proxmenu"
readonly DEFAULTS_DIR="${INSTALL_ROOT}/defaults"
readonly TAPM_REPOSITORY='https://git.scity.us/TAI/TA-ProxMenu.git'
readonly DEFAULTS_REPOSITORY='https://git.scity.us/voltron/iDS-Defaults.git'
readonly TAPM_LAUNCHER='/usr/local/bin/tapm'
readonly REQUESTED_BRANCH="${TAPM_BRANCH:-}"
declare -a TEMP_PATHS=()
cleanup() {
local path
for path in "${TEMP_PATHS[@]}"; do
[[ -e "$path" ]] && rm -rf -- "$path"
done
}
fail() {
printf 'ERROR: %s\n' "$*" >&2
exit 1
}
clone_repository() {
local repository="$1"
local destination="$2"
local label="$3"
local branch="${4:-}"
local temporary
if [[ -d "${destination}/.git" ]]; then
printf '%s is already installed at %s; leaving it unchanged.\n' \
"$label" "$destination"
return
fi
[[ ! -e "$destination" ]] ||
fail "${destination} already exists but is not a Git repository."
temporary="${destination}.install.$$"
TEMP_PATHS+=("$temporary")
printf 'Cloning %s...\n' "$label"
if [[ -n "$branch" ]]; then
git clone --branch "$branch" --single-branch \
"$repository" "$temporary"
else
git clone "$repository" "$temporary"
fi
mv "$temporary" "$destination"
}
install_launcher() {
local current_target=''
if [[ -L "$TAPM_LAUNCHER" ]]; then
current_target="$(readlink "$TAPM_LAUNCHER")"
if [[ "$current_target" == "${TAPM_DIR}/run.sh" ]]; then
return
fi
fail "${TAPM_LAUNCHER} points to ${current_target}; it was not replaced."
fi
[[ ! -e "$TAPM_LAUNCHER" ]] ||
fail "${TAPM_LAUNCHER} already exists and was not replaced."
ln -s "${TAPM_DIR}/run.sh" "$TAPM_LAUNCHER"
}
trap cleanup EXIT
(( EUID == 0 )) || fail 'Run this installer as root.'
command -v pveversion >/dev/null 2>&1 ||
fail 'This installer must be run on a Proxmox VE host.'
if [[ -n "$REQUESTED_BRANCH" ]] &&
[[ ! "$REQUESTED_BRANCH" =~ ^[A-Za-z0-9._/-]+$ ]]; then
fail "Invalid TAPM_BRANCH value: ${REQUESTED_BRANCH}"
fi
echo -e "\n${idsCL[LightGreen]}TA-Proxmenu Installation Script${idsCL[Default]}"
printf '\nTA-ProxMenu Installation Script\n\n'
apt -y install wget curl git jq sudo
# if [ ! -f /etc/apt/sources.list.d/proxlb.list ]; then
# echo "deb https://repo.gyptazy.com/stable /" > /etc/apt/sources.list.d/proxlb.list
# wget -O /etc/apt/trusted.gpg.d/proxlb.asc https://repo.gyptazy.com/repository.gpg
# apt-get update
# fi
# fi
if [ ! -f /etc/apt/sources.list.d/gyptazy.list ]; then
curl https://git.gyptazy.com/api/packages/gyptazy/debian/repository.key -o /etc/apt/keyrings/gyptazy.asc
echo "deb [signed-by=/etc/apt/keyrings/gyptazy.asc] https://packages.gyptazy.com/api/packages/gyptazy/debian trixie main" | sudo tee -a /etc/apt/sources.list.d/gyptazy.list
apt update
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y \
ca-certificates curl git jq python3 wget
mkdir -p "$INSTALL_ROOT"
clone_repository \
"$DEFAULTS_REPOSITORY" "$DEFAULTS_DIR" 'iDSSYS Defaults'
clone_repository \
"$TAPM_REPOSITORY" "$TAPM_DIR" 'TA-ProxMenu' "$REQUESTED_BRANCH"
[[ -x "${TAPM_DIR}/run.sh" ]] ||
fail "${TAPM_DIR}/run.sh is missing or is not executable."
[[ -r "${DEFAULTS_DIR}/colors.inc" ]] ||
fail "${DEFAULTS_DIR}/colors.inc is missing."
[[ -r "${DEFAULTS_DIR}/default.inc" ]] ||
fail "${DEFAULTS_DIR}/default.inc is missing."
install_launcher
# Load the standard colors only after the trusted defaults repository exists.
# shellcheck disable=SC1091
source "${DEFAULTS_DIR}/colors.inc"
printf '\n%bTA-ProxMenu has been installed.%b\n\n' \
"${idsCL[Yellow]}" "${idsCL[Default]}"
printf 'Run it with: %btapm%b\n\n' \
"${idsCL[Green]}" "${idsCL[Default]}"
if [[ -n "$REQUESTED_BRANCH" ]]; then
printf 'Installed branch: %b%s%b\n\n' \
"${idsCL[Green]}" "$REQUESTED_BRANCH" "${idsCL[Default]}"
fi
apt -y install proxclmc
set -eu
git clone https://git.schroedercity.com/TAI/TA-ProxMenu.git /opt/idssys/ta-proxmenu
ln -s /opt/idssys/ta-proxmenu/run.sh /usr/local/bin/tapm
if [ ! -d "/opt/idssys/defaults" ]; then
git clone https://git.schroedercity.com/voltron/iDS-Defaults.git /opt/idssys/defaults
fi
echo ""
echo -e "${idsCL[Yellow]}TA-ProxMenu has been Installed${idsCL[Default]}"
echo ""
echo -e "To run updates, use the command: ${idsCL[Green]}tapm${idsCL[Default]}"
echo ""
echo ""
exit 0