You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.3 KiB
63 lines
1.3 KiB
#!/usr/bin/env bash
|
|
|
|
# CONSTANTS
|
|
|
|
BASEDIR=$(dirname "$0")
|
|
CONTAINER=''
|
|
|
|
# FUNCTIONS
|
|
|
|
function usage {
|
|
echo "$(basename "$0") <CONTAINER_NAME>"
|
|
}
|
|
|
|
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"
|