If we are called from the command line, do not care about PORTAGE_TMPDIR, and make the current directory the work directory. Also rename the variable portage_tmp_dir to work_dir.
Changed paths: