mailautoconf/entrypoint.sh

32 lines
823 B
Bash
Raw Normal View History

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