mirror of
https://github.com/BastilleBSD/bastille.git
synced 2025-12-11 17:39:52 +01:00
migrate: Add cleanup to more commands to ensure /tmp removal
This commit is contained in:
@@ -170,8 +170,8 @@ migrate_cleanup() {
|
||||
fi
|
||||
|
||||
# Remove archive files from local and remote system
|
||||
${_sshpass_cmd} ssh -p ${_port} ${_opt_ssh_key} ${_user}@${_host} ${OPT_SU} rm -fr "${_remote_bastille_migratedir}"
|
||||
rm -fr ${_local_bastille_migratedir}
|
||||
${_sshpass_cmd} ssh -p ${_port} ${_opt_ssh_key} ${_user}@${_host} ${OPT_SU} rm -fr "${_remote_bastille_migratedir}" 2>/dev/null
|
||||
rm -fr ${_local_bastille_migratedir} 2>/dev/null
|
||||
}
|
||||
|
||||
migrate_create_export() {
|
||||
@@ -209,12 +209,14 @@ migrate_jail() {
|
||||
_remote_jail_list="$(${_sshpass_cmd} ssh -p ${_port} ${_opt_ssh_key} ${_user}@${_host} ${OPT_SU} bastille list jails)"
|
||||
|
||||
if [ -z "${_local_bastille_migratedir}" ] || [ -z "${_remote_bastille_migratedir}" ]; then
|
||||
migrate_cleanup "${_jail}" "${_user}" "${_host}" "${_port}"
|
||||
error_notify "[ERROR]: Could not create /tmp/bastille-migrate."
|
||||
error_continue "Ensure it doesn't exist locally or remotely."
|
||||
fi
|
||||
|
||||
# Verify jail does not exist remotely
|
||||
if echo "${_remote_jail_list}" | grep -Eoqw "${_jail}"; then
|
||||
migrate_cleanup "${_jail}" "${_user}" "${_host}" "${_port}"
|
||||
error_exit "[ERROR]: Jail already exists on remote system: ${_jail}"
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user