Linear and nonlinear accelerating beams in curved space