rpmの.specの中で

%preun
if [ "$1" -eq "0" ]; then