forked from forkanization/Proxmox-arm64
Merge remote-tracking branch 'upstream/main'
This commit is contained in:
@@ -1063,7 +1063,9 @@ EOF
|
||||
msg_info "Starting LXC Container"
|
||||
pct start "$CTID"
|
||||
msg_ok "Started LXC Container"
|
||||
|
||||
msg_info "Customizing LXC Container"
|
||||
: "${tz:=Etc/UTC}"
|
||||
if [ "$var_os" == "alpine" ]; then
|
||||
sleep 3
|
||||
pct exec "$CTID" -- /bin/sh -c 'cat <<EOF >/etc/apk/repositories
|
||||
@@ -1073,19 +1075,22 @@ EOF'
|
||||
pct exec "$CTID" -- ash -c "apk add bash newt curl openssh nano mc ncurses >/dev/null"
|
||||
else
|
||||
sleep 3
|
||||
# Set locale and timezone before update
|
||||
pct exec "$CTID" -- bash -c "sed -i '/$LANG/ s/^# //' /etc/locale.gen"
|
||||
pct exec "$CTID" -- bash -c "locale_line=\$(grep -v '^#' /etc/locale.gen | grep -E '^[a-zA-Z]' | awk '{print \$1}' | head -n 1) && \
|
||||
echo LANG=\$locale_line >/etc/default/locale && \
|
||||
locale-gen >/dev/null && \
|
||||
export LANG=\$locale_line"
|
||||
|
||||
pct exec "$CTID" -- bash -c "echo $tz >/etc/timezone && ln -sf /usr/share/zoneinfo/$tz /etc/localtime"
|
||||
if pct exec "$CTID" -- test -e "/usr/share/zoneinfo/$tz"; then
|
||||
pct exec "$CTID" -- bash -c "echo $tz >/etc/timezone && ln -sf /usr/share/zoneinfo/$tz /etc/localtime"
|
||||
else
|
||||
msg_info "Skipping timezone setup – zone '$tz' not found in container"
|
||||
fi
|
||||
|
||||
# Install curl
|
||||
pct exec "$CTID" -- bash -c "apt-get update >/dev/null && apt-get install -y sudo curl mc gnupg2 >/dev/null"
|
||||
fi
|
||||
msg_ok "Customized LXC Container"
|
||||
|
||||
lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/asylumexp/Proxmox/main/install/"$var_install".sh)" $?
|
||||
}
|
||||
|
||||
|
||||
@@ -155,13 +155,19 @@ if [ -f /etc/pve/corosync.conf ]; then
|
||||
fi
|
||||
|
||||
# Update LXC template list
|
||||
msg_info "Updating LXC Template List"
|
||||
TEMPLATE_SEARCH="${PCT_OSTYPE}-${PCT_OSVERSION:-}"
|
||||
|
||||
if ! timeout 10 pveam update >/dev/null 2>&1; then
|
||||
msg_error "Failed to update LXC template list. Please check your Proxmox host's internet connection and DNS resolution."
|
||||
exit 201
|
||||
msg_info "Updating LXC Template List"
|
||||
if ! timeout 15 pveam update >/dev/null 2>&1; then
|
||||
TEMPLATE_FALLBACK=$(pveam list "$TEMPLATE_STORAGE" | awk "/$TEMPLATE_SEARCH/ {print \$2}" | sort -t - -k 2 -V | tail -n1)
|
||||
if [[ -z "$TEMPLATE_FALLBACK" ]]; then
|
||||
msg_error "Failed to update LXC template list and no local template matching '$TEMPLATE_SEARCH' found."
|
||||
exit 201
|
||||
fi
|
||||
msg_info "Skipping template update – using local fallback: $TEMPLATE_FALLBACK"
|
||||
else
|
||||
msg_ok "LXC Template List Updated"
|
||||
fi
|
||||
$STD msg_ok "LXC Template List Updated"
|
||||
|
||||
# Get LXC template string
|
||||
if [ $PCT_OSTYPE = debian ]; then
|
||||
|
||||
@@ -64,6 +64,12 @@ function setup_nodejs() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Update to latest npm
|
||||
$STD npm install -g npm@latest || {
|
||||
msg_error "Failed to update npm to latest version"
|
||||
exit 1
|
||||
}
|
||||
|
||||
msg_ok "Setup Node.js ${NODE_VERSION}"
|
||||
fi
|
||||
|
||||
@@ -741,12 +747,12 @@ function fetch_and_deploy_gh_release() {
|
||||
|
||||
local app_lc=$(echo "${app,,}" | tr -d ' ')
|
||||
local version_file="$HOME/.${app_lc}"
|
||||
local curl_timeout="--connect-timeout 10 --max-time 30"
|
||||
|
||||
local api_timeout="--connect-timeout 5 --max-time 30"
|
||||
local download_timeout="--connect-timeout 15 --max-time 900"
|
||||
|
||||
local current_version=""
|
||||
if [[ -f "$version_file" ]]; then
|
||||
current_version=$(<"$version_file")
|
||||
fi
|
||||
[[ -f "$version_file" ]] && current_version=$(<"$version_file")
|
||||
|
||||
if ! command -v jq &>/dev/null; then
|
||||
$STD apt-get install -y jq &>/dev/null
|
||||
@@ -757,11 +763,22 @@ function fetch_and_deploy_gh_release() {
|
||||
local header=()
|
||||
[[ -n "${GITHUB_TOKEN:-}" ]] && header=(-H "Authorization: token $GITHUB_TOKEN")
|
||||
|
||||
local resp http_code
|
||||
resp=$(curl $curl_timeout -fsSL -w "%{http_code}" -o /tmp/gh_rel.json "${header[@]}" "$api_url")
|
||||
local max_retries=3 retry_delay=2 attempt=1 success=false resp http_code
|
||||
|
||||
while ((attempt <= max_retries)); do
|
||||
resp=$(curl $api_timeout -fsSL -w "%{http_code}" -o /tmp/gh_rel.json "${header[@]}" "$api_url") && success=true && break
|
||||
sleep "$retry_delay"
|
||||
((attempt++))
|
||||
done
|
||||
|
||||
if ! $success; then
|
||||
msg_error "Failed to fetch release metadata after $max_retries attempts"
|
||||
return 1
|
||||
fi
|
||||
|
||||
http_code="${resp:(-3)}"
|
||||
[[ "$http_code" != "200" ]] && {
|
||||
msg_error "Failed to fetch release: HTTP $http_code"
|
||||
msg_error "GitHub API returned HTTP $http_code"
|
||||
return 1
|
||||
}
|
||||
|
||||
@@ -779,14 +796,14 @@ function fetch_and_deploy_gh_release() {
|
||||
tmpdir=$(mktemp -d) || return 1
|
||||
local filename="" url=""
|
||||
|
||||
msg_info "Setup $app ($version)"
|
||||
msg_info "Fetching GitHub release: $app ($version)"
|
||||
|
||||
if [[ "$mode" == "tarball" || "$mode" == "source" ]]; then
|
||||
url=$(echo "$json" | jq -r '.tarball_url // empty')
|
||||
[[ -z "$url" ]] && url="https://github.com/$repo/archive/refs/tags/v$version.tar.gz"
|
||||
filename="${app_lc}-${version}.tar.gz"
|
||||
|
||||
curl $curl_timeout -fsSL -o "$tmpdir/$filename" "$url" || {
|
||||
curl $download_timeout -fsSL -o "$tmpdir/$filename" "$url" || {
|
||||
msg_error "Download failed: $url"
|
||||
rm -rf "$tmpdir"
|
||||
return 1
|
||||
@@ -830,7 +847,7 @@ function fetch_and_deploy_gh_release() {
|
||||
fi
|
||||
|
||||
filename="${url_match##*/}"
|
||||
curl $curl_timeout -fsSL -o "$tmpdir/$filename" "$url_match" || {
|
||||
curl $download_timeout -fsSL -o "$tmpdir/$filename" "$url_match" || {
|
||||
msg_error "Download failed: $url_match"
|
||||
rm -rf "$tmpdir"
|
||||
return 1
|
||||
@@ -865,7 +882,7 @@ function fetch_and_deploy_gh_release() {
|
||||
}
|
||||
|
||||
filename="${asset_url##*/}"
|
||||
curl $curl_timeout -fsSL -o "$tmpdir/$filename" "$asset_url" || {
|
||||
curl $download_timeout -fsSL -o "$tmpdir/$filename" "$asset_url" || {
|
||||
msg_error "Download failed: $asset_url"
|
||||
rm -rf "$tmpdir"
|
||||
return 1
|
||||
@@ -906,7 +923,7 @@ function fetch_and_deploy_gh_release() {
|
||||
|
||||
filename="${asset_url##*/}"
|
||||
mkdir -p "$target"
|
||||
curl $curl_timeout -fsSL -o "$target/$app" "$asset_url" || {
|
||||
curl $download_timeout -fsSL -o "$target/$app" "$asset_url" || {
|
||||
msg_error "Download failed: $asset_url"
|
||||
rm -rf "$tmpdir"
|
||||
return 1
|
||||
@@ -921,7 +938,7 @@ function fetch_and_deploy_gh_release() {
|
||||
fi
|
||||
|
||||
echo "$version" >"$version_file"
|
||||
msg_ok "Setup $app ($version)"
|
||||
msg_ok "Deployed: $app ($version)"
|
||||
rm -rf "$tmpdir"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user