Rewrite install.sh to use Gitea (gittheraiwy.theraiwy.top) instead of GitHub
This commit is contained in:
+27
-14
@@ -20,7 +20,9 @@ WIDGET_TOOLKIT_DIR="/usr/share/javascript/proxmox-widget-toolkit"
|
||||
THEMES_DIR="${WIDGET_TOOLKIT_DIR}/themes"
|
||||
PROXMOXLIB_JS="${WIDGET_TOOLKIT_DIR}/proxmoxlib.js"
|
||||
BACKUP_DIR="/root/.proxmorph-backup"
|
||||
GITHUB_REPO="IT-BAER/proxmorph"
|
||||
GITEA_REPO="theraiwy/proxmorph"
|
||||
GITEA_HOST="gittheraiwy.theraiwy.top"
|
||||
RAW_BRANCH="main"
|
||||
INSTALL_DIR="/opt/proxmorph"
|
||||
|
||||
# Sensor support paths
|
||||
@@ -132,13 +134,13 @@ check_product() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Get latest release version from GitHub
|
||||
# Get latest commit hash from Gitea
|
||||
get_latest_version() {
|
||||
curl -s "https://api.github.com/repos/${GITHUB_REPO}/releases/latest" | \
|
||||
grep '"tag_name"' | sed -E 's/.*"v([^"]+)".*/\1/'
|
||||
curl -s "https://${GITEA_HOST}/api/v1/repos/${GITEA_REPO}/branches/${RAW_BRANCH}" | \
|
||||
grep '"id"' | head -1 | sed -E 's/.*"id":"([^"]+)".*/\1/' | cut -c1-7
|
||||
}
|
||||
|
||||
# Download and extract release from GitHub
|
||||
# Download archive from Gitea
|
||||
download_release() {
|
||||
local version="${1:-$(get_latest_version)}"
|
||||
|
||||
@@ -147,13 +149,13 @@ download_release() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
print_info "Downloading ProxMorph v${version}..."
|
||||
print_info "Downloading ProxMorph (${version})..."
|
||||
|
||||
local download_url="https://github.com/${GITHUB_REPO}/releases/download/v${version}/proxmorph-${version}.tar.gz"
|
||||
local download_url="https://${GITEA_HOST}/${GITEA_REPO}/archive/${RAW_BRANCH}.tar.gz"
|
||||
local tmp_dir=$(mktemp -d)
|
||||
|
||||
if ! curl -sL "$download_url" -o "${tmp_dir}/proxmorph.tar.gz"; then
|
||||
print_error "Failed to download release v${version}"
|
||||
print_error "Failed to download archive"
|
||||
rm -rf "$tmp_dir"
|
||||
exit 1
|
||||
fi
|
||||
@@ -161,13 +163,24 @@ download_release() {
|
||||
# Extract to install directory
|
||||
mkdir -p "$INSTALL_DIR"
|
||||
rm -rf "${INSTALL_DIR:?}"/*
|
||||
tar -xzf "${tmp_dir}/proxmorph.tar.gz" -C "$INSTALL_DIR"
|
||||
tar -xzf "${tmp_dir}/proxmorph.tar.gz" -C "$tmp_dir"
|
||||
|
||||
# Gitea archives extract to a subfolder named 'repo-branch' (e.g. proxmorph-main/)
|
||||
local extracted_dir=$(find "$tmp_dir" -maxdepth 1 -type d ! -path "$tmp_dir" | head -1)
|
||||
if [[ -n "$extracted_dir" ]]; then
|
||||
cp -r "${extracted_dir}/." "$INSTALL_DIR/"
|
||||
else
|
||||
print_error "Failed to extract archive"
|
||||
rm -rf "$tmp_dir"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf "$tmp_dir"
|
||||
|
||||
# Save version info
|
||||
echo "$version" > "${INSTALL_DIR}/.version"
|
||||
|
||||
print_status "Downloaded ProxMorph v${version}"
|
||||
print_status "Downloaded ProxMorph (${version})"
|
||||
}
|
||||
|
||||
# Check for updates
|
||||
@@ -185,13 +198,13 @@ check_updates() {
|
||||
fi
|
||||
|
||||
if [[ "$current_version" == "$latest_version" ]]; then
|
||||
print_status "Already on latest version (v${current_version})"
|
||||
print_status "Already up to date (${current_version})"
|
||||
return 0
|
||||
elif [[ -n "$current_version" ]]; then
|
||||
print_info "Update available: v${current_version} → v${latest_version}"
|
||||
print_info "Update available: ${current_version} → ${latest_version}"
|
||||
return 2
|
||||
else
|
||||
print_info "Latest version: v${latest_version}"
|
||||
print_info "Latest commit: ${latest_version}"
|
||||
return 2
|
||||
fi
|
||||
}
|
||||
@@ -1694,7 +1707,7 @@ show_menu() {
|
||||
echo ""
|
||||
echo "Select an option:"
|
||||
echo " 1) Install themes"
|
||||
echo " 2) Update from GitHub (latest release)"
|
||||
echo " 2) Update from Gitea (latest commit)"
|
||||
echo " 3) Reinstall themes (after update)"
|
||||
echo " 4) Uninstall themes"
|
||||
echo " 5) List themes"
|
||||
|
||||
Reference in New Issue
Block a user