Display only needed Reinstall and Clear Package Lock buttons

Make the code a bit smarter, so the user only sees whichever of the reinstall and clear package lock buttons that are actually relevant.