#!/bin/sh
#
# Univention Appliance Docker Container
#  postinst script for the debian package
#
# SPDX-FileCopyrightText: 2015-2026 Univention GmbH
# SPDX-License-Identifier: AGPL-3.0-only

#DEBHELPER#

# existed in ucs < 4.4-2: docker/daemon/default/opts/storage-driver?"overlay"
univention-config-registry set \
	docker/autostart?"yes" \
	docker/daemon/default/opts/bip?"172.17.42.1/16" \
	docker/daemon/default/parameter/live-restore?"yes" \
	docker/daemon/default/opts/log-driver?'journald' \

eval "$(univention-config-registry shell)"

# upgrade to 5.2
if [ "$1" = "configure" ] && [ -n "$2" ] && dpkg --compare-versions "$2" lt 7.0.4; then
	ucr set docker/daemon/default/opts/log-driver='journald'
fi


. /usr/share/univention-lib/all.sh

if [ "$1" = "configure" ]; then
	if [ -z "$2" ]; then
		# New installation
		systemctl enable docker.service
		systemctl daemon-reload
		systemctl restart docker.service
	fi
fi


exit 0
