mailautoconf/entrypoint.sh
2021-08-16 21:10:01 +01:00

31 lines
823 B
Bash

#!/usr/bin/env bash
echo Removing old sample files…
rm /mailautoconf/config/*.sample.yaml
function write_file() {
while read line;
do
first_char=${line:0:1}
first_vers=$(line:0:7)
if [[ $first_vers == "Version" ]]; then
line="# This is the sample config file for MailAutoConf "$line
elif [[ $first_char != "#" ]]; then
line="#"$line
fi
echo $line >> $2
done < $1
}
echo Setting up new sample config files…
def_conf="/mailautoconf/default-config/config.default.yaml"
new_conf="/mailautoconf/config/config.sample.yaml"
write_file $def_conf $new_conf
def_serv="/mailautoconf/default-config/services.default.yaml"
new_serv="/mailautoconf/config/services.sample.yaml"
write_file $def_serv $new_serv
echo New sample files copied
cd /mailautoconf
exec /mailautoconf/mailautoconf