Browse Source

small changes

main
pvincent 2 weeks ago
parent
commit
3a139f3a33
  1. 3
      sympa/miaou/miaou-install-from-import-sympa
  2. 23
      sympa/miaou/miaou-install-sympa
  3. 11
      sympa/miaou/miaou-migrate-sympa-from-container
  4. 6
      sympa/recipe/sympa_custom_style.recipe

3
sympa/miaou/miaou-install-from-import-sympa

@ -64,8 +64,9 @@ function import {
} }
function install { function install {
echo "install SYMPA to CONTAINER=$CONTAINER"
"$BASEDIR"/miaou-install-sympa "$CONTAINER" "$BASEDIR"/miaou-install-sympa "$CONTAINER"
echo "install SYMPA ...success"
} }
# MAIN # MAIN

23
sympa/miaou/miaou-install-sympa

@ -32,24 +32,33 @@ function parse_options {
} }
function assert_miaou_server { 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 for file in "$BASEDIR"/../resources/tools/*; do
miaou-push $CONTAINER $file /opt/miaou-sympa/tools/ miaou-push $CONTAINER $file /opt/miaou-sympa/tools/
done done
miaou-exec $CONTAINER -- ln -sf /usr/lib/sympa/bin/sympa.pl /opt/miaou-sympa/tools/ 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 # MAIN
set -Eue set -Eue
parse_options $* parse_options $*
assert_miaou_server 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

11
sympa/miaou/miaou-migrate-sympa-from-container

@ -63,12 +63,13 @@ EOF
function get_container_net0 { function get_container_net0 {
OLD_VMID=$(pct-lookup $CONTAINER) OLD_VMID=$(pct-lookup $CONTAINER)
SYMPA_NET0=$(pct config $OLD_VMID | grep ^net0 | cut -d ' ' -f2) SYMPA_NET0=$(pct config $OLD_VMID | grep ^net0 | cut -d ' ' -f2)
echo "SYMPA_NET0=$SYMPA_NET0"
} }
function rename_old_container { function rename_old_container {
pct-rename $CONTAINER $CONTAINER.9 pct-rename $CONTAINER $CONTAINER.9
pct set $OLD_VMID --delete net0 pct set $OLD_VMID --delete net0
pct reboot $OLD_VMID
} }
function create_new_container { 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/') 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 --net0 "$SYMPA_NET0"
pct set $vmid --net1 "$net1" pct set $vmid --net1 "$net1"
echo '------------------------------------'
echo "rebooting container $CONTAINER $vmid"
echo '------------------------------------'
pct reboot $vmid pct reboot $vmid
} }
@ -95,7 +100,3 @@ get_container_net0
rename_old_container rename_old_container
create_new_container create_new_container
import_from_archive import_from_archive
# 8. fix external origin
# allowed_external_origin *
# (https://gitlab.cemea.org/cemeaweb/khazad-dum/-/issues/110)

6
sympa/recipe/sympa_custom_style.recipe

@ -9,14 +9,14 @@ SYMPA_CSS=/usr/share/sympa/default/web_tt2/css.tt2
function override_topbar { function override_topbar {
if ! grep -q '.top-bar button:hover' "$SYMPA_CSS"; then if ! grep -q '.top-bar button:hover' "$SYMPA_CSS"; then
sed -i "1661i\\.top-bar button:hover{\\n color: white;\\n}" "$SYMPA_CSS"
sed -i '1661i\.top-bar button:hover{\n color: white;\n}' "$SYMPA_CSS"
echo 'topbar changed successfully' echo 'topbar changed successfully'
fi fi
} }
function apply_theme { function apply_theme {
local fqdn=$(hostname -f) local fqdn=$(hostname -f)
[[ $fqdn == *cemea* ]] && apply_cemea_style || apply_zourit_style
[[ $fqdn =~ cemea ]] && apply_cemea_style || apply_zourit_style
} }
function apply_cemea_style { function apply_cemea_style {
@ -37,7 +37,7 @@ function apply_zourit_style {
function clear_custom_styles { function clear_custom_styles {
for i in /var/lib/sympa/css/*; do for i in /var/lib/sympa/css/*; do
if [[ "$i" != '/var/lib/sympa/css/style.css' ]] && [[ -d "$i" ]]; then
if [[ $i != '/var/lib/sympa/css/style.css' ]] && [[ -d $i ]]; then
rm -rf "$i" rm -rf "$i"
echo "customized style: $i removed!" echo "customized style: $i removed!"
fi fi

Loading…
Cancel
Save