[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
if ! grep -q ${option} mailcow.conf; then
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
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
echo "Adding new option \"${option}\" to mailcow.conf"
echo "${option}=n" >> mailcow.conf
@ -45,7 +58,7 @@ curl -o /dev/null google.com -sm3
if [[ $? != 0 ]]; then
echo -e "\e[31mfailed\e[0m"
exit 1
else
else
echo -e "\e[32mOK\e[0m"
fi
@ -56,7 +69,7 @@ BRANCH=$(git rev-parse --abbrev-ref HEAD)
declare -a DC_PARAMS
while (($#)); do
case "${1}" in
case "${1}" in
--check|-c)
echo "Checking remote code for updates..."
git fetch origin ${BRANCH}
@ -71,7 +84,7 @@ case "${1}" in
--no-start)
DC_PARAMS=(${DC_PARAMS[@]} "--no-start")
;;
esac
esac
done
echo -e "\e[32mChecking for newer update script...\e[0m"
@ -87,7 +100,7 @@ fi
if [[ -f mailcow.conf ]]; then
source mailcow.conf
else
else
echo -e "\e[31mNo mailcow.conf - is mailcow installed?\e[0m"
exit 1
fi
@ -138,7 +151,7 @@ if [[ $(curl -sL -w "%{http_code}" https://www.servercow.de/docker-compose/lates
LATEST_COMPOSE=$(curl -#L https://www.servercow.de/docker-compose/latest.php)
curl -#L https://github.com/docker/compose/releases/download/${LATEST_COMPOSE}/docker-compose-$(uname -s)-$(uname -m) > $(which docker-compose)
chmod +x $(which docker-compose)
else
else
echo -e "\e[33mCannot determine latest docker-compose version, skipping...\e[0m"
fi
@ -161,12 +174,10 @@ for container in $(grep -oP "image: \Kmailcow.+" docker-compose.yml); do
TAG=${container/*:}
V_MAIN=${container/*.}
V_SUB=${container/*.}
EXISTING_TAGS=$(docker images | grep ${REPOSITORY} | awk '{ print $2 }')
for existing_tag in ${EXISTING_TAGS[@]}; do
V_MAIN_EXISTING=${existing_tag/*.}
V_SUB_EXISTING=${existing_tag/*.}
# Not an integer
[[ ! $V_MAIN_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
done
done
if [[ ! -z ${IMGS_TO_DELETE[*]} ]]; then
echo "Run the following command to delete unused image tags:"
echo