PREUN
/bin/sh
# echo "Preun: $1 packages"
if [ $1 = 0 ] ; then
echo "Stopping service since we are uninstalling last package"
/sbin/service zfs-fuse stop >/dev/null 2>&1 || :
/sbin/chkconfig --del zfs-fuse
fi
POSTIN
/bin/sh
# echo "Post: $1 packages"
# Move cache if upgrading
oldcache=/etc/zfs/zpool.cache # this changed per 0.6.9, only needed when upgrading from earlier versions
newcache=/var/lib/zfs/zpool.cache
if [[ -f $oldcache && ! -e $newcache ]]; then
echo "Moving existing zpool.cache to new location"
mkdir -p $(dirname $newcache)
mv $oldcache $newcache
else
if [ -e $oldcache ]; then
echo "Note: old zpool.cache present but no longer used ($oldcache)"
fi
fi
if [ $1 = 1 ] ; then
echo "Initial install. Starting service"
/sbin/chkconfig --add zfs-fuse
/sbin/service zfs-fuse start >/dev/null 2>&1 || :
fi
POSTUN
/bin/sh
# echo "Postun: $1 packages"
if [ $1 -ge 1 ] ; then
echo "Restarting since we have updated the package"
/sbin/service zfs-fuse condrestart >/dev/null 2>&1 || :
else
echo "Removing files since we removed the last package"
rm -rf /var/run/zfs
rm -rf /var/lock/zfs
fi