Moving add_system_user into a function is pointless when only used in a single place, and you don't need to use getent, since calling adduser on an existing user is a no-op.