1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-04 15:54:48 +01:00

Add a "vanilla" test setup along with a QA certificate authority cert

This commit is contained in:
downtownallday
2020-06-27 17:59:51 -04:00
parent 39956afdc0
commit 62157fb554
5 changed files with 160 additions and 16 deletions

View File

@@ -142,19 +142,14 @@ install_nextcloud_docker() {
do_upgrade() {
local populate_name="$1"
if [ -e "$LOCAL_MODS_DIR/remote-nextcloud.sh" ]; then
# we install w/o remote nextcloud first so we can add
# a user w/contacts and ensure the contact exists in the
# new system
if [ ! -L "$LOCAL_MODS_DIR/remote-nextcloud.sh" ]; then
echo "Warning: $LOCAL_MODS_DIR/remote-nextcloud.sh is a regular file - should be a symlink"
fi
die "Error: $LOCAL_MODS_DIR/remote-nextcloud.sh exists - delete it and try again"
fi
# initialize test system
init
# we install w/o remote nextcloud first so we can add
# a user w/contacts and ensure the contact exists in the
# new system
disable_miab_mod "remote-nextcloud"
# install w/o remote Nextcloud
miab_ldap_install

View File

@@ -123,16 +123,31 @@ init_miab_testing() {
# copy in pre-built MiaB-LDAP ssl files
# 1. avoid the lengthy generation of DH params
mkdir -p $STORAGE_ROOT/ssl \
|| (echo "Unable to create $STORAGE_ROOT/ssl ($?)" && rc=1)
cp tests/assets/ssl/dh2048.pem $STORAGE_ROOT/ssl \
|| (echo "Copy dhparams failed ($?)" && rc=1)
if ! mkdir -p $STORAGE_ROOT/ssl; then
echo "Unable to create $STORAGE_ROOT/ssl ($?)"
rc=1
fi
echo "Copy dhparams"
if ! cp tests/assets/ssl/dh2048.pem $STORAGE_ROOT/ssl; then
echo "Copy failed ($?)"
rc=1
fi
if array_contains "--qa-ca" "$@"; then
echo "Copy certificate authority"
if ! cp tests/assets/ssl/ca_*.pem $STORAGE_ROOT/ssl; then
echo "Copy failed ($?)"
rc=1
fi
fi
# create miab_ldap.conf to specify what the Nextcloud LDAP service
# account password will be to avoid a random one created by start.sh
if [ ! -z "$LDAP_NEXTCLOUD_PASSWORD" ]; then
mkdir -p $STORAGE_ROOT/ldap \
|| (echo "Could not create $STORAGE_ROOT/ldap" && rc=1)
if ! mkdir -p $STORAGE_ROOT/ldap; then
echo "Could not create $STORAGE_ROOT/ldap"
rc=1
fi
[ -e $STORAGE_ROOT/ldap/miab_ldap.conf ] && \
echo "Warning: exists: $STORAGE_ROOT/ldap/miab_ldap.conf" 1>&2
touch $STORAGE_ROOT/ldap/miab_ldap.conf || rc=1
@@ -161,6 +176,12 @@ enable_miab_mod() {
fi
}
disable_miab_mod() {
local name="${1}.sh"
rm -f "$LOCAL_MODS_DIR/$name"
}
tag_from_readme() {
# extract the recommended TAG from README.md
# sets a global "TAG"

44
tests/system-setup/vanilla.sh Executable file
View File

@@ -0,0 +1,44 @@
#!/bin/bash
#
# setup a "plain vanilla" system from scratch
#
# ensure working directory
if [ ! -d "tests/system-setup" ]; then
echo "This script must be run from the MiaB root directory"
exit 1
fi
# load helper scripts
. "tests/lib/all.sh" "tests/lib" || die "Could not load lib scripts"
. "tests/system-setup/setup-defaults.sh" || die "Could not load setup-defaults"
. "tests/system-setup/setup-funcs.sh" || die "Could not load setup-funcs"
# ensure running as root
if [ "$EUID" != "0" ]; then
die "This script must be run as root (sudo)"
fi
init() {
H1 "INIT"
init_test_system
init_miab_testing "$@" || die "Initialization failed"
}
# initialize test system
init "$@"
if array_contains remote-nextcloud "$@"; then
H1 "Enable remote-nextcloud mod"
enable_miab_mod "remote-nextcloud" \
|| die "Could not enable remote-nextcloud mod"
else
disable_miab_mod "remote-nextcloud"
fi
# run setup to use the remote Nextcloud (doesn't need to be available)
miab_ldap_install