#!/bin/bash
export PACKAGE_NAME="$DPKG_MAINTSCRIPT_PACKAGE"

if [ "${PACKAGE_NAME}" = "cn.flamescion.bookworm-compatibility-mode" ];then
if [ -d /opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bookworm-env ];then

mv /opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bookworm-env /opt/apps/cn.flamescion.bookworm-compatibility-mode/files/ace-env
ln -sfv /opt/apps/cn.flamescion.bookworm-compatibility-mode/files/ace-env /opt/apps/cn.flamescion.bookworm-compatibility-mode/files/bookworm-env


fi
fi

/opt/apps/$PACKAGE_NAME/files/bin/ace-init

if [ "${PACKAGE_NAME}" = "cn.flamescion.bookworm-compatibility-mode" ];then
systemctl daemon-reload
systemctl enable ace-bookworm-auto-upgrade
systemctl start ace-bookworm-auto-upgrade
fi

systemctl reload apparmor

true
