From 3a139f3a33d8930ba9d48c6c3e252ebe0a8890cc Mon Sep 17 00:00:00 2001 From: pvincent Date: Fri, 27 Mar 2026 15:12:31 +0400 Subject: [PATCH] small changes --- sympa/miaou/miaou-install-from-import-sympa | 3 +- sympa/miaou/miaou-install-sympa | 43 ++++++++++------- .../miaou/miaou-migrate-sympa-from-container | 11 +++-- sympa/recipe/sympa_custom_style.recipe | 46 +++++++++---------- 4 files changed, 57 insertions(+), 46 deletions(-) diff --git a/sympa/miaou/miaou-install-from-import-sympa b/sympa/miaou/miaou-install-from-import-sympa index dc7da88..97c36f4 100755 --- a/sympa/miaou/miaou-install-from-import-sympa +++ b/sympa/miaou/miaou-install-from-import-sympa @@ -64,8 +64,9 @@ function import { } function install { + echo "install SYMPA to CONTAINER=$CONTAINER" "$BASEDIR"/miaou-install-sympa "$CONTAINER" - + echo "install SYMPA ...success" } # MAIN diff --git a/sympa/miaou/miaou-install-sympa b/sympa/miaou/miaou-install-sympa index 5c897af..e12dbf2 100755 --- a/sympa/miaou/miaou-install-sympa +++ b/sympa/miaou/miaou-install-sympa @@ -14,16 +14,16 @@ function usage { 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 - ;; + --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 @@ -32,24 +32,33 @@ function parse_options { } function assert_miaou_server { - [[ -d /opt/miaou-incus ]] || - [[ -d /opt/miaou-proxmox ]] || - (>&2 echo 'ERROR: either miaou-{incus,proxmox} must be installed on this host prior running this command!' && exit 10) + [[ -d /opt/miaou-incus ]] \ + || [[ -d /opt/miaou-proxmox ]] \ + || (>&2 echo 'ERROR: either miaou-{incus,proxmox} must be installed on this host prior running this command!' && exit 10) } -function install_sympa_tools { +function add_sympa_tools { for file in "$BASEDIR"/../resources/tools/*; do miaou-push $CONTAINER $file /opt/miaou-sympa/tools/ done miaou-exec $CONTAINER -- ln -sf /usr/lib/sympa/bin/sympa.pl /opt/miaou-sympa/tools/ } +function customize_style { + miaou-recipe "$CONTAINER" "$BASEDIR"/../recipe/sympa_custom_style.recipe +} + +function install_sympa { + miaou-recipe "$CONTAINER" "$BASEDIR"/../recipe/sympa.recipe + +} + # MAIN set -Eue parse_options $* assert_miaou_server -miaou-recipe "$CONTAINER" "$BASEDIR"/../recipe/sympa.recipe -miaou-recipe "$CONTAINER" "$BASEDIR"/../recipe/sympa_custom_style.recipe -install_sympa_tools +install_sympa +customize_style +add_sympa_tools diff --git a/sympa/miaou/miaou-migrate-sympa-from-container b/sympa/miaou/miaou-migrate-sympa-from-container index 2e8fc68..c08ef1c 100755 --- a/sympa/miaou/miaou-migrate-sympa-from-container +++ b/sympa/miaou/miaou-migrate-sympa-from-container @@ -63,12 +63,13 @@ EOF function get_container_net0 { OLD_VMID=$(pct-lookup $CONTAINER) SYMPA_NET0=$(pct config $OLD_VMID | grep ^net0 | cut -d ' ' -f2) + + echo "SYMPA_NET0=$SYMPA_NET0" } function rename_old_container { pct-rename $CONTAINER $CONTAINER.9 pct set $OLD_VMID --delete net0 - pct reboot $OLD_VMID } function create_new_container { @@ -77,6 +78,10 @@ function create_new_container { local net1=$(pct config $vmid | grep ^net0 | cut -d ' ' -f2 | sed 's/name=eth0/name=eth1/') pct set $vmid --net0 "$SYMPA_NET0" pct set $vmid --net1 "$net1" + + echo '------------------------------------' + echo "rebooting container $CONTAINER $vmid" + echo '------------------------------------' pct reboot $vmid } @@ -95,7 +100,3 @@ get_container_net0 rename_old_container create_new_container import_from_archive - -# 8. fix external origin -# allowed_external_origin * -# (https://gitlab.cemea.org/cemeaweb/khazad-dum/-/issues/110) diff --git a/sympa/recipe/sympa_custom_style.recipe b/sympa/recipe/sympa_custom_style.recipe index 3092af2..a6ea030 100644 --- a/sympa/recipe/sympa_custom_style.recipe +++ b/sympa/recipe/sympa_custom_style.recipe @@ -8,44 +8,44 @@ SYMPA_CSS=/usr/share/sympa/default/web_tt2/css.tt2 # FUNCTIONS function override_topbar { - if ! grep -q '.top-bar button:hover' "$SYMPA_CSS"; then - sed -i "1661i\\.top-bar button:hover{\\n color: white;\\n}" "$SYMPA_CSS" - echo 'topbar changed successfully' - fi + if ! grep -q '.top-bar button:hover' "$SYMPA_CSS"; then + sed -i '1661i\.top-bar button:hover{\n color: white;\n}' "$SYMPA_CSS" + echo 'topbar changed successfully' + fi } function apply_theme { - local fqdn=$(hostname -f) - [[ $fqdn == *cemea* ]] && apply_cemea_style || apply_zourit_style + local fqdn=$(hostname -f) + [[ $fqdn =~ cemea ]] && apply_cemea_style || apply_zourit_style } function apply_cemea_style { - sed -i "s/.*005ab2.*/\t\tdefault => '#000000', # '#005ab2' replaced by CEMEA-COLOR-1/" "$SYMPA_GENERATOR" - sed -i "s/.*004b94.*/\t\tdefault => '#e30613', # '#004b94' replaced by CEMEA-COLOR-2/" "$SYMPA_GENERATOR" - sed -i "s/.*0090e9.*/\t\tdefault => '#184857', # '#0090e9' replaced by CEMEA-COLOR-3/" "$SYMPA_GENERATOR" - sed -i "s/.*66aaff.*/\t\tdefault => '#00a19a', # '#66aaff' replaced by CEMEA-COLOR-4/" "$SYMPA_GENERATOR" - echo "CEMEA style applied successfully!" + sed -i "s/.*005ab2.*/\t\tdefault => '#000000', # '#005ab2' replaced by CEMEA-COLOR-1/" "$SYMPA_GENERATOR" + sed -i "s/.*004b94.*/\t\tdefault => '#e30613', # '#004b94' replaced by CEMEA-COLOR-2/" "$SYMPA_GENERATOR" + sed -i "s/.*0090e9.*/\t\tdefault => '#184857', # '#0090e9' replaced by CEMEA-COLOR-3/" "$SYMPA_GENERATOR" + sed -i "s/.*66aaff.*/\t\tdefault => '#00a19a', # '#66aaff' replaced by CEMEA-COLOR-4/" "$SYMPA_GENERATOR" + echo "CEMEA style applied successfully!" } function apply_zourit_style { - sed -i "s/.*005ab2.*/\t\tdefault => '#ad0c78', # '#005ab2' replaced by ZOURIT-COLOR-1/" "$SYMPA_GENERATOR" - sed -i "s/.*004b94.*/\t\tdefault => '#1f2937', # '#004b94' replaced by ZOURIT-COLOR-2/" "$SYMPA_GENERATOR" - sed -i "s/.*0090e9.*/\t\tdefault => '#535786', # '#0090e9' replaced by ZOURIT-COLOR-3/" "$SYMPA_GENERATOR" - sed -i "s/.*66aaff.*/\t\tdefault => '#949ba7', # '#66aaff' replaced by ZOURIT-COLOR-4/" "$SYMPA_GENERATOR" - echo "ZOURIT style applied successfully!" + sed -i "s/.*005ab2.*/\t\tdefault => '#ad0c78', # '#005ab2' replaced by ZOURIT-COLOR-1/" "$SYMPA_GENERATOR" + sed -i "s/.*004b94.*/\t\tdefault => '#1f2937', # '#004b94' replaced by ZOURIT-COLOR-2/" "$SYMPA_GENERATOR" + sed -i "s/.*0090e9.*/\t\tdefault => '#535786', # '#0090e9' replaced by ZOURIT-COLOR-3/" "$SYMPA_GENERATOR" + sed -i "s/.*66aaff.*/\t\tdefault => '#949ba7', # '#66aaff' replaced by ZOURIT-COLOR-4/" "$SYMPA_GENERATOR" + echo "ZOURIT style applied successfully!" } function clear_custom_styles { - for i in /var/lib/sympa/css/*; do - if [[ "$i" != '/var/lib/sympa/css/style.css' ]] && [[ -d "$i" ]]; then - rm -rf "$i" - echo "customized style: $i removed!" - fi - done + for i in /var/lib/sympa/css/*; do + if [[ $i != '/var/lib/sympa/css/style.css' ]] && [[ -d $i ]]; then + rm -rf "$i" + echo "customized style: $i removed!" + fi + done } function refresh_style { - systemctl restart wwsympa.socket + systemctl restart wwsympa.socket } # MAIN