post_install() {
    cscli capi register --error
    cscli machines add --auto --force --error
    cscli hub update
    cscli hub upgrade

    echo "Creating acquisition configuration"
    cscli setup unattended
}

pre_upgrade() {
    if [ "$(vercmp "$2" 1.6.0)" -lt 0 ]; then
        echo "Due to significant changes in the package structure, it is strongly advised not"
        echo "to upgrade from any version older than 1.6.0 to a newer version, as this may lead"
        echo "to potential issues. To safely upgrade to the new version, it is recommended to"
        echo "uninstall the old package and perform a clean installation of the new one."
        echo "Additionally, it is recommended to inspect the /usr/local directory and"
        echo "remove all related files to Crowdsec to ensure a clean installation."
    fi
}
