+# macro called at module post scriptlet
+%define module_post \
+if [ "$1" = "1" ]; then \
+ if grep -iEqs "^ServerType[[:space:]]+inetd" %{_sysconfdir}/proftpd.conf; then \
+ %service -q rc-inetd reload \
+ elif grep -iEqs "^ServerType[[:space:]]+standalone" %{_sysconfdir}/proftpd.conf; then \
+ %service -q proftpd restart \
+ fi \
+fi
+
+# macro called at module postun scriptlet
+%define module_postun \
+if [ "$1" = "0" ]; then \
+ if grep -iEqs "^ServerType[[:space:]]+inetd" %{_sysconfdir}/proftpd.conf; then \
+ %service -q rc-inetd reload \
+ elif grep -iEqs "^ServerType[[:space:]]+standalone" %{_sysconfdir}/proftpd.conf; then \
+ %service -q proftpd restart \
+ fi \
+fi
+
+%define module_triggerun \
+if [ $1 -le 1 ]; then \
+ exit 0 \
+fi \
+[ -d /etc/proftpd/conf.d ] || mkdir -p /etc/proftpd 2>/dev/null || : \
+%if "%1" == "mod_tls" \
+for f in /etc/ftpd/{conf.d/mod_tls.conf,server.crt,server.key}; do \
+ f=${f##*/} \
+ [ -f "/etc/ftpd/$f" ] && mv "/etc/ftpd/$f" /etc/proftpd 2>/dev/null || : \
+ [ -f "/etc/ftpd/conf.d/$f" ] && mv "/etc/ftpd/conf.d/$f" /etc/proftpd/conf.d 2>/dev/null || : \
+done \
+%else \
+[ -f /etc/ftpd/conf.d/%1.conf ] && mv /etc/ftpd/conf.d/%1.conf /etc/proftpd/conf.d 2>/dev/null || : \
+%endif \
+sed -i -e 's|/etc/ftpd|/etc/proftpd|g' /etc/ftpd/conf.d/%1.conf 2>/dev/null \
+[ -n "$(find /etc/ftpd/conf.d -type d -empty 2>/dev/null)" ] && rmdir /etc/ftpd/conf.d 2>/dev/null || : \
+[ -n "$(find /etc/ftpd -type d -empty 2>/dev/null)" ] && rmdir /etc/ftpd 2>/dev/null || :
+
+# it's sooo annoying to write them
+%define module_scripts() \
+%post %1 \
+%module_post \
+\
+%postun %1 \
+%module_postun \
+\
+%triggerun %1 -- proftpd-%1 \
+%module_triggerun
+