diff --git a/sympa/doc/migration.md b/sympa/doc/migration.md index df55ddc..b088772 100644 --- a/sympa/doc/migration.md +++ b/sympa/doc/migration.md @@ -45,4 +45,10 @@ Future: debian13, sympa 6.2.76 1. database restore 2. tar * /etc/sympa/sympa/sympa.conf -3. sympa.pl --upgrade \ No newline at end of file +3. sympa.pl --upgrade + +## from miaou-recipe (example sympa3.incus) + +* CONTAINER=sympa3 +* miaou-create "$CONTAINER" +* miaou/miaou-install-sympa "$CONTAINER" diff --git a/sympa/miaou/miaou-install-from-import-sympa b/sympa/miaou/miaou-install-from-import-sympa new file mode 100755 index 0000000..4470063 --- /dev/null +++ b/sympa/miaou/miaou-install-from-import-sympa @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +# CONSTANTS + +BASEDIR=$(dirname "$0") +CONTAINER='' +IMPORT_FILE='' + +# 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 + elif [[ -z $IMPORT_FILE ]]; then + IMPORT_FILE=$1 + else + echo >&2 "Unknown option: $1" && usage && exit 2 + fi + ;; + esac + + shift 1 # Move to the next argument + done + [[ -n $CONTAINER ]] || [[ -n $IMPORT_FILE ]] (usage && exit 1) +} + + +function assert_fake_sympa { + [[ $(fqdn) == 'topcode' ]] && [[ -d /opt/miaou-incus ]] +} + +function install_fake_additional { + assert_fake_sympa || return + + echo 'install fake additional...' + miaou-push $CONTAINER $HOME/.ssh/id_ed25519 /root/.ssh/ + miaou-push $CONTAINER $HOME/.ssh/id_ed25519.pub /root/.ssh/ + miaou-recipe "$CONTAINER" "$BASEDIR"/../recipe/sympa_ldap_auth_remote.recipe + echo 'install fake additional...OK' +} + +# MAIN + +set -Eue +parse_options $* + +"$BASEDIR"/miaou-install-sympa "$CONTAINER" +# TODO: import from file... + +install_fake_additional \ No newline at end of file diff --git a/sympa/miaou/miaou-install-sympa b/sympa/miaou/miaou-install-sympa index 4b4bad5..cb309a1 100755 --- a/sympa/miaou/miaou-install-sympa +++ b/sympa/miaou/miaou-install-sympa @@ -37,10 +37,6 @@ function assert_miaou_server { (>&2 echo 'ERROR: either miaou-{incus,proxmox} must be installed on this host prior running this command!' && exit 10) } -function assert_fake_sympa { - [[ $(fqdn) == 'topcode' ]] && [[ -d /opt/miaou-incus ]] -} - function install_sympa_tools { for file in "$BASEDIR"/../resources/tools/*; do miaou-push $CONTAINER $file /opt/miaou-sympa/tools/ @@ -48,15 +44,6 @@ function install_sympa_tools { miaou-exec $CONTAINER -- ln -sf /usr/lib/sympa/bin/sympa.pl /opt/miaou-sympa/tools/ } -function install_fake_additional { - assert_fake_sympa || return - - echo 'install fake additional TODO: not yet functional...' - # miaou-push $CONTAINER $HOME/.ssh/id_ed25519 /root/.ssh/ - # miaou-push $CONTAINER $HOME/.ssh/id_ed25519.pub /root/.ssh/ - # miaou-recipe "$CONTAINER" "$BASEDIR"/../recipe/sympa_ldap_auth_remote.recipe -} - # MAIN set -Eue @@ -66,4 +53,3 @@ assert_miaou_server miaou-recipe "$CONTAINER" "$BASEDIR"/../recipe/sympa.recipe miaou-recipe "$CONTAINER" "$BASEDIR"/../recipe/sympa_custom_style.recipe install_sympa_tools -install_fake_additional