it seems like a bit of a redundant check to me, trying to remove an alternatives name is it has no links. but if we've removed the last link then the name is automatically removed anyway. unless theres something i'm missing we could drop altogether. still, daniels fix will certainly do the trick
for p in $VARIANTS; do
[ `update-alternatives --list "$p-flashplugin" | wc -l` = 0 ] && \
update-alternatives --remove-all "$p-flashplugin"