Scripts: Perform more accurate package type detection