systemd RPM MacrosΒΆ

preinstall scriptlet (using /bin/sh):
%systemd_pre
postinstall scriptlet (using /bin/sh):

if [ $1 -eq 1 ] ; then
        # Initial installation
        systemctl preset something.service >/dev/null 2>&1 || :
fi
preuninstall scriptlet (using /bin/sh):

if [ $1 -eq 0 ] ; then
        # Package removal, not upgrade
        systemctl --no-reload disable something.service > /dev/null 2>&1 || :
        systemctl stop something.service > /dev/null 2>&1 || :
fi
postuninstall scriptlet (using /bin/sh):

if [ $1 -eq 1 ] ; then
        # Initial installation
        systemctl preset  >/dev/null 2>&1 || :
fi