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.
55 lines
1.1 KiB
55 lines
1.1 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
|
|
[[ -n $CONTAINER ]] || (usage && exit 1)
|
|
}
|
|
|
|
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)
|
|
}
|
|
|
|
function install_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/
|
|
}
|
|
|
|
# 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
|