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
|
# 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)
|
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)
|
# 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)
|
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
|
# Decide what to use
|
||||||
if [[ -n "$LOCAL_TEMPLATE" && -n "$ONLINE_TEMPLATE" ]]; then
|
if [[ -n "$LOCAL_TEMPLATE" && -n "$ONLINE_TEMPLATE" ]]; then
|
||||||
# Both exist - check if online is newer
|
# Both exist - check if online is newer
|
||||||
@ -3017,16 +3017,16 @@ create_lxc_container() {
|
|||||||
echo ""
|
echo ""
|
||||||
read -p "Download newer version? [y/N]: " answer
|
read -p "Download newer version? [y/N]: " answer
|
||||||
case "${answer,,}" in
|
case "${answer,,}" in
|
||||||
y|yes)
|
y | yes)
|
||||||
TEMPLATE="$ONLINE_TEMPLATE"
|
TEMPLATE="$ONLINE_TEMPLATE"
|
||||||
TEMPLATE_SOURCE="online"
|
TEMPLATE_SOURCE="online"
|
||||||
msg_ok "Using newer version: $TEMPLATE"
|
msg_ok "Using newer version: $TEMPLATE"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
TEMPLATE="$LOCAL_TEMPLATE"
|
TEMPLATE="$LOCAL_TEMPLATE"
|
||||||
TEMPLATE_SOURCE="local"
|
TEMPLATE_SOURCE="local"
|
||||||
msg_ok "Using local version: $TEMPLATE"
|
msg_ok "Using local version: $TEMPLATE"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
# Same version
|
# Same version
|
||||||
@ -3052,7 +3052,7 @@ create_lxc_container() {
|
|||||||
echo " • The version is not yet available in the Proxmox template repository"
|
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 " • Your Proxmox VE might need an update to access newer templates"
|
||||||
echo " • The version number might be incorrect"
|
echo " • The version number might be incorrect"
|
||||||
|
|
||||||
mapfile -t AVAILABLE_VERSIONS < <(
|
mapfile -t AVAILABLE_VERSIONS < <(
|
||||||
pveam available -section system 2>/dev/null |
|
pveam available -section system 2>/dev/null |
|
||||||
awk '{print $NF}' |
|
awk '{print $NF}' |
|
||||||
@ -3060,7 +3060,7 @@ create_lxc_container() {
|
|||||||
sed -E "s/.*${PCT_OSTYPE}-([0-9]+(\.[0-9]+)?).*/\1/" |
|
sed -E "s/.*${PCT_OSTYPE}-([0-9]+(\.[0-9]+)?).*/\1/" |
|
||||||
sort -u -V
|
sort -u -V
|
||||||
)
|
)
|
||||||
|
|
||||||
if [[ ${#AVAILABLE_VERSIONS[@]} -gt 0 ]]; then
|
if [[ ${#AVAILABLE_VERSIONS[@]} -gt 0 ]]; then
|
||||||
echo ""
|
echo ""
|
||||||
msg_info "Available ${PCT_OSTYPE} versions:"
|
msg_info "Available ${PCT_OSTYPE} versions:"
|
||||||
@ -3069,7 +3069,7 @@ create_lxc_container() {
|
|||||||
done
|
done
|
||||||
echo ""
|
echo ""
|
||||||
read -p "Select version [1-${#AVAILABLE_VERSIONS[@]}] or press Enter to cancel: " choice
|
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
|
if [[ "$choice" =~ ^[0-9]+$ ]] && [[ "$choice" -ge 1 ]] && [[ "$choice" -le ${#AVAILABLE_VERSIONS[@]} ]]; then
|
||||||
PCT_OSVERSION="${AVAILABLE_VERSIONS[$((choice - 1))]}"
|
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)
|
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
|
else
|
||||||
msg_info "Installation cancelled"
|
msg_info "Installation cancelled"
|
||||||
exit 0
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
msg_error "No ${PCT_OSTYPE} templates available"
|
msg_error "No ${PCT_OSTYPE} templates available"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user