[Update] added --force mode to update skript (#3453)
parent
40b203218f
commit
1b229412e3
18
update.sh
18
update.sh
|
@ -88,18 +88,21 @@ docker_garbage() {
|
|||
echo
|
||||
echo " docker rmi ${IMGS_TO_DELETE[*]}"
|
||||
echo
|
||||
if [ ! $FORCE ]; then
|
||||
read -r -p "Do you want to delete old image tags right now? [y/N] " response
|
||||
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]; then
|
||||
docker rmi ${IMGS_TO_DELETE[*]}
|
||||
else
|
||||
echo "OK, skipped."
|
||||
fi
|
||||
else
|
||||
echo "Skipped image removal because of force mode."
|
||||
fi
|
||||
fi
|
||||
echo -e "\e[32mFurther cleanup...\e[0m"
|
||||
echo "If you want to cleanup further garbage collected by Docker, please make sure all containers are up and running before cleaning your system by executing \"docker system prune\""
|
||||
}
|
||||
|
||||
|
||||
while (($#)); do
|
||||
case "${1}" in
|
||||
--check|-c)
|
||||
|
@ -133,6 +136,10 @@ while (($#)); do
|
|||
prefetch_images
|
||||
exit 0
|
||||
;;
|
||||
-f|--force)
|
||||
echo -e "\e[32mForcing Update...\e[0m"
|
||||
FORCE=y
|
||||
;;
|
||||
--help|-h)
|
||||
echo './update.sh [-c|--check, --ours, --gc, --skip-start, -h|--help]
|
||||
|
||||
|
@ -140,6 +147,7 @@ while (($#)); do
|
|||
--ours - Use merge strategy "ours" to solve conflicts in favor of non-mailcow code (local changes)
|
||||
--gc - Run garbage collector to delete old image tags
|
||||
--skip-start - Do not start mailcow after update
|
||||
-f|--force - Force update, do not ask questions
|
||||
'
|
||||
exit 1
|
||||
esac
|
||||
|
@ -356,7 +364,7 @@ SHA1_2=$(sha1sum update.sh)
|
|||
if [[ ${SHA1_1} != ${SHA1_2} ]]; then
|
||||
echo "update.sh changed, please run this script again, exiting."
|
||||
chmod +x update.sh
|
||||
exit 0
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [[ -f mailcow.conf ]]; then
|
||||
|
@ -366,10 +374,12 @@ else
|
|||
exit 1
|
||||
fi
|
||||
|
||||
read -r -p "Are you sure you want to update mailcow: dockerized? All containers will be stopped. [y/N] " response
|
||||
if [[ ! "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]; then
|
||||
if [ ! $FORCE ]; then
|
||||
read -r -p "Are you sure you want to update mailcow: dockerized? All containers will be stopped. [y/N] " response
|
||||
if [[ ! "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]; then
|
||||
echo "OK, exiting."
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -e "\e[32mValidating docker-compose stack configuration...\e[0m"
|
||||
|
|
Loading…
Reference in New Issue