move centos detection after redhat to avoid detecting redhat as centos, update #3174
use only first line of detected version, fix #3174