def write_riak_script(self):
        with open(self._riak_script, "wb") as temp_bin_file:
            with open(os.path.join(self.bin_dir, "riak"), "r") as riak_file:
                for line in riak_file.readlines():
                    line = re.sub("(RUNNER_SCRIPT_DIR=)(.*)", r'\1%s' %
                                  self._temp_bin,
                                  line)
                    line = re.sub("(RUNNER_ETC_DIR=)(.*)", r'\1%s' %
                                  self._temp_etc, line)
                    line = re.sub("(RUNNER_USER=)(.*)", r'\1', line)
                    line = re.sub("(RUNNER_LOG_DIR=)(.*)", r'\1%s' %
                                  self._temp_log, line)
                    line = re.sub("(PIPE_DIR=)(.*)", r'\1%s' %
                                  self._temp_pipe, line)
                    line = re.sub("(PLATFORM_DATA_DIR=)(.*)", r'\1%s' %
                                  self.temp_dir, line)

                    if (string.strip(line) == self.DEFAULT_BASE_DIR):
                        line = ("RUNNER_BASE_DIR=%s\n" %
                                os.path.normpath(os.path.join(self.bin_dir,
                                                              "..")))

                    temp_bin_file.write(line)

                os.fchmod(temp_bin_file.fileno(),
                          stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP |
                          stat.S_IROTH | stat.S_IXOTH)
dataset/ETHPy150Open basho/riak-python-client/riak/test_server.py/TestServer.write_riak_script/original