diff --git a/sympa/doc/migration.md b/sympa/doc/migration.md index d2e6193..2158190 100644 --- a/sympa/doc/migration.md +++ b/sympa/doc/migration.md @@ -55,9 +55,14 @@ To: debian13, sympa 6.2.76 * miaou-create "$CONTAINER" * miaou/miaou-install-sympa "$CONTAINER" -## miaou-install-from-import-sympa +## miaou-install-from-import-sympa (INCUS) * CONTAINER=sympa1 * LAST_ARCHIVE=$(find ~/Downloads -type f -name "listes.artcode.re*" | sort -rn | head -1) * miaou-create $CONTAINER * miaou/miaou-install-from-import-sympa $CONTAINER $LAST_ARCHIVE + +## miaou-migrate-sympa-from-container (PROXMOX) + +* CONTAINER=listes.artcode.re +* miaou/miaou-migrate-sympa-from-container $CONTAINER diff --git a/sympa/miaou/miaou-migrate-sympa-from-container b/sympa/miaou/miaou-migrate-sympa-from-container new file mode 100755 index 0000000..591382d --- /dev/null +++ b/sympa/miaou/miaou-migrate-sympa-from-container @@ -0,0 +1,64 @@ +#!/usr/bin/env bash + +# CONSTANTS + +BASEDIR=$(dirname "$0") +CONTAINER='' + +# FUNCTIONS + +function usage { + echo "$(basename "$0") " +} + +function parse_options { + while [[ $# -gt 0 ]]; do + case "$1" in + --help | -h) + usage && exit 0 + ;; + *) + if [[ -z $CONTAINER ]]; then + CONTAINER=$1 + else + echo >&2 "Unknown option: $1" && usage && exit 2 + fi + ;; + esac + + shift 1 # Move to the next argument + done + [[ -z $CONTAINER ]] && (usage && exit 1) || true +} + +function halt_on_error { + >&2 echo "ERROR: $1" + exit ${2:-1} +} + +function assert_proxmox { + grep -q ^ID=debian /etc/os-release || halt_on_error 'distro debian required!' 2 + command -v pct > /dev/null || halt_on_error 'command `pct` not found!' 3 +} + +# MAIN + +set -Eue +parse_options $* + +assert_proxmox +echo DONE +# 0. test host is Proxmox +# 1. test container is Debian9 + Sympa +# 2. export sympa +# 3. stop container +# 4. create container with same IP +# 5. install sympa +# 6. import old data +# 7. fix_dmarc_off + fix_dkim_global_on + fix external origin +# allowed_external_origin * +# (https://gitlab.cemea.org/cemeaweb/khazad-dum/-/issues/110) + +# "$BASEDIR"/miaou-install-sympa "$CONTAINER" +# echo "launch the import process" +# miaou-exec $CONTAINER -- /opt/miaou-sympa/tools/sympa_import.bash "/root/$import_base"