Fix lp bug #144228 by checking for link before directory

don't call rmtree with a path to a link pointing to a directory: in such a case, rmtree fails & leaves target directory & its contents uninstallable