New derivation of the variational principle for the dynamics of a gravitating spherical shell