[Update] Formatting; Added new options

master
andre.peters 2018-01-24 09:24:40 +01:00
parent a569fb3435
commit 1f1ab0960c
1 changed files with 117 additions and 105 deletions

View File

@ -32,8 +32,21 @@ for option in ${CONFIG_ARRAY[@]}; do
elif [[ ${option} == "LOG_LINES" ]]; then elif [[ ${option} == "LOG_LINES" ]]; then
if ! grep -q ${option} mailcow.conf; then if ! grep -q ${option} mailcow.conf; then
echo "Adding new option \"${option}\" to mailcow.conf" echo "Adding new option \"${option}\" to mailcow.conf"
echo '# Max log lines per service to keep in Redis logs' >> mailcow.conf
echo "LOG_LINES=9999" >> mailcow.conf echo "LOG_LINES=9999" >> mailcow.conf
fi fi
elif [[ ${option} == "IPV4_NETWORK" ]]; then
if ! grep -q ${option} mailcow.conf; then
echo "Adding new option \"${option}\" to mailcow.conf"
echo '# Internal IPv4 /24 subnet, format n.n.n. (expands to n.n.n.0/24)' >> mailcow.conf
echo "IPV4_NETWORK=172.22.1" >> mailcow.conf
fi
elif [[ ${option} == "IPV6_NETWORK" ]]; then
if ! grep -q ${option} mailcow.conf; then
echo "Adding new option \"${option}\" to mailcow.conf"
echo '# Internal IPv6 subnet in fd00::/8' >> mailcow.conf
echo "IPV6_NETWORK=fd4d:6169:6c63:6f77::/64" >> mailcow.conf
fi
elif ! grep -q ${option} mailcow.conf; then elif ! grep -q ${option} mailcow.conf; then
echo "Adding new option \"${option}\" to mailcow.conf" echo "Adding new option \"${option}\" to mailcow.conf"
echo "${option}=n" >> mailcow.conf echo "${option}=n" >> mailcow.conf
@ -161,12 +174,10 @@ for container in $(grep -oP "image: \Kmailcow.+" docker-compose.yml); do
TAG=${container/*:} TAG=${container/*:}
V_MAIN=${container/*.} V_MAIN=${container/*.}
V_SUB=${container/*.} V_SUB=${container/*.}
EXISTING_TAGS=$(docker images | grep ${REPOSITORY} | awk '{ print $2 }') EXISTING_TAGS=$(docker images | grep ${REPOSITORY} | awk '{ print $2 }')
for existing_tag in ${EXISTING_TAGS[@]}; do for existing_tag in ${EXISTING_TAGS[@]}; do
V_MAIN_EXISTING=${existing_tag/*.} V_MAIN_EXISTING=${existing_tag/*.}
V_SUB_EXISTING=${existing_tag/*.} V_SUB_EXISTING=${existing_tag/*.}
# Not an integer # Not an integer
[[ ! $V_MAIN_EXISTING =~ ^[0-9]+$ ]] && continue [[ ! $V_MAIN_EXISTING =~ ^[0-9]+$ ]] && continue
[[ ! $V_SUB_EXISTING =~ ^[0-9]+$ ]] && continue [[ ! $V_SUB_EXISTING =~ ^[0-9]+$ ]] && continue
@ -183,6 +194,7 @@ for container in $(grep -oP "image: \Kmailcow.+" docker-compose.yml); do
fi fi
done done
done done
if [[ ! -z ${IMGS_TO_DELETE[*]} ]]; then if [[ ! -z ${IMGS_TO_DELETE[*]} ]]; then
echo "Run the following command to delete unused image tags:" echo "Run the following command to delete unused image tags:"
echo echo