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

if [ "${PACKAGE_NAME}" = "cn.flamescion.bookworm-compatibility-mode" ];then
PACKAGE_NAME=amber-ce-bookworm # 为了后面正确清理
if [ -d /opt/apps/cn.flamescion.bookworm-compatibility-mode/ ];then

unlink /opt/apps/amber-ce-bookworm 
mv -v /opt/apps/cn.flamescion.bookworm-compatibility-mode/ /opt/apps/amber-ce-bookworm/


fi
fi





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



systemctl daemon-reload
systemctl enable $PACKAGE_NAME-auto-upgrade
systemctl start $PACKAGE_NAME-auto-upgrade
        # enable kernel.unprivileged_userns_clone
        # disable kernel.apparmor_restrict_unprivileged_unconfined and kernel.apparmor_restrict_unprivileged_userns
        if [ -f /usr/lib/sysctl.d/$PACKAGE_NAME.conf ];then
                sysctl -p /usr/lib/sysctl.d/$PACKAGE_NAME.conf
        fi



true