#!/bin/bash
#
# Univention Setup
#  regenerate system UUID
#
# SPDX-FileCopyrightText: 2016-2025 Univention GmbH
# SPDX-License-Identifier: AGPL-3.0-only

force_recreate=0

while [ "$#" -gt 0 ]; do
	case "$1" in
		--force-recreate)
			force_recreate=1
			shift 1
			;;
		*)
			echo "WARNING: Unknown parameter $1"
			shift 1
			;;
	esac
done

# shellcheck source=../setup_utils.sh
. /usr/lib/univention-system-setup/scripts/setup_utils.sh

if [ "$force_recreate" = "1" ]; then
	info_header "$0" "$(gettext "Generating UUID")"
	ucr set uuid/system="$(cat /proc/sys/kernel/random/uuid)"
fi

exit 0
