From 08d9dd11256979104770ceea03db153ca481f379 Mon Sep 17 00:00:00 2001 From: Sam <54530346+asylumexp@users.noreply.github.com> Date: Tue, 31 Dec 2024 15:29:37 +1000 Subject: [PATCH] Revert upstream changes to build files --- ct/alpine.sh | 2 +- ct/create_lxc.sh | 67 ++++++++++++++++++++++++++++++++++++----------- misc/install.func | 7 +++-- 3 files changed, 56 insertions(+), 20 deletions(-) diff --git a/ct/alpine.sh b/ct/alpine.sh index 4b1a28bc5..2e095820e 100644 --- a/ct/alpine.sh +++ b/ct/alpine.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +source <(curl -s https://raw.githubusercontent.com/asylumexp/Proxmox/main/misc/build.func) # Copyright (c) 2021-2024 tteck # Author: tteck (tteckster) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE diff --git a/ct/create_lxc.sh b/ct/create_lxc.sh index 46f529021..7b2ab2e5c 100644 --- a/ct/create_lxc.sh +++ b/ct/create_lxc.sh @@ -169,23 +169,60 @@ msg_ok "Using ${BL}$TEMPLATE_STORAGE${CL} ${GN}for Template Storage." CONTAINER_STORAGE=$(select_storage container) || exit msg_ok "Using ${BL}$CONTAINER_STORAGE${CL} ${GN}for Container Storage." -# Update LXC template list -msg_info "Updating LXC Template List" -pveam update >/dev/null -msg_ok "Updated LXC Template List" - # Get LXC template string -TEMPLATE_SEARCH=${PCT_OSTYPE}-${PCT_OSVERSION:-} -mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($TEMPLATE_SEARCH.*\)/\1/p" | sort -t - -k 2 -V) -[ ${#TEMPLATES[@]} -gt 0 ] || exit "Unable to find a template when searching for '$TEMPLATE_SEARCH'." -TEMPLATE="${TEMPLATES[-1]}" +if [ $PCT_OSTYPE = debian ]; then + if [ $PCT_OSVERSION = 11 ]; then + TEMPLATE_VARIENT=bullseye + else + TEMPLATE_VARIENT=bookworm + fi +elif [ $PCT_OSTYPE = alpine ]; then + TEMPLATE_VARIENT=3.19 +else + if [ $PCT_OSVERSION = 20.04 ]; then + TEMPLATE_VARIENT=focal + elif [ $PCT_OSVERSION = 24.04 ]; then + TEMPLATE_VARIENT=noble + else + TEMPLATE_VARIENT=jammy + fi +fi -# Download LXC template if needed -if ! pveam list $TEMPLATE_STORAGE | grep -q $TEMPLATE; then - msg_info "Downloading LXC Template" - pveam download $TEMPLATE_STORAGE $TEMPLATE >/dev/null || - exit "A problem occured while downloading the LXC template." - msg_ok "Downloaded LXC Template" +if [ -d "/var/lib/vz/template/cache" ]; then + TEMPLATE=$PCT_OSTYPE-$TEMPLATE_VARIENT-rootfs.tar.xz + # Download template if needed + if [ ! -f "/var/lib/vz/template/cache/$TEMPLATE" ]; then + if [ $PCT_OSTYPE = debian ]; then + msg_info "Downloading LXC Template" + wget -q $(curl -s https://api.github.com/repos/asylumexp/debian-ifupdown2-lxc/releases/latest | grep download | grep debian-$TEMPLATE_VARIENT-arm64-rootfs.tar.xz | cut -d\" -f4) -O /var/lib/vz/template/cache/$TEMPLATE -q || exit "A problem occured while downloading the LXC template." + msg_ok "Downloaded LXC Template" + else + templateurl="https://jenkins.linuxcontainers.org/job/image-$PCT_OSTYPE/architecture=arm64,release=$TEMPLATE_VARIENT,variant=default/lastStableBuild/artifact/rootfs.tar.xz" + msg_info "Downloading LXC Template" + wget $templateurl -O /var/lib/vz/template/cache/$TEMPLATE -q || exit "A problem occured while downloading the LXC template." + msg_ok "Downloaded LXC Template" + fi + fi +else + # Update LXC template list + msg_info "Updating LXC Template List" + pveam update >/dev/null + msg_ok "Updated LXC Template List" + if [ $PCT_OSTYPE = debian ]; then + msg_error "Debian unsupported with this download method. Exiting." + elif [ $PCT_OSTYPE = alpine]; then + $TEMPLATE_VARIENT = 3.18 + fi + + TEMPLATE="$(pveam available | grep -E "arm64.*$PCT_OSTYPE-$TEMPLATE_VARIENT" | sed 's/arm64[[:space:]]*//')" + + # Download LXC template if needed + if ! pveam list $TEMPLATE_STORAGE | grep -F $TEMPLATE > /dev/null; then + msg_info "Downloading LXC Template" + pveam download $TEMPLATE_STORAGE $TEMPLATE >/dev/null || + exit "A problem occured while downloading the LXC template." + msg_ok "Downloaded LXC Template" + fi fi # Combine all options diff --git a/misc/install.func b/misc/install.func index 24f752a48..b258d01ee 100644 --- a/misc/install.func +++ b/misc/install.func @@ -1,8 +1,7 @@ # Copyright (c) 2021-2024 tteck # Author: tteck (tteckster) -# Co-Author: MickLesk # License: MIT -# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# https://github.com/asylumexp/Proxmox/raw/main/LICENSE # This function sets color variables for formatting output in the terminal color() { @@ -219,7 +218,7 @@ motd_ssh() { if [ -f "$MOTD_FILE" ]; then # Start MOTD with application info and link echo -e "\n${BOLD}${APPLICATION} LXC Container${CL}" > "$MOTD_FILE" - echo -e "${TAB}${GATEWAY}${YW} Provided by: ${GN}community-scripts ORG ${YW}| GitHub: ${GN}https://github.com/community-scripts/ProxmoxVE${CL}\n" >> "$MOTD_FILE" + echo -e "${TAB}${GATEWAY}${YW} Provided by: ${GN}community-scripts & Pimox Scripts ${YW}| GitHub: ${GN}https://github.com/asylumexp/Proxmox${CL}\n" >> "$MOTD_FILE" # Add system information with icons echo -e "${TAB}${OS}${YW} OS: ${GN}${OS_NAME} - Version: ${OS_VERSION}${CL}" >> "$MOTD_FILE" @@ -253,6 +252,6 @@ EOF systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//') msg_ok "Customized Container" fi - echo "bash -c \"\$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/${app}.sh)\"" >/usr/bin/update + echo "bash -c \"\$(wget -qLO - https://github.com/asylumexp/Proxmox/raw/main/ct/${app}.sh)\"" >/usr/bin/update chmod +x /usr/bin/update }