Determine $HOME and cwd

Change-Id: If80dc5f3a7b2424bf146a42b8ea7d00861596af7