6 Commits

Author SHA1 Message Date
5ceddb1c71 Add network configuration option in expert mode menu
Introduced a new menu option for setting network configurations when in expert mode. Updated menu handling logic to include this new option and integrated the corresponding function call.
2024-10-24 00:58:27 +02:00
1cc718832a Add conditional handling for environment files in docker-compose
Modified the script to conditionally check for the presence of environment files associated with each Docker image before bringing the containers down. This ensures that if an environment file exists, it is used with docker-compose, providing a more flexible and robust container management process.
2024-10-24 00:50:24 +02:00
7837d8ecd4 Update to version 3.7.0 and refactor prompt handling functions
Updated _VERSION to 3.7.0 and replaced whiptail-based yes/no prompts with getInputYesNo function. Added VDM_FORCE flag for automated confirmations.
2024-10-23 02:36:21 +02:00
593ae84c89 Update version to 3.6.4 and improve env file detection
Incremented the version number from 3.6.3 to 3.6.4. Added local variable initialization for evn_file and improved the logic to detect and use environment files for Docker Compose commands in various disable functions. This ensures the correct .env file is used if present.
2024-09-18 02:30:50 +02:00
962b1628c2 Update Joomla SMTP host port number #11
The port number for the JOOMLA_SMTP_HOST has been updated from 1080 to 1025. This change has been made in two places in the code - under VDM_EXTRA_JOOMLA_ENV. This will correct the SMTP settings and ensure emails from Joomla are correctly routed through the mailcatcher service.
2024-06-13 14:24:06 +02:00
b666db9f33 Add functionality to clone containers and volumes #9
The commit introduces a new feature that allows users to clone both containers and volumes. Functions have been added to facilitate the cloning process, including joomla__TRuST__clone, cloneContainer, and clonePersistentVolume. Adjustments have also been made in the main program to include this new cloning option into the interactive menu.
2024-06-13 14:22:12 +02:00

View File

