Moved code from teamcity_agent to the linux specific one since its only used there anyway.