Update build.func
Some checks failed
Bump build.func Revision / bump-revision (push) Has been cancelled
Some checks failed
Bump build.func Revision / bump-revision (push) Has been cancelled
This commit is contained in:
parent
9c9dc863a2
commit
3e31d59d82
@ -3004,10 +3004,10 @@ create_lxc_container() {
|
||||
|
||||
# Step 1: Search in local storage
|
||||
LOCAL_TEMPLATE=$(pveam list "$TEMPLATE_STORAGE" 2>/dev/null | awk '{print $NF}' | grep "^${PCT_OSTYPE}-${PCT_OSVERSION}.*${TEMPLATE_PATTERN}" | sort -V | tail -1)
|
||||
|
||||
|
||||
# Step 2: Check pveam for available version (could be newer)
|
||||
ONLINE_TEMPLATE=$(pveam available -section system 2>/dev/null | awk '{print $NF}' | grep "^${PCT_OSTYPE}-${PCT_OSVERSION}.*${TEMPLATE_PATTERN}" | sort -V | tail -1)
|
||||
|
||||
|
||||
# Decide what to use
|
||||
if [[ -n "$LOCAL_TEMPLATE" && -n "$ONLINE_TEMPLATE" ]]; then
|
||||
# Both exist - check if online is newer
|
||||
@ -3017,16 +3017,16 @@ create_lxc_container() {
|
||||
echo ""
|
||||
read -p "Download newer version? [y/N]: " answer
|
||||
case "${answer,,}" in
|
||||
y|yes)
|
||||
TEMPLATE="$ONLINE_TEMPLATE"
|
||||
TEMPLATE_SOURCE="online"
|
||||
msg_ok "Using newer version: $TEMPLATE"
|
||||
;;
|
||||
*)
|
||||
TEMPLATE="$LOCAL_TEMPLATE"
|
||||
TEMPLATE_SOURCE="local"
|
||||
msg_ok "Using local version: $TEMPLATE"
|
||||
;;
|
||||
y | yes)
|
||||
TEMPLATE="$ONLINE_TEMPLATE"
|
||||
TEMPLATE_SOURCE="online"
|
||||
msg_ok "Using newer version: $TEMPLATE"
|
||||
;;
|
||||
*)
|
||||
TEMPLATE="$LOCAL_TEMPLATE"
|
||||
TEMPLATE_SOURCE="local"
|
||||
msg_ok "Using local version: $TEMPLATE"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
# Same version
|
||||
@ -3052,7 +3052,7 @@ create_lxc_container() {
|
||||
echo " • The version is not yet available in the Proxmox template repository"
|
||||
echo " • Your Proxmox VE might need an update to access newer templates"
|
||||
echo " • The version number might be incorrect"
|
||||
|
||||
|
||||
mapfile -t AVAILABLE_VERSIONS < <(
|
||||
pveam available -section system 2>/dev/null |
|
||||
awk '{print $NF}' |
|
||||
@ -3060,7 +3060,7 @@ create_lxc_container() {
|
||||
sed -E "s/.*${PCT_OSTYPE}-([0-9]+(\.[0-9]+)?).*/\1/" |
|
||||
sort -u -V
|
||||
)
|
||||
|
||||
|
||||
if [[ ${#AVAILABLE_VERSIONS[@]} -gt 0 ]]; then
|
||||
echo ""
|
||||
msg_info "Available ${PCT_OSTYPE} versions:"
|
||||
@ -3069,7 +3069,7 @@ create_lxc_container() {
|
||||
done
|
||||
echo ""
|
||||
read -p "Select version [1-${#AVAILABLE_VERSIONS[@]}] or press Enter to cancel: " choice
|
||||
|
||||
|
||||
if [[ "$choice" =~ ^[0-9]+$ ]] && [[ "$choice" -ge 1 ]] && [[ "$choice" -le ${#AVAILABLE_VERSIONS[@]} ]]; then
|
||||
PCT_OSVERSION="${AVAILABLE_VERSIONS[$((choice - 1))]}"
|
||||
TEMPLATE=$(pveam available -section system 2>/dev/null | awk '{print $NF}' | grep "^${PCT_OSTYPE}-${PCT_OSVERSION}.*${TEMPLATE_PATTERN}" | sort -V | tail -1)
|
||||
@ -3180,7 +3180,7 @@ create_lxc_container() {
|
||||
}
|
||||
else
|
||||
msg_info "Installation cancelled"
|
||||
exit 0
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
msg_error "No ${PCT_OSTYPE} templates available"
|
||||
|
Loading…
x
Reference in New Issue
Block a user