South African consumer goods firm Tiger Brands has reached a deal to buy a majority stake in Nigerian flour and pasta maker Dangoteis.