mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-14 02:54:28 +05:00
fix(backups): fix broken config target folder name
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
@@ -33,23 +33,25 @@ function backup_before_update() {
|
|||||||
|
|
||||||
function backup_config_dir() {
|
function backup_config_dir() {
|
||||||
check_for_backup_dir
|
check_for_backup_dir
|
||||||
local current_date instance_names config_pathes
|
local current_date config_pathes
|
||||||
|
|
||||||
config_pathes=$(get_config_folders)
|
config_pathes=$(get_config_folders)
|
||||||
readarray -t -d" " instance_names < <(get_multi_instance_names)
|
|
||||||
|
|
||||||
if [[ -n "${config_pathes}" ]]; then
|
if [[ -n "${config_pathes}" ]]; then
|
||||||
current_date=$(get_date)
|
current_date=$(get_date)
|
||||||
status_msg "Timestamp: ${current_date}"
|
status_msg "Timestamp: ${current_date}"
|
||||||
|
|
||||||
local i=0 folder
|
local i=0 folder folder_name target_dir
|
||||||
for folder in ${config_pathes}; do
|
for folder in ${config_pathes}; do
|
||||||
local folder_name="${instance_names[${i}]}"
|
|
||||||
status_msg "Create backup of ${folder} ..."
|
status_msg "Create backup of ${folder} ..."
|
||||||
mkdir -p "${BACKUP_DIR}/configs/${current_date}/${folder_name}"
|
|
||||||
cp -r "${folder}" "${_}"
|
folder_name=$(echo "${folder}" | rev | cut -d"/" -f2 | rev)
|
||||||
ok_msg "Backup created in:\n${BACKUP_DIR}/configs/${current_date}/${folder_name}"
|
target_dir="${BACKUP_DIR}/configs/${current_date}/${folder_name}"
|
||||||
|
mkdir -p "${target_dir}"
|
||||||
|
cp -r "${folder}" "${target_dir}"
|
||||||
i=$(( i + 1 ))
|
i=$(( i + 1 ))
|
||||||
|
|
||||||
|
ok_msg "Backup created in:\n${target_dir}"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
ok_msg "No config directory found! Skipping backup ..."
|
ok_msg "No config directory found! Skipping backup ..."
|
||||||
|
|||||||
Reference in New Issue
Block a user