#!/bin/sh
[ -n "${IPKG_INSTROOT}" ] && exit 0
if [ "${PKG_UPGRADE}" = 1 ]; then mkdir -p /var/run/forestvpn && : > /var/run/forestvpn/restarting; else
	/etc/init.d/forestvpn uninstall pkg
	/usr/libexec/forestvpn/luci-legacy unlink
	# an `if`, not `[ ] &&`: with no feed directory (a build with no --feed-dir) the test's 1 would be prerm's status and fail the removal
	if [ -s /usr/share/forestvpn/feed/base ]; then /usr/libexec/forestvpn/feed-place --remove; fi
fi
