Refactor OCI image handling in oci-deploy.sh

This commit is contained in:
CanbiZ (MickLesk) 2025-12-29 17:35:10 +01:00 committed by GitHub
parent dae69a6690
commit 3f490abff1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -98,7 +98,10 @@ if [[ -z "${OCI_IMAGE:-}" ]]; then
5) OCI_IMAGE="ghcr.io/linkwarden/linkwarden:latest" ;;
6)
read -r -p "Enter OCI image (e.g., ghcr.io/user/repo:tag): " OCI_IMAGE
[[ -z "$OCI_IMAGE" ]] && { msg_error "No image specified"; exit 1; }
[[ -z "$OCI_IMAGE" ]] && {
msg_error "No image specified"
exit 1
}
;;
*)
msg_error "Invalid choice"
@ -271,11 +274,12 @@ fi
# Create container
msg_info "Creating container $VMID"
PCT_CMD="pct create $VMID --ostemplate oci://$FULL_IMAGE"
# Build pct create command
PCT_CMD="pct create $VMID"
PCT_CMD+=" --hostname $CT_NAME"
PCT_CMD+=" --cores $CORES"
PCT_CMD+=" --memory $MEMORY"
PCT_CMD+=" --rootfs ${STORAGE}:${DISK}"
PCT_CMD+=" --rootfs ${STORAGE}:${DISK},oci=${FULL_IMAGE}"
PCT_CMD+=" --unprivileged $UNPRIVILEGED"
if [[ "$IP_MODE" == "static" && -n "$STATIC_IP" ]]; then