2026-09-25 21:51:12 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
# ==========================================================
|
2026-10-06 18:05:32 +02:00
|
|
|
# ProxMenux - Update, modify, recreate or recover OCI instances
|
2026-09-25 21:51:12 +02:00
|
|
|
# ==========================================================
|
|
|
|
|
# Author : MacRimi
|
|
|
|
|
# Copyright : (c) 2024 MacRimi
|
|
|
|
|
# License : GPL-3.0
|
|
|
|
|
# https://github.com/MacRimi/ProxMenux/blob/main/LICENSE
|
|
|
|
|
# Version : 1.0
|
|
|
|
|
# ==========================================================
|
|
|
|
|
# Description:
|
|
|
|
|
# Runs in the ProxMenux Monitor terminal. Opens the same flow as
|
|
|
|
|
# OCI manager Apps -> Manage installed OCI applications for one
|
|
|
|
|
# container, without the list:
|
|
|
|
|
#
|
2026-10-06 18:05:32 +02:00
|
|
|
# VMID - the container (required for update, modify and recreate)
|
|
|
|
|
# ACTION - "update", "modify", "recreate" or "recover" (required);
|
2026-10-04 20:32:17 +02:00
|
|
|
# "recover" registers again the applications
|
|
|
|
|
# restored from a backup
|
2026-09-25 21:51:12 +02:00
|
|
|
# KEEP_BACKUP - storage where the backup taken before the
|
|
|
|
|
# update is kept (optional)
|
|
|
|
|
# ==========================================================
|
|
|
|
|
|
|
|
|
|
LOCAL_SCRIPTS="/usr/local/share/proxmenux/scripts"
|
|
|
|
|
BASE_DIR="/usr/local/share/proxmenux"
|
|
|
|
|
UTILS_FILE="$BASE_DIR/utils.sh"
|
|
|
|
|
|
|
|
|
|
if [[ -f "$UTILS_FILE" ]]; then
|
|
|
|
|
source "$UTILS_FILE"
|
|
|
|
|
fi
|
|
|
|
|
load_language
|
|
|
|
|
initialize_cache
|
|
|
|
|
|
2026-10-04 20:32:17 +02:00
|
|
|
if [[ ${ACTION:-} == "recover" ]]; then
|
|
|
|
|
exec bash "$LOCAL_SCRIPTS/oci/oci_manager_apps.sh" recover
|
|
|
|
|
fi
|
2026-09-25 21:51:12 +02:00
|
|
|
if [[ ! ${VMID:-} =~ ^[0-9]{1,9}$ ]]; then
|
|
|
|
|
msg_error "$(translate "Invalid VMID")"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2026-10-06 18:05:32 +02:00
|
|
|
if [[ ${ACTION:-} != "update" && ${ACTION:-} != "modify" && ${ACTION:-} != "recreate" ]]; then
|
2026-09-25 21:51:12 +02:00
|
|
|
msg_error "$(translate "Invalid action")"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
args=(manage "$VMID" --action "$ACTION")
|
|
|
|
|
if [[ -n ${KEEP_BACKUP:-} ]]; then
|
|
|
|
|
if [[ ! $KEEP_BACKUP =~ ^[A-Za-z0-9._-]{1,64}$ ]]; then
|
|
|
|
|
msg_error "$(translate "Invalid storage name")"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
args+=(--keep-backup "$KEEP_BACKUP")
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
exec bash "$LOCAL_SCRIPTS/oci/oci_manager_apps.sh" "${args[@]}"
|