post_install() { source /usr/share/crowdsec/wizard.sh -n SILENT=true detect_services SILENT=true TMP_ACQUIS_FILE_SKIP=skip genacquisition cscli capi register --error cscli machines add --auto --force --error cscli hub update CSCLI_BIN_INSTALLED="/usr/bin/cscli" SILENT=true install_collection } pre_upgrade() { MAJOR=$(echo "$2" | awk -F '.' '{print $1}') MINOR=$(echo "$2" | awk -F '.' '{print $2}') if [ "${MAJOR}" == 1 ] && [ "${MINOR}" -lt 6 ]; 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 cscli config backup /var/lib/crowdsec/backup } post_upgrade() { if [ -d /var/lib/crowdsec/backup ]; then cscli config restore /var/lib/crowdsec/backup && rm -rf /var/lib/crowdsec/backup fi cscli hub update cscli hub upgrade } pre_remove() { cscli dashboard remove --force --yes --error || true }