3 Commits

Author SHA1 Message Date
David Schroeder 873bb17b62 Update run.sh 2026-07-25 18:15:45 -05:00
David Schroeder 6362844f1a update 2026-07-25 18:06:15 -05:00
David Schroeder f5d7577219 V2 testing option added 2026-07-25 17:57:14 -05:00
3 changed files with 92 additions and 2 deletions
+5
View File
@@ -1,3 +1,8 @@
# TA-Proxmenu - Proxmox Scripts for TA Use # TA-Proxmenu - Proxmox Scripts for TA Use
bash <(curl -sL https://go.scity.us/install-tapm) bash <(curl -sL https://go.scity.us/install-tapm)
To update an installed main-branch copy, switch it to V2, and immediately load
the V2 menu:
tapm V2
+6 -1
View File
@@ -6,6 +6,12 @@
source /opt/idssys/defaults/default.inc source /opt/idssys/defaults/default.inc
source /opt/idssys/ta-proxmenu/defaults.inc source /opt/idssys/ta-proxmenu/defaults.inc
# An older run.sh may update main on disk while continuing to execute its
# already-loaded code. Hand V2 to the new launcher loaded from disk.
if [[ "${1:-}" == "V2" ]]; then
exec /opt/idssys/ta-proxmenu/run.sh V2
fi
INSTALL_PULSE() { INSTALL_PULSE() {
echo echo
bash <(curl -fsSL https://github.com/rcourtman/Pulse/releases/latest/download/install.sh) bash <(curl -fsSL https://github.com/rcourtman/Pulse/releases/latest/download/install.sh)
@@ -419,4 +425,3 @@ exit 0
+81 -1
View File
@@ -5,6 +5,87 @@
source /opt/idssys/defaults/default.inc source /opt/idssys/defaults/default.inc
source /opt/idssys/ta-proxmenu/defaults.inc source /opt/idssys/ta-proxmenu/defaults.inc
SWITCH_TO_V2() {
local repository='/opt/idssys/ta-proxmenu'
local current_branch
local head_commit
local local_commit
local main_commit
local remote_commit
if [[ ! -d "${repository}/.git" ]]; then
echo -e "${idsCL[Red]}TA-ProxMenu is not a Git repository.${idsCL[Default]}"
return 1
fi
current_branch="$(git -C "$repository" branch --show-current 2>/dev/null)"
if [[ "$current_branch" == "V2" ]]; then
exec /opt/idssys/ta-proxmenu/run.sh
fi
if [[ -n "$(git -C "$repository" status --porcelain --untracked-files=normal)" ]]; then
echo -e "${idsCL[LightYellow]}TA-ProxMenu has local changes; branch switching was refused to preserve them.${idsCL[Default]}"
git -C "$repository" status --short
return 1
fi
echo -e "${idsCL[LightCyan]}Fetching TA-ProxMenu branch 'V2'...${idsCL[Default]}"
if ! timeout 30 git -C "$repository" fetch --prune origin \
'+refs/heads/main:refs/remotes/origin/main' \
'+refs/heads/V2:refs/remotes/origin/V2' >/dev/null 2>&1; then
echo -e "${idsCL[Red]}Could not fetch branch 'V2' from origin.${idsCL[Default]}"
return 1
fi
if [[ -z "$current_branch" ]]; then
head_commit="$(git -C "$repository" rev-parse --verify 'HEAD^{commit}' 2>/dev/null)"
main_commit="$(git -C "$repository" rev-parse --verify \
'refs/remotes/origin/main^{commit}' 2>/dev/null)"
if [[ -z "$head_commit" || "$head_commit" != "$main_commit" ]]; then
echo -e "${idsCL[Red]}TA-ProxMenu has an unrecognized detached HEAD; branch switching was refused.${idsCL[Default]}"
return 1
fi
echo -e "${idsCL[LightCyan]}Recovered the legacy updater's detached main checkout.${idsCL[Default]}"
fi
remote_commit="$(git -C "$repository" rev-parse --verify \
'refs/remotes/origin/V2^{commit}' 2>/dev/null)" || {
echo -e "${idsCL[Red]}Origin does not provide a usable V2 branch.${idsCL[Default]}"
return 1
}
if git -C "$repository" show-ref --verify --quiet refs/heads/V2; then
local_commit="$(git -C "$repository" rev-parse --verify \
'refs/heads/V2^{commit}' 2>/dev/null)" || return 1
if [[ "$local_commit" != "$remote_commit" ]] &&
! git -C "$repository" merge-base --is-ancestor \
"$local_commit" "$remote_commit"; then
echo -e "${idsCL[LightYellow]}Local branch 'V2' has local-only or diverged commits; switching was refused.${idsCL[Default]}"
return 1
fi
git -C "$repository" switch V2 >/dev/null || return 1
if [[ "$local_commit" != "$remote_commit" ]] &&
! git -C "$repository" merge --ff-only \
refs/remotes/origin/V2 >/dev/null; then
echo -e "${idsCL[Red]}Could not fast-forward V2; no commits were discarded.${idsCL[Default]}"
return 1
fi
else
git -C "$repository" switch --create V2 \
--track origin/V2 >/dev/null || return 1
fi
rm -f /var/cache/ta-proxmenu/update-status 2>/dev/null || true
echo -e "${idsCL[Green]}TA-ProxMenu is now using branch 'V2'. Loading the V2 menu...${idsCL[Default]}"
exec /opt/idssys/ta-proxmenu/run.sh
}
if [[ "${1:-}" == "V2" ]]; then
SWITCH_TO_V2
exit $?
fi
if [[ "${noupdate}" != *" ${1} "* ]] && [[ "${noupdate}" != *" ${2} "* ]]; then if [[ "${noupdate}" != *" ${1} "* ]] && [[ "${noupdate}" != *" ${2} "* ]]; then
if curl -m 3 -s --head --request GET https://git.scity.us | grep "HTTP/2 200" > /dev/null; then if curl -m 3 -s --head --request GET https://git.scity.us | grep "HTTP/2 200" > /dev/null; then
if [ "${1}" != "tapm" ]; then if [ "${1}" != "tapm" ]; then
@@ -68,4 +149,3 @@ if [ "${1}" != "tapm" ] && [ "${1}" != "update" ] && [ "${1}" != "u" ]; then
fi fi
exit 0 exit 0