@ -1,8 +1,8 @@
#!/usr/bin/env bash
# The most recent program version.
_VERSION="3.6.2"
_V="3.6"
_VERSION="3.7.0"
_V="3.7"
# Bash version required
_bash_v=4
@ -296,8 +296,8 @@ function traefik__TRuST__setup() {
# saved the file
showNotice "Saved ${VDM_CONTAINER_TYPE}:docker-compose.yml file.\nSetup of this container is complete!"
# ask if we should continue to enable
if (whiptail --yesno "Would you also like to enable this ${VDM_CONTAINER_TYPE^} container" --defaultno \
--title "Enable Container" --backtitle "${BACK_TITLE}" 8 112); then
if getInputYesNo "Would you also like to enable this ${VDM_CONTAINER_TYPE^} container" \
"Enable Container" 8 112 "defaultno"; then
enableContainer "${VDM_CONTAINER_TYPE}"
fi
##########################
@ -408,8 +408,8 @@ function portainer__TRuST__setup() {
# saved the file
showNotice "Saved ${VDM_CONTAINER_TYPE}:docker-compose.yml file.\nSetup of this container is complete!"
# ask if we should continue to enable
if (whiptail --yesno "Would you also like to enable this ${VDM_CONTAINER_TYPE^} container" \
--defaultno --title "Enable Container" --backtitle "${BACK_TITLE}" 8 112); then
if getInputYesNo "Would you also like to enable this ${VDM_CONTAINER_TYPE^} container" \
"Enable Container" 8 112 "defaultno"; then
enableContainer "${VDM_CONTAINER_TYPE}"
fi
##########################
@ -606,8 +606,8 @@ function joomla__TRuST__setup() {
# only if in expert mode set the container user detail id needed
if isExpert; then
# ask if we should add mailcatcher
if (whiptail --yesno "Would you also like to enable mailcatcher for these ${VDM_CONTAINER_TYPE^} containers" \
--defaultno --title "Enable Mailcatcher" --backtitle "${BACK_TITLE}" 8 112); then
if getInputYesNo "Would you also like to enable mailcatcher for these ${VDM_CONTAINER_TYPE^} containers" \
"Enable Mailcatcher" 8 112 "defaultno"; then
VDM_EXTRA_CONTAINER_STUFF=$(getYMLine1 "mailcatcher${VDM_KEY}:")
VDM_EXTRA_CONTAINER_STUFF+=$(getYMLine2 "image: schickling/mailcatcher")
VDM_EXTRA_CONTAINER_STUFF+=$(getYMLine2 "container_name: mailcatcher${VDM_KEY}")
@ -628,7 +628,7 @@ function joomla__TRuST__setup() {
fi
VDM_EXTRA_CONTAINER_STUFF+=$(getYMLine3 "- \"traefik.http.routers.mailcatcher${VDM_KEY}.service=mailcatcher${VDM_KEY}\"")
VDM_EXTRA_CONTAINER_STUFF+=$(getYMLine3 "- \"traefik.http.services.mailcatcher${VDM_KEY}.loadbalancer.server.port=1080\"")
VDM_EXTRA_JOOMLA_ENV+=$(getYMLine3 "- JOOMLA_SMTP_HOST=mailcatcher${VDM_KEY}:1080")
VDM_EXTRA_JOOMLA_ENV+=$(getYMLine3 "- JOOMLA_SMTP_HOST=mailcatcher${VDM_KEY}:1025")
fi
# if this is our octoleo images we can also set the user ID and user-group ID
setContainerUser "$(id -u)"
@ -723,8 +723,8 @@ function joomla__TRuST__setup() {
# saved the file
showNotice "Saved ${VDM_CONTAINER_TYPE}:docker-compose.yml file.\nSetup of this container is complete!"
# ask if we should continue to enable
if (whiptail --yesno "Would you also like to enable this ${VDM_CONTAINER_TYPE^} container" \
--defaultno --title "Enable Container" --backtitle "${BACK_TITLE}" 8 112); then
if getInputYesNo "Would you also like to enable this ${VDM_CONTAINER_TYPE^} container" \
"Enable Container" 8 112 "defaultno"; then
# we set the container details
export VDM_CONTAINER="${VDM_SUBDOMAIN}.${VDM_DOMAIN}"
# then we enable it
@ -936,8 +936,8 @@ function joomla__TRuST__bulk() {
fi
# ask if we should add mailcatcher
enable_mailcatcher=false
if (whiptail --yesno "Would you also like to enable mailcatcher for these ${VDM_CONTAINER_TYPE^} containers" \
--defaultno --title "Enable Mailcatcher" --backtitle "${BACK_TITLE}" 8 112); then
if getInputYesNo "Would you also like to enable mailcatcher for these ${VDM_CONTAINER_TYPE^} containers" \
"Enable Mailcatcher" 8 112 "defaultno"; then
enable_mailcatcher=true
fi
# we only do autodeploy for Joomla 4.3 and above
@ -971,8 +971,8 @@ function joomla__TRuST__bulk() {
setNumberContainers
# ask if we should continue to enable
enable_containers=false
if (whiptail --yesno "Would you also like to enable all these ${VDM_CONTAINER_TYPE^} containers" \
--defaultno --title "Enable Containers" --backtitle "${BACK_TITLE}" 8 112); then
if getInputYesNo "Would you also like to enable all these ${VDM_CONTAINER_TYPE^} containers" \
"Enable Containers" 8 112 "defaultno"; then
enable_containers=true
fi
# loop the number of containers
@ -1072,7 +1072,7 @@ function joomla__TRuST__bulk() {
fi
VDM_EXTRA_CONTAINER_STUFF+=$(getYMLine3 "- \"traefik.http.routers.mailcatcher${VDM_KEY}.service=mailcatcher${VDM_KEY}\"")
VDM_EXTRA_CONTAINER_STUFF+=$(getYMLine3 "- \"traefik.http.services.mailcatcher${VDM_KEY}.loadbalancer.server.port=1080\"")
VDM_EXTRA_JOOMLA_ENV+=$(getYMLine3 "- JOOMLA_SMTP_HOST=mailcatcher${VDM_KEY}:1080")
VDM_EXTRA_JOOMLA_ENV+=$(getYMLine3 "- JOOMLA_SMTP_HOST=mailcatcher${VDM_KEY}:1025")
fi
# setup letsencrypt stuff
VDM_JOOMLA_SECURE_LABELS=''
@ -1206,18 +1206,18 @@ function openssh__TRuST__setup() {
# get the global directory of the ssh public keys if not set
while [ ${#VDM_PUBLIC_KEY_GLOBAL_DIR} -le 1 ] || [ ! -d "${VDM_PUBLIC_KEY_GLOBAL_DIR}" ]; do
# creat the path if it exist
if [ ${#VDM_PUBLIC_KEY_GLOBAL_DIR} -ge 1 ] &&
(whiptail --yesno "Can we create the ${VDM_PUBLIC_KEY_GLOBAL_DIR} ssh folder" \
--title "Create the Path" --backtitle "${BACK_TITLE}" 8 112); then
if [ ${#VDM_PUBLIC_KEY_GLOBAL_DIR} -ge 1 ] && \
getInputYesNo "Can we create the ${VDM_PUBLIC_KEY_GLOBAL_DIR} ssh folder" \
"Create the Path" 8 112; then
mkdir -p "${VDM_PUBLIC_KEY_GLOBAL_DIR}"
else
# get the value
VDM_PUBLIC_KEY_GLOBAL_DIR=$(getInput "Enter the ssh path where we can select the ssh key folders from." \
"${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.ssh" 'Enter SSH Path')
# keep asking if empty or does exist
if [ ${#VDM_PUBLIC_KEY_GLOBAL_DIR} -ge 1 ] && [ ! -d "${VDM_PUBLIC_KEY_GLOBAL_DIR}" ] &&
(whiptail --yesno "Can we create the ${VDM_PUBLIC_KEY_GLOBAL_DIR} ssh folder" \
--title "Create the Path" --backtitle "${BACK_TITLE}" 8 112); then
if [ ${#VDM_PUBLIC_KEY_GLOBAL_DIR} -ge 1 ] && [ ! -d "${VDM_PUBLIC_KEY_GLOBAL_DIR}" ] && \
getInputYesNo "Can we create the ${VDM_PUBLIC_KEY_GLOBAL_DIR} ssh folder" \
"Create the Path" 8 112; then
# shellcheck disable=SC2174
mkdir -p -m 700 "${VDM_PUBLIC_KEY_GLOBAL_DIR}"
elif [ ${#VDM_PUBLIC_KEY_GLOBAL_DIR} -le 1 ]; then
@ -1231,9 +1231,9 @@ function openssh__TRuST__setup() {
# get the directory of this containers public keys if not set
while [ ${#VDM_PUBLIC_KEY_U_DIR} -le 1 ] || [ ! -d "${VDM_PUBLIC_KEY_U_DIR}" ]; do
# creat the path if it exist
if [ ${#VDM_PUBLIC_KEY_U_DIR} -ge 1 ] &&
(whiptail --yesno "Can we create this (${VDM_PUBLIC_KEY_U_DIR}) containers' ssh public keys folder" \
--title "Create the Path" --backtitle "${BACK_TITLE}" 8 112); then
if [ ${#VDM_PUBLIC_KEY_U_DIR} -ge 1 ] && \
getInputYesNo "Can we create this (${VDM_PUBLIC_KEY_U_DIR}) containers' ssh public keys folder" \
"Create the Path" 8 112; then
# shellcheck disable=SC2174
mkdir -p -m 700 "${VDM_PUBLIC_KEY_U_DIR}"
else
@ -1245,9 +1245,9 @@ function openssh__TRuST__setup() {
# add the parent dir back
VDM_PUBLIC_KEY_U_DIR="${VDM_PUBLIC_KEY_GLOBAL_DIR}/${VDM_PUBLIC_KEY_U_DIR}"
# check if this directory exist
if [ ! -d "${VDM_PUBLIC_KEY_U_DIR}" ] &&
(whiptail --yesno "Can we create this (${VDM_PUBLIC_KEY_U_DIR}) containers' ssh public keys folder" \
--title "Create the Path" --backtitle "${BACK_TITLE}" 8 112); then
if [ ! -d "${VDM_PUBLIC_KEY_U_DIR}" ] && \
getInputYesNo "Can we create this (${VDM_PUBLIC_KEY_U_DIR}) containers' ssh public keys folder" \
"Create the Path" 8 112; then
# shellcheck disable=SC2174
mkdir -p -m 700 "${VDM_PUBLIC_KEY_U_DIR}"
# TODO add option to add keys?
@ -1263,18 +1263,18 @@ function openssh__TRuST__setup() {
# get the directory of the ssh public keys if not set
while [ ${#VDM_PROJECT_U_DIR} -le 1 ] || [ ! -d "${VDM_PROJECT_U_DIR}" ]; do
# creat the path if it exist
if [ ${#VDM_PROJECT_U_DIR} -ge 1 ] &&
(whiptail --yesno "Can we create the ${VDM_PROJECT_U_DIR} parent mounting directory" \
--title "Create the Path" --backtitle "${BACK_TITLE}" 8 112); then
if [ ${#VDM_PROJECT_U_DIR} -ge 1 ] && \
getInputYesNo "Can we create the ${VDM_PROJECT_U_DIR} parent mounting directory" \
"Create the Path" 8 112; then
mkdir -p "${VDM_PROJECT_U_DIR}"
else
# get the value
VDM_PROJECT_U_DIR=$(getInput "Enter the parent path where we can select the folders to mount to this container." \
"${VDM_PROJECT_PATH}" 'Enter Path')
# keep asking if empty or does exist
if [ ${#VDM_PROJECT_U_DIR} -ge 1 ] && [ ! -d "${VDM_PROJECT_U_DIR}" ] &&
(whiptail --yesno "Can we create the ${VDM_PROJECT_U_DIR} parent mounting directory" \
--title "Create the Path" --backtitle "${BACK_TITLE}" 8 112); then
if [ ${#VDM_PROJECT_U_DIR} -ge 1 ] && [ ! -d "${VDM_PROJECT_U_DIR}" ] && \
getInputYesNo "Can we create the ${VDM_PROJECT_U_DIR} parent mounting directory" \
"Create the Path" 8 112; then
# shellcheck disable=SC2174
mkdir -p -m 700 "${VDM_PROJECT_U_DIR}"
elif [ ${#VDM_PROJECT_U_DIR} -le 1 ]; then
@ -1303,8 +1303,9 @@ function openssh__TRuST__setup() {
# when we mount a joomla volume we may not want to mount the database
mFull="${VDM_PROJECT_U_DIR}/${mDir}/joomla"
# add to mount projects
if [ -d "${mFull}" ] && (whiptail --yesno "Should we ONLY mount the (joomla website files) ${mDir}/joomla directory" \
--title "Mount Joomla" --backtitle "${BACK_TITLE}" 8 112); then
if [ -d "${mFull}" ] && \
getInputYesNo "Should we ONLY mount the (joomla website files) ${mDir}/joomla directory" \
"Mount Joomla" 8 112; then
VDM_VOLUMES_MOUNT+=$(getYMLine3 "- \${VDM_${VDM_ENV_KEY^^}_PROJECT_DIR}/${mDir}/joomla:/app/${mDir}")
else
VDM_VOLUMES_MOUNT+=$(getYMLine3 "- \${VDM_${VDM_ENV_KEY^^}_PROJECT_DIR}/${mDir}:/app/${mDir}")
@ -1339,8 +1340,8 @@ function openssh__TRuST__setup() {
# saved the file
showNotice "Saved ${VDM_CONTAINER_TYPE}:docker-compose.yml file.\nSetup of this container is complete!"
# ask if we should continue to enable
if (whiptail --yesno "Would you also like to enable this ${VDM_CONTAINER_TYPE^} container" \
--defaultno --title "Enable Container" --backtitle "${BACK_TITLE}" 8 112); then
if getInputYesNo "Would you also like to enable this ${VDM_CONTAINER_TYPE^} container" \
"Enable Container" 8 112 "defaultno"; then
# we set the container details
export VDM_CONTAINER="${VDM_USER_NAME}.${VDM_DOMAIN}"
# then we enable it
@ -1534,6 +1535,8 @@ function joomla__TRuST__enable() {
[ -e "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}" ] || {
ln -s "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/${VDM_CONTAINER}" "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}"
}
# set some local variables
local evn_file
# check if image has its own env file also
evn_file=''
# shellcheck disable=SC2015
@ -1555,6 +1558,7 @@ function joomla__TRuST__enable() {
# set some local variables
local vdm_enable_me
local container
local evn_file
# create the folder as needed
mkdir -p "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/"
# get containers to enable
@ -1603,6 +1607,8 @@ function openssh__TRuST__enable() {
[ -e "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}" ] || {
ln -s "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/${VDM_CONTAINER}" "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}"
}
# set some local variables
local evn_file
# check if image has its own env file also
evn_file=''
# shellcheck disable=SC2015
@ -1713,10 +1719,21 @@ function joomla__TRuST__disable() {
if ! hasDirectories "${VDM_CONTAINER_TYPE}/enabled/"; then
showError "There are no ${VDM_CONTAINER_TYPE^} containers to disable."
elif [ ${#VDM_CONTAINER} -ge 1 ]; then
# this means we have a single already selected container to enable if it exists
# this means we have a single already selected container to disable if it exists
if [ -d "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}" ]; then
# set some local variables
local evn_file
# check if image has its own env file also
evn_file=''
# shellcheck disable=SC2015
[ -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}/.env" ] && evn_file="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}/.env" || {
[ -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env" ] && evn_file="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env"
}
# make sure the docker image is stopped
# shellcheck disable=SC2015
[ ${#evn_file} -ge 1 ] && docker-compose --env-file "${evn_file}" --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}/docker-compose.yml" down --remove-orphans || {
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}/docker-compose.yml" down --remove-orphans
}
# then remove soft link
rm -rf "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}"
else
@ -1729,6 +1746,7 @@ function joomla__TRuST__disable() {
# set some local variables
local vdm_disable_me
local container
local evn_file
# get containers to enable
vdm_disable_me=$(getSelectedDirectories "Select container/s to disable." \
"${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/" "Disable ${VDM_CONTAINER_TYPE^} Containers")
@ -1740,8 +1758,17 @@ function joomla__TRuST__disable() {
for containered in "${vdm_disable_me_array[@]}"; do
# remove the " from the string
container="${containered//\"/}"
# check if image has its own env file also
evn_file=''
# shellcheck disable=SC2015
[ -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}/.env" ] && evn_file="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}/.env" || {
[ -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env" ] && evn_file="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env"
}
# make sure the docker image is stopped
# shellcheck disable=SC2015
[ ${#evn_file} -ge 1 ] && docker-compose --env-file "${evn_file}" --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}/docker-compose.yml" down --remove-orphans || {
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}/docker-compose.yml" down --remove-orphans
}
# then remove soft link
rm -rf "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}"
done
@ -1756,10 +1783,21 @@ function openssh__TRuST__disable() {
if ! hasDirectories "${VDM_CONTAINER_TYPE}/enabled/"; then
showError "There are no ${VDM_CONTAINER_TYPE^} containers to disable."
elif [ ${#VDM_CONTAINER} -ge 1 ]; then
# this means we have a single already selected container to enable if it exists
# this means we have a single already selected container to disable if it exists
if [ -d "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}" ]; then
# set some local variables
local evn_file
# check if image has its own env file also
evn_file=''
# shellcheck disable=SC2015
[ -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}/.env" ] && evn_file="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}/.env" || {
[ -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env" ] && evn_file="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env"
}
# make sure the docker image is stopped
# shellcheck disable=SC2015
[ ${#evn_file} -ge 1 ] && docker-compose --env-file "${evn_file}" --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}/docker-compose.yml" down --remove-orphans || {
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}/docker-compose.yml" down --remove-orphans
}
# then remove soft link
rm -rf "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}"
else
@ -1772,6 +1810,7 @@ function openssh__TRuST__disable() {
# set some local variables
local vdm_disable_me
local container
local evn_file
# get containers to enable
vdm_disable_me=$(getSelectedDirectories "Select container/s to disable." \
"${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/" "Disable ${VDM_CONTAINER_TYPE^} Containers")
@ -1783,8 +1822,17 @@ function openssh__TRuST__disable() {
for containered in "${vdm_disable_me_array[@]}"; do
# remove the " from the string
container="${containered//\"/}"
# check if image has its own env file also
evn_file=''
# shellcheck disable=SC2015
[ -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}/.env" ] && evn_file="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}/.env" || {
[ -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env" ] && evn_file="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env"
}
# make sure the docker image is stopped
# shellcheck disable=SC2015
[ ${#evn_file} -ge 1 ] && docker-compose --env-file "${evn_file}" --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}/docker-compose.yml" down --remove-orphans || {
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}/docker-compose.yml" down --remove-orphans
}
# then remove soft link
rm -rf "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}"
done
@ -1799,8 +1847,19 @@ function traefik__TRuST__disable() {
if [ ! -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" ]; then
showError "There is no ${VDM_CONTAINER_TYPE^} container to disable."
else
# set some local variables
local evn_file
# check if image has its own env file also
evn_file=''
# shellcheck disable=SC2015
[ -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env" ] && evn_file="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env" || {
[ -f "${VDM_SRC_PATH}/.env" ] && evn_file="${VDM_SRC_PATH}/.env"
}
# make sure the docker image is stopped
# shellcheck disable=SC2015
[ ${#evn_file} -ge 1 ] && docker-compose --env-file "${evn_file}" --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" down || {
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" down
}
fi
}
@ -1811,8 +1870,19 @@ function portainer__TRuST__disable() {
if [ ! -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" ]; then
showError "There is no ${VDM_CONTAINER_TYPE^} container to disable."
else
# set some local variables
local evn_file
# check if image has its own env file also
evn_file=''
# shellcheck disable=SC2015
[ -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env" ] && evn_file="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env" || {
[ -f "${VDM_SRC_PATH}/.env" ] && evn_file="${VDM_SRC_PATH}/.env"
}
# make sure the docker image is stopped
# shellcheck disable=SC2015
[ ${#evn_file} -ge 1 ] && docker-compose --env-file "${evn_file}" --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" down || {
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" down
}
fi
}
@ -1885,11 +1955,24 @@ function joomla__TRuST__down() {
if ! hasDirectories "${VDM_CONTAINER_TYPE}/enabled/"; then
showError "There are no ${VDM_CONTAINER_TYPE^} containers to take down.\n\
(UP and DOWN targets only enabled containers)"
elif (whiptail --yesno "Are you absolutely sure you want to take down all the ${VDM_CONTAINER_TYPE^} containers?" \
--title "Take Down Containers" --backtitle "${BACK_TITLE}" 8 112); then
elif getInputYesNo "Are you absolutely sure you want to take down all the ${VDM_CONTAINER_TYPE^} containers?" \
"Take Down Containers" 8 112; then
# get all zip files
for yml in "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/"*/*.yml; do
# get the vdm_container value
vdm_container="${yml%/docker-compose.yml}"
# check if image has its own env file also
evn_file=''
# check if image has its own env file also
# shellcheck disable=SC2015
[ -f "${vdm_container}/.env" ] && evn_file="${vdm_container}/.env" || {
[ -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env" ] && evn_file="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env"
}
# make sure the docker image is started
# shellcheck disable=SC2015
[ ${#evn_file} -ge 1 ] && docker-compose --env-file "${evn_file}" --file "${yml}" down || {
docker-compose --file "${yml}" down
}
done
fi
}
@ -1900,15 +1983,64 @@ function openssh__TRuST__down() {
# check if this type has enabled containers
if ! hasDirectories "${VDM_CONTAINER_TYPE}/enabled/"; then
showError "There are no ${VDM_CONTAINER_TYPE^} containers to take down."
elif (whiptail --yesno "Are you absolutely sure you want to take down all the ${VDM_CONTAINER_TYPE^} containers?" \
--title "Take Down Containers" --backtitle "${BACK_TITLE}" 8 112); then
elif getInputYesNo "Are you absolutely sure you want to take down all the ${VDM_CONTAINER_TYPE^} containers?" \
"Take Down Containers" 8 112; then
# get all zip files
for yml in "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/"*/*.yml; do
# get the vdm_container value
vdm_container="${yml%/docker-compose.yml}"
# check if image has its own env file also
evn_file=''
# check if image has its own env file also
# shellcheck disable=SC2015
[ -f "${vdm_container}/.env" ] && evn_file="${vdm_container}/.env" || {
[ -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env" ] && evn_file="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env"
}
# make sure the docker image is started
# shellcheck disable=SC2015
[ ${#evn_file} -ge 1 ] && docker-compose --env-file "${evn_file}" --file "${yml}" down || {
docker-compose --file "${yml}" down
}
done
fi
}
#####################################################################################################################VDM
######################################## CLONE JOOMLA
function joomla__TRuST__clone() {
# check if this type have available containers
if ! hasDirectories "${VDM_CONTAINER_TYPE}/available/"; then
showError "The path ${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/ does not exist or is empty, first run a ${VDM_CONTAINER_TYPE^} setup."
else
# ask if they want to clone a volume
if getInputYesNo "Would you like to clone a persistent volume found in (${VDM_PROJECT_PATH})?" \
"Continue To Clone Persistent Volume" 12 112; then
# trigger the volumes clone script
clonePersistentVolume
fi
# ask if they want to clone a container
if getInputYesNo "Would you like to clone a ${VDM_CONTAINER_TYPE^} container?" \
"Continue To Clone Container (feature not ready)" 12 112 "defaultno"; then
# set some local variables
local vdm_clone_me
local container
# list containers... and allow selection to edit
container=$(getSelectedDirectory "Select a container you would like to clone." \
"${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/" '' "Clone ${VDM_CONTAINER_TYPE^} Container (feature not ready)")
# check that we have something, else return to main menu
if [ ${#container} -ge 1 ]; then
# add the parent dir back
vdm_clone_me="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/${container}/docker-compose.yml"
# check if this docker-composer.yml exist
if [ -f "${vdm_clone_me}" ]; then
# give little heads-up
showNotice "Feature not ready!!\nYou have selected: ${vdm_clone_me}" 13
fi
fi
fi
fi
}
#####################################################################################################################VDM
######################################## DELETE JOOMLA
function joomla__TRuST__delete() {
@ -1940,17 +2072,17 @@ function joomla__TRuST__delete() {
rm -rf "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}"
fi
# before deleting the config we ask to make sure
if (whiptail --yesno "Would you like to delete the (${container}) container's folder that holds the docker-compose.yml file?" \
--title "Delete Docker Compose Yaml" --backtitle "${BACK_TITLE}" 8 112); then
if getInputYesNo "Would you like to delete the (${container}) container's folder that holds the docker-compose.yml file?" \
"Delete Docker Compose Yaml" 8 112; then
# then remove docker-compose.yml file
rm -rf "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/${container}"
fi
done
fi
# ask if there are volumes to delete
if hasDirectories '' "${VDM_PROJECT_PATH}" &&
(whiptail --yesno "Would you like to delete persistent volumes found in (${VDM_PROJECT_PATH})?" \
--title "Continue To Delete Persistent Volumes" --backtitle "${BACK_TITLE}" 12 112); then
if hasDirectories '' "${VDM_PROJECT_PATH}" && \
getInputYesNo "Would you like to delete persistent volumes found in (${VDM_PROJECT_PATH})?" \
"Continue To Delete Persistent Volumes" 12 112; then
# trigger the volumes removal script
deletePersistentVolumes
fi
@ -1988,8 +2120,8 @@ function openssh__TRuST__delete() {
rm -fr "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}"
fi
# before deleting the config we ask to make sure
if (whiptail --yesno "Would you like to delete the (${container}) container's folder that holds the docker-compose.yml file?" \
--title "Delete Docker Compose Yaml" --backtitle "${BACK_TITLE}" 8 112); then
if getInputYesNo "Would you like to delete the (${container}) container's folder that holds the docker-compose.yml file?" \
"Delete Docker Compose Yaml" 8 112; then
# then remove docker-compose.yml file
rm -fr "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/${container}"
fi
@ -2008,8 +2140,8 @@ function traefik__TRuST__delete() {
# make sure the docker image is stopped
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" down
# before deleting the config we ask to make sure
if (whiptail --yesno "Would you like to delete the ${VDM_CONTAINER_TYPE^} container's docker-compose.yml file?" \
--title "Delete Docker Compose Yaml" --backtitle "${BACK_TITLE}" 8 112); then
if getInputYesNo "Would you like to delete the ${VDM_CONTAINER_TYPE^} container's docker-compose.yml file?" \
"Delete Docker Compose Yaml" 8 112; then
# then remove docker-compose.yml file
rm -fr "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml"
fi
@ -2026,8 +2158,8 @@ function portainer__TRuST__delete() {
# make sure the docker image is stopped
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" down
# before deleting the config we ask to make sure
if (whiptail --yesno "Would you like to delete the ${VDM_CONTAINER_TYPE^} container's docker-compose.yml file?" \
--title "Delete Docker Compose Yaml" --backtitle "${BACK_TITLE}" 8 112); then
if getInputYesNo "Would you like to delete the ${VDM_CONTAINER_TYPE^} container's docker-compose.yml file?" \
"Delete Docker Compose Yaml" 8 112; then
# then remove docker-compose.yml file
rm -fr "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml"
fi
@ -2038,9 +2170,9 @@ function portainer__TRuST__delete() {
######################################## RESET JOOMLA
function joomla__TRuST__reset() {
# ask if there are volumes to delete
if hasDirectories '' "${VDM_PROJECT_PATH}" &&
(whiptail --yesno "Would you like to reset persistent volumes found in (${VDM_PROJECT_PATH})?" \
--title "Continue To Reset Persistent Volumes" --backtitle "${BACK_TITLE}" 12 112); then
if hasDirectories '' "${VDM_PROJECT_PATH}" && \
getInputYesNo "Would you like to reset persistent volumes found in (${VDM_PROJECT_PATH})?" \
"Continue To Reset Persistent Volumes" 12 112; then
# trigger the volumes reset script
resetPersistentJoomlaVolumes
fi
@ -2232,6 +2364,15 @@ function upContainers() {
main
}
# clone a container
function cloneContainer() {
# make sure of our container type
VDM_CONTAINER_TYPE="${1}"
VDM_TASK="clone"
# execute the task
main
}
# delete a container
function deleteContainer() {
# make sure of our container type
@ -2447,6 +2588,44 @@ function deletePersistentVolumes() {
fi
}
# clone persistent volume
function clonePersistentVolume() {
# we first check if we have some volumes
if hasDirectories '' "${VDM_PROJECT_PATH}"; then
# set some local variables
local vdm_clone_volume
local persistent
local new_persistent
# get containers to enable
vdm_clone_volume=$(getSelectedDirectory "Select persistent volume\s to delete." \
"${VDM_PROJECT_PATH}" "Select Persistent Volume to Clone")
# check that we have something, else return to main menu
if [ ${#vdm_clone_volume} -ge 1 ]; then
# remove the " from the string
persistent="${vdm_clone_volume//\"/}"
# last serious check and then its gone
if [ -d "${VDM_PROJECT_PATH}/${persistent}" ]; then
# set the new persistent volume name
new_persistent="${persistent}"
while [ -d "${VDM_PROJECT_PATH}/${new_persistent}" ]; do
# get the value
new_persistent=$(getInput "Enter a new persistent volume name\n[do not use (${persistent}) or any other existing volume names]" '' 'Enter Persistent Name')
# keep asking
if [ -d "${VDM_PROJECT_PATH}/${new_persistent}" ]; then
showError "You must enter a persistent volume name that does not already exist.\n\n${new_persistent} already exist."
fi
done
# create this new folder
mkdir -p "${VDM_PROJECT_PATH}/${new_persistent}"
# clone or (copy) the files to a new directory.
sudo cp -af "${VDM_PROJECT_PATH}/${persistent}/"* "${VDM_PROJECT_PATH}/${new_persistent}"
fi
fi
else
showError "There are no persistent volumes found in ${VDM_PROJECT_PATH}."
fi
}
# reset persistent Joomla volume
function resetPersistentJoomlaVolumes() {
# we first check if we have some volumes
@ -2491,8 +2670,8 @@ function resetPersistentJoomlaVolumes() {
# make an update
function runUpdate() {
# we need sudo permissions
if (whiptail --yesno "${USER^}, to update ${PROGRAM_NAME} we need sudo privileges." \
--title "Give sudo Privileges" --backtitle "${BACK_TITLE}" 8 112); then
if getInputYesNo "${USER^}, to update ${PROGRAM_NAME} we need sudo privileges." \
"Give sudo Privileges" 8 112; then
# remove the current version
if [ -f /usr/local/bin/octojoom ]; then
# just backup in case of failure
@ -2761,6 +2940,9 @@ function showJoomla() {
hasDirectories '' "${VDM_PROJECT_PATH}" &&
menu_options+=("fix" "Fix permissions of folders and files of a container") &&
i=$((i + 1))
# clone a container & volume
hasDirectories 'joomla/available' &&
menu_options+=("clone" "Clone a container") && i=$((i + 1))
# delete a container
hasDirectories 'joomla/available' &&
menu_options+=("delete" "Delete a container") && i=$((i + 1))
@ -2805,6 +2987,9 @@ function showJoomla() {
"fix")
fixContainersPermissions
;;
"clone")
cloneContainer 'joomla'
;;
"delete")
deleteContainer 'joomla'
;;
@ -2822,7 +3007,7 @@ function showJoomla() {
# menu loop
case $CHOICE in
"setup" | "edit" | "enable" | "disable" | "down" | "up" | "fix" | "delete" | "reset" | "joomla_env" | "bulk")
"setup" | "edit" | "enable" | "disable" | "down" | "up" | "fix" | "clone" | "delete" | "reset" | "joomla_env" | "bulk")
showJoomla
;;
esac
@ -2927,6 +3112,8 @@ function showTraefik() {
# delete traefik container
[ -f "${VDM_REPO_PATH}/traefik/docker-compose.yml" ] &&
menu_options+=("delete" "Delete Traefik") && i=$((i + 1))
# set network if not set
isExpert && menu_options+=("network" "Set Network") && i=$((i + 1))
# Quit Octoleo Program
menu_options+=("quit" "Quit ${PROGRAM_NAME}")
# get the selection
@ -2954,12 +3141,15 @@ function showTraefik() {
"delete")
deleteContainer 'traefik'
;;
"network")
setNetworks
;;
"quit") quitProgram ;;
esac
# menu loop
case $CHOICE in
"setup" | "edit" | "enable" | "disable" | "delete")
"setup" | "edit" | "enable" | "disable" | "delete" | "network")
showTraefik
;;
esac
@ -3450,6 +3640,42 @@ function getInput() {
echo "${answer}"
}
# Display a yes/no prompt using the whiptail utility.
# If "defaultno" is passed as the fifth parameter, it defaults to "No" when VDM_FORCE is set to "true".
# $1: Prompt message
# $2 (optional): Title for the dialog (default: "Confirmation Required")
# $3 (optional): Height of the dialog (default: 8)
# $4 (optional): Width of the dialog (default: 50)
# $5 (optional): Set to "defaultno" to make "No" the default choice.
# Returns 0 (yes) if the user selects "Yes".
# Returns 1 (no) if the user selects "No" or if "defaultno" is set and VDM_FORCE is "true".
function getInputYesNo() {
# set local vars
local question="$1"
local title="${2:-Confirmation Required}"
local height="${3:-8}"
local width="${4:-50}"
local defaultno="${5:-}"
# Handle VDM_FORCE behavior based on the 'defaultno' parameter
if [ "$VDM_FORCE" = "true" ]; then
if [ "$defaultno" = "defaultno" ]; then
return 1 # Default to No if "defaultno" is set and VDM_FORCE is true
else
return 0 # Default to Yes if "defaultno" is not set and VDM_FORCE is true
fi
else
# Display the whiptail prompt with the provided parameters
if [ "$defaultno" = "defaultno" ]; then
whiptail --defaultno --yesno "$question" "$height" "$width" --title "$title" \
--backtitle "${BACK_TITLE}" 3>&1 1>&2 2>&3
else
whiptail --yesno "$question" "$height" "$width" --title "$title" \
--backtitle "${BACK_TITLE}" 3>&1 1>&2 2>&3
fi
fi
}
# get the input until is gotten
function getInputNow() {
local message
@ -3772,9 +3998,9 @@ function getMainDomain() {
# set the container user
function setContainerUser() {
# ask if a new User ID should be set if one is set
if [ -n "${VDM_PUID}" ] && [[ "${VDM_PUID}" =~ ^[0-9]+$ ]] &&
(whiptail --yesno "The user ID in ${PROGRAM_NAME} memory is ${VDM_PUID}, would you like to change this user ID?" \
--defaultno --title "Set User ID" --backtitle "${BACK_TITLE}" 8 112); then
if [ -n "${VDM_PUID}" ] && [[ "${VDM_PUID}" =~ ^[0-9]+$ ]] && \
getInputYesNo "The user ID in ${PROGRAM_NAME} memory is ${VDM_PUID}, would you like to change this user ID?" \
"Set User ID" 8 112 "defaultno"; then
# always first reset
unset VDM_PUID
fi
@ -3789,10 +4015,11 @@ function setContainerUser() {
showError "You must enter a user ID like: ${1:-1000} (only the number)"
fi
done
# ask if a new Group ID should be set if one is set
if [ -n "${VDM_PGID}" ] && [[ "${VDM_PGID}" =~ ^[0-9]+$ ]] &&
(whiptail --yesno "The user-group ID in ${PROGRAM_NAME} memory is ${VDM_PGID}, would you like to change this user-group ID?" \
--defaultno --title "Set User-Group ID" --backtitle "${BACK_TITLE}"8 112); then
if [ -n "${VDM_PGID}" ] && [[ "${VDM_PGID}" =~ ^[0-9]+$ ]] && \
getInputYesNo "The user-group ID in ${PROGRAM_NAME} memory is ${VDM_PGID}, would you like to change this user-group ID?" \
"Set User-Group ID" 8 112 "defaultno"; then
# always first reset
unset VDM_PGID
fi
@ -3961,9 +4188,9 @@ function setUniqueKey() {
# set the Joomla website details
function setJoomlaWebsiteDetails() {
# ask if we should add autodeployment
if (whiptail --yesno "Would you like to enable website autodeploy for ${VDM_CONTAINER_TYPE,}:${VDM_JV}" \
--defaultno --title "Enable Autodeploy" --backtitle "${BACK_TITLE}" 8 112); then
# ask if we should add auto deployment
if getInputYesNo "Would you like to enable website auto deploy for ${VDM_CONTAINER_TYPE,}:${VDM_JV}" \
"Enable Auto deploy" 8 112; then
# ask for website name
setJoomlaSiteName
@ -4233,8 +4460,8 @@ function isVersionAbove() {
# set persistence volumes
function setPersistence() {
# ask the question
if (whiptail --yesno "Would you like to enable persistence on this $1." \
--title "Persist Volume" --backtitle "${BACK_TITLE}" 8 112); then
if getInputYesNo "Would you like to enable persistence on this $1." \
"Persist Volume" 8 112; then
# yes persistence
return 0
fi
@ -4245,8 +4472,8 @@ function setPersistence() {
# set the PHP settings
function setPHPSettings() {
# ask the question
if (whiptail --yesno "Would you like to set some PHP overrides for the Joomla container.\n\nTo make these changes we need sudo privileges." \
--defaultno --title "PHP.ini values" --backtitle "${BACK_TITLE}" 9 112); then
if getInputYesNo "Would you like to set some PHP overrides for the Joomla container.\n\nTo make these changes we need sudo privileges." \
"PHP.ini values" 9 112; then
# max_execution_time
VDM_max_execution_time=$(getInputNow "Enter max execution time" \
@ -4306,8 +4533,8 @@ function setPHPSettings() {
} > "${VDM_PROJECT_PATH}/${VDM_PHP_PROJECT_PATH}/php.ini"
# allow custom edit
if isExpert && (whiptail --yesno "Would you like to set some more custom PHP overrides for this Joomla container" \
--defaultno --title "Edit PHP.ini" --backtitle "${BACK_TITLE}" 8 112); then
if isExpert && getInputYesNo "Would you like to set some more custom PHP overrides for this Joomla container" \
"Edit PHP.ini" 8 112 "defaultno"; then
# give little heads-up
showNotice "${USER^}, to save the changes you've made or to just close the file again press:\n\n[ctrl+x] with nano on ubuntu." 13
# lets open the file with nano for now
@ -4332,8 +4559,8 @@ function setPHPSettings() {
# set the docker entrypoint
function setDockerEntrypoint() {
# ask the question
if (whiptail --yesno "Would you like to customize the entrypoint script for this Joomla container" \
--defaultno --title "entrypoint.sh values" --backtitle "${BACK_TITLE}" 8 112); then
if getInputYesNo "Would you like to customize the entrypoint script for this Joomla container" \
"entrypoint.sh values" 8 112 "defaultno"; then
# make sure the directory exist
mkdir -p "${VDM_PROJECT_PATH}/${VDM_ENTRY_PROJECT_PATH}"
# unattended deploy
@ -4365,8 +4592,8 @@ function setDockerEntrypoint() {
# set the secure state
function setSecureCloudflareState() {
# check the security switch
if (whiptail --yesno "Will this container be proxied by Cloudflare [ONLY for server proxied in none-strict mode via Cloudflare]" \
--defaultno --title "Cloudflare" --backtitle "${BACK_TITLE}" 8 112); then
if getInputYesNo "Will this container be proxied by Cloudflare [ONLY for server proxied in none-strict mode via Cloudflare]" \
"Cloudflare" 8 112 "defaultno"; then
# we set the secure switch
VDM_SECURE_CLOUDFLARE=true
else
@ -4380,8 +4607,8 @@ function setSecureCloudflareState() {
function setSecureState() {
if [ "${VDM_SECURE:-not}" = 'not' ]; then
# check the security switch
if (whiptail --yesno "Would you like to use Letsencrypt auto setup for your containers [ONLY for server with public static IP]" \
--defaultno --title "Letsencrypt" --backtitle "${BACK_TITLE}" 8 112); then
if getInputYesNo "Would you like to use Letsencrypt auto setup for your containers [ONLY for server with public static IP]" \
"Letsencrypt" 8 112 "defaultno"; then
# we set the secure switch
VDM_SECURE=true
else
@ -4895,11 +5122,13 @@ function pushContainerMigration() {
remote_repo_path=$(getRemoteEnvValue "${remote}" "VDM_REPO_PATH")
if [ ! "${remote_repo_path}" = 'none_found' ]; then
local remote_path="${remote_repo_path}/${container_path}"
# check how we must do this
# check if we must backup remote folder
if remoteFolderExists "${remote_path}" "${remote}" && (whiptail --yesno "${USER^}, would you like to backup the remote container?" \
--backtitle "${BACK_TITLE}" --title "Backup Remote" 15 112); then
backupRemoteFolder "${remote_path}" "${remote}"
fi
# if folder still exist remove remote folder
removeRemoteFolder "${remote_path}" "${remote}"
# sync folder
syncWithRemote "${local_path}" "${remote_path}" "${remote}"
# check if it was done successfully
@ -4966,6 +5195,8 @@ function pushDirectoryMigration() {
then
backupRemoteFolder "${remote_path}" "${remote}"
fi
# if folder still exist remove remote folder
removeRemoteFolder "${remote_path}" "${remote}"
# un-tar the remote file
remoteUntarGz "${remote_path}.tar.gz" "${remote_path}" "${remote}"
# we are done
@ -5095,6 +5326,17 @@ function backupRemoteFolder() {
ssh "${remote}" "if [ -d '${remote_path}' ]; then mv '${remote_path}' '${backup_name}'; fi"
}
# remove the remote folder
function removeRemoteFolder() {
local remote_path="$1"
local remote="$2"
# always confirm that the path exist
if remoteFolderExists "${remote_path}" "${remote}"; then
# shellcheck disable=SC2029
ssh "${remote}" "if [ -d '${remote_path}' ]; then sudo rm -Irf '${remote_path}'; fi"
fi
}
# Prep remote folder
function prepRemoteFolder() {
local remote_path="$1"
@ -5323,6 +5565,7 @@ EOF
# defaults
VDM_ARG_DOMAIN=false
VDM_FORCE=false
# check if we have options
while :; do
@ -5335,6 +5578,9 @@ while :; do
runUpdate
shift
;;
-y | --yes)
VDM_FORCE=true
;;
--access-token) # Takes an option argument; ensure it has been specified.
if [ "$2" ]; then
VDM_ACCESS_TOKEN=$2