[fix] Only backup /nsm/mysql and /nsm/wazuh

This commit is contained in:
William Wernert
2020-11-18 15:34:40 -05:00
parent 3d0003555a
commit 1c55bb6db2

View File

@@ -1398,14 +1398,11 @@ reinstall_init() {
date_string=$(date +%s) date_string=$(date +%s)
# Backup /opt/so since we'll be rebuilding this directory during setup # Backup /opt/so since we'll be rebuilding this directory during setup
if [[ -d /opt/so ]]; then backup_dir /opt/so "$date_string"
mv /opt/so "/opt/so_old_${date_string}"
fi
# Backup /nsm for the same reason # Backup directories in /nsm to prevent app errors
while IFS= read -r -d '' dir; do backup_dir /nsm/mysql "$date_string"
mv "$dir" "${dir}_old_${date_string}" backup_dir /nsm/wazuh "$date_string"
done < <(find /nsm -maxdepth 1 -mindepth 1 -type d -not -path "/nsm/docker-registry" -print0)
# Remove the old launcher package in case the config changes # Remove the old launcher package in case the config changes
remove_package launcher-final remove_package launcher-final
@@ -1413,6 +1410,15 @@ reinstall_init() {
} >> $setup_log 2>&1 } >> $setup_log 2>&1
} }
backup_dir() {
dir=$1
backup_suffix=$2
if [[ -d $dir ]]; then
mv "$dir" "${dir}_old_${backup_suffix}"
fi
}
remove_package() { remove_package() {
local package_name=$1 local package_name=$1
if [ $OS = 'centos' ]; then if [ $OS = 'centos' ]; then