Support mailcow.conf being a symlink (#3770)

* Support mailcow.conf being a symlink

* Detect BusyBox sed in update.sh
This commit is contained in:
Maxim Baz 2020-09-20 22:07:37 +02:00 committed by GitHub
parent 8c9970230a
commit 05a5f9e84a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -251,10 +251,10 @@ function restore() {
fi fi
echo "Modifying mailcow.conf..." echo "Modifying mailcow.conf..."
source ${RESTORE_LOCATION}/mailcow.conf source ${RESTORE_LOCATION}/mailcow.conf
sed -i "/DBNAME/c\DBNAME=${DBNAME}" ${SCRIPT_DIR}/../mailcow.conf sed -i --follow-symlinks "/DBNAME/c\DBNAME=${DBNAME}" ${SCRIPT_DIR}/../mailcow.conf
sed -i "/DBUSER/c\DBUSER=${DBUSER}" ${SCRIPT_DIR}/../mailcow.conf sed -i --follow-symlinks "/DBUSER/c\DBUSER=${DBUSER}" ${SCRIPT_DIR}/../mailcow.conf
sed -i "/DBPASS/c\DBPASS=${DBPASS}" ${SCRIPT_DIR}/../mailcow.conf sed -i --follow-symlinks "/DBPASS/c\DBPASS=${DBPASS}" ${SCRIPT_DIR}/../mailcow.conf
sed -i "/DBROOT/c\DBROOT=${DBROOT}" ${SCRIPT_DIR}/../mailcow.conf sed -i --follow-symlinks "/DBROOT/c\DBROOT=${DBROOT}" ${SCRIPT_DIR}/../mailcow.conf
source ${SCRIPT_DIR}/../mailcow.conf source ${SCRIPT_DIR}/../mailcow.conf
echo "Starting mailcow..." echo "Starting mailcow..."
docker-compose up -d docker-compose up -d

View File

@ -181,6 +181,7 @@ fi
if grep --help 2>&1 | head -n 1 | grep -q -i "busybox"; then echo "BusybBox grep detected, please install gnu grep, \"apk add --no-cache --upgrade grep\""; exit 1; fi if grep --help 2>&1 | head -n 1 | grep -q -i "busybox"; then echo "BusybBox grep detected, please install gnu grep, \"apk add --no-cache --upgrade grep\""; exit 1; fi
if cp --help 2>&1 | head -n 1 | grep -q -i "busybox"; then echo "BusybBox cp detected, please install coreutils, \"apk add --no-cache --upgrade coreutils\""; exit 1; fi if cp --help 2>&1 | head -n 1 | grep -q -i "busybox"; then echo "BusybBox cp detected, please install coreutils, \"apk add --no-cache --upgrade coreutils\""; exit 1; fi
if sed --help 2>&1 | head -n 1 | grep -q -i "busybox"; then echo "BusybBox sed detected, please install gnu sed, \"apk add --no-cache --upgrade sed\""; exit 1; fi
CONFIG_ARRAY=( CONFIG_ARRAY=(
"SKIP_LETS_ENCRYPT" "SKIP_LETS_ENCRYPT"
@ -215,7 +216,7 @@ CONFIG_ARRAY=(
"REDIS_PORT" "REDIS_PORT"
) )
sed -i '$a\' mailcow.conf sed -i --follow-symlinks '$a\' mailcow.conf
for option in ${CONFIG_ARRAY[@]}; do for option in ${CONFIG_ARRAY[@]}; do
if [[ ${option} == "ADDITIONAL_SAN" ]]; then if [[ ${option} == "ADDITIONAL_SAN" ]]; then
if ! grep -q ${option} mailcow.conf; then if ! grep -q ${option} mailcow.conf; then
@ -525,7 +526,7 @@ if grep -q 'SYSCTL_IPV6_DISABLED=1' mailcow.conf; then
fi fi
# Checking for old project name bug # Checking for old project name bug
sed -i 's#COMPOSEPROJECT_NAME#COMPOSE_PROJECT_NAME#g' mailcow.conf sed -i --follow-symlinks 's#COMPOSEPROJECT_NAME#COMPOSE_PROJECT_NAME#g' mailcow.conf
# Fix Rspamd maps # Fix Rspamd maps
if [ -f data/conf/rspamd/custom/global_from_blacklist.map ]; then if [ -f data/conf/rspamd/custom/global_from_blacklist.map ]; then