Exemplo n.º 1
0
    def _build_web(self, base_path, dist, target_path):
        cc.n('make Teleport Web package...')
        src_path = os.path.join(env.root_path, 'server', 'www')
        pkg_path = os.path.join(src_path, 'packages')
        tmp_path = os.path.join(base_path, '_tmp_web_')

        if os.path.exists(tmp_path):
            utils.remove(tmp_path)

        shutil.copytree(os.path.join(src_path, 'teleport'),
                        os.path.join(tmp_path, 'teleport'))
        utils.remove(os.path.join(tmp_path, 'teleport', '.idea'))

        cc.n(' - copy packages...')
        utils.copy_ex(pkg_path, os.path.join(tmp_path, 'packages'),
                      'packages-common')
        utils.copy_ex(
            os.path.join(pkg_path, 'packages-{}'.format(dist)),
            os.path.join(tmp_path, 'packages', 'packages-{}'.format(dist)),
            ctx.bits_path)

        makepyo.remove_cache(tmp_path)

        shutil.copytree(tmp_path, os.path.join(target_path, 'www'))
        utils.remove(tmp_path)
Exemplo n.º 2
0
    def _build_installer():
        tmp_path = os.path.join(env.root_path, 'dist', 'client', 'windows', 'assist')
        tmp_app_path = os.path.join(tmp_path, 'apps')
        tmp_cfg_path = os.path.join(tmp_app_path, 'cfg')

        if os.path.exists(tmp_app_path):
            utils.remove(tmp_app_path)

        utils.makedirs(tmp_app_path)
        utils.makedirs(tmp_cfg_path)

        utils.copy_file(os.path.join(env.root_path, 'out', 'client', ctx.bits_path, ctx.target_path), tmp_app_path, 'tp_assist.exe')
        utils.copy_file(os.path.join(env.root_path, 'client', 'tp_assist_win', 'cfg'), tmp_cfg_path, ('tp-assist.default.json', 'tp-assist.json'))

        utils.copy_ex(os.path.join(env.root_path, 'client', 'tp_assist_win'), tmp_app_path, 'site')

        utils.makedirs(os.path.join(tmp_app_path, 'tools', 'putty'))
        utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'putty'), os.path.join(tmp_app_path, 'tools', 'putty'), 'putty.exe')

        utils.makedirs(os.path.join(tmp_app_path, 'tools', 'winscp'))
        utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'winscp'), os.path.join(tmp_app_path, 'tools', 'winscp'), 'WinSCP.exe')
        utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'winscp'), os.path.join(tmp_app_path, 'tools', 'winscp'), 'license.txt')

        utils.makedirs(os.path.join(tmp_app_path, 'tools', 'tprdp'))
        utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'tprdp-client.exe')
        utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'tprdp-replay.exe')
        utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'libeay32.dll')
        utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'ssleay32.dll')
        utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'msvcr120.dll')

        utils.copy_file(os.path.join(env.root_path, 'client', 'tools'), os.path.join(tmp_app_path, 'tools'), 'securecrt-telnet.vbs')

        utils.nsis_build(os.path.join(env.root_path, 'dist', 'client', 'windows', 'assist', 'installer.nsi'))
Exemplo n.º 3
0
    def _prepare_python(self):
        cc.n('prepare python header files ...', end='')

        if os.path.exists(
                os.path.join(PATH_EXTERNAL, 'python', 'include', 'Python.h')):
            cc.w('already exists, skip.')
            return
        cc.v('')

        # if os.path.exists(os.path.join(env.path_py_inc, 'Python.h')):
        #     cc.e('can not locate python development include path, make sure miniconda installed.')
        #     return
        # cc.v('')
        # utils.copy_ex(env.path_py_inc, os.path.join(PATH_EXTERNAL, 'python', 'include'))

        _header_path = None
        for p in sys.path:
            if os.path.exists(os.path.join(p, 'include', 'Python.h')):
                _header_path = os.path.join(p, 'include')
        if _header_path is None:
            cc.e('\ncan not locate python development include path in:')
            for p in sys.path:
                cc.e('  ', p)
            raise RuntimeError()

        utils.copy_ex(_header_path,
                      os.path.join(PATH_EXTERNAL, 'python', 'include'))
Exemplo n.º 4
0
    def _make_base(self):
        if os.path.exists(self.base_path):
            cc.v('an exists version found, clean up...', self.base_path)
            utils.remove(self.base_path)

        cc.v('make pysrt folder...')
        utils.makedirs(self.base_path)

        cc.n('copy python extension dll...')
        utils.copy_ex(self.py_dll_path, os.path.join(self.base_path, 'modules'))
Exemplo n.º 5
0
    def _build_libssh(self, file_name):
        # cc.n('skip build libssh on macOS.')
        # return

        if not self._download_libssh(file_name):
            return
        if not os.path.exists(self.LIBSSH_PATH_SRC):
            os.system('unzip "{}/{}" -d "{}"'.format(PATH_DOWNLOAD, file_name,
                                                     self.PATH_TMP))

        cc.n('build libssh...', end='')
        # if os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libssh.a')) and os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libssh_threads.a')):
        if os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libssh.a')):
            cc.w('already exists, skip.')
            return
        cc.v('')

        build_path = os.path.join(self.LIBSSH_PATH_SRC, 'build')

        cmake_define = ' -DCMAKE_INSTALL_PREFIX={path_release}' \
                       ' -DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include' \
                       ' -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib' \
                       ' -DWITH_GCRYPT=OFF' \
                       ' -DWITH_GEX=OFF' \
                       ' -DWITH_SFTP=ON' \
                       ' -DWITH_SERVER=ON' \
                       ' -DWITH_GSSAPI=OFF' \
                       ' -DWITH_ZLIB=ON' \
                       ' -DWITH_PCAP=OFF' \
                       ' -DBUILD_SHARED_LIBS=OFF' \
                       ' -DUNIT_TESTING=OFF' \
                       ' -DWITH_EXAMPLES=OFF' \
                       ' -DWITH_BENCHMARKS=OFF' \
                       ' -DWITH_NACL=OFF' \
                       ''.format(path_release=self.PATH_RELEASE)

        # ' -DWITH_STATIC_LIB=ON'

        try:
            utils.cmake(build_path, 'Release', False, cmake_define)
        except:
            pass

        # because make install will fail because we can not disable ssh_shared target,
        # so we copy necessary files ourselves.
        utils.ensure_file_exists(
            os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', 'libssh.a'))
        # utils.ensure_file_exists(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', 'threads', 'libssh_threads.a'))
        utils.copy_file(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src'),
                        os.path.join(self.PATH_RELEASE, 'lib'), 'libssh.a')
        # utils.copy_file(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', 'threads'), os.path.join(self.PATH_RELEASE, 'lib'), 'libssh_threads.a')
        utils.copy_ex(os.path.join(self.LIBSSH_PATH_SRC, 'include'),
                      os.path.join(self.PATH_RELEASE, 'include'), 'libssh')
Exemplo n.º 6
0
    def build_installer(self):
        cc.i('make tp_assist dmg file...')

        # copy all files of tp-player.
        configuration = ctx.target_path.capitalize()
        player_path = os.path.join(env.root_path, 'out', 'client', ctx.bits_path, ctx.target_path)
        assist_path = os.path.join(env.root_path, 'client', 'tp_assist_macos', 'build', configuration, 'TP-Assist.app')
        utils.copy_ex(player_path, assist_path, 'tp-player.app')

        json_file = os.path.join(env.root_path, 'dist', 'client', 'macos', 'dmg.json')
        dmg_file = os.path.join(env.root_path, 'out', 'installer', 'teleport-assist-macos-{}.dmg'.format(VER_TP_ASSIST))
        if os.path.exists(dmg_file):
            utils.remove(dmg_file)

        utils.make_dmg(json_file, dmg_file)
        utils.ensure_file_exists(dmg_file)
Exemplo n.º 7
0
    def _prepare_python(self):
        cc.n('prepare python header files ...', end='')

        if os.path.exists(os.path.join(PATH_EXTERNAL, 'python', 'include', 'Python.h')):
            cc.w('already exists, skip.')
            return
        cc.v('')

        _header_path = None
        for p in sys.path:
            if os.path.exists(os.path.join(p, 'include', 'Python.h')):
                _header_path = os.path.join(p, 'include')
        if _header_path is None:
            cc.e('\ncan not locate python development include path in:')
            for p in sys.path:
                cc.e('  ', p)
            raise RuntimeError()

        utils.copy_ex(_header_path, os.path.join(PATH_EXTERNAL, 'python', 'include'))
Exemplo n.º 8
0
    def _build_web(self, base_path, dist, target_path):
        cc.n('make Teleport Web package...')
        src_path = os.path.join(env.root_path, 'server', 'www')
        pkg_path = os.path.join(src_path, 'packages')
        tmp_path = os.path.join(base_path, '_tmp_web_')

        if os.path.exists(tmp_path):
            utils.remove(tmp_path)

        shutil.copytree(os.path.join(src_path, 'teleport'), os.path.join(tmp_path, 'teleport'))
        utils.remove(os.path.join(tmp_path, 'teleport', '.idea'))

        cc.n(' - copy packages...')
        # utils.copy_ex(pkg_path, os.path.join(tmp_path, 'packages'), 'packages-common')
        utils.copy_ex(os.path.join(pkg_path, 'packages-{}'.format(dist)), os.path.join(tmp_path, 'packages', 'packages-{}'.format(dist)), ctx.bits_path)
        self._remove_py_cache(os.path.join(tmp_path, 'packages'))

        makepyo.remove_cache(tmp_path)

        shutil.copytree(tmp_path, os.path.join(target_path, 'www'))
        utils.remove(tmp_path)
Exemplo n.º 9
0
    def _prepare_python_header(self):
        cc.n('prepare python header files ...', end='')

        if os.path.exists(
                os.path.join(PATH_EXTERNAL, 'python', 'include', 'pyctype.h')):
            cc.w('already exists, skip.')
            return
        cc.v('')

        _header_path = None
        for p in sys.path:
            if os.path.exists(os.path.join(p, 'include', 'pyctype.h')):
                _header_path = os.path.join(p, 'include')
        if _header_path is None:
            cc.e('\ncan not locate python development include path in:')
            for p in sys.path:
                cc.e('  ', p)
            raise RuntimeError()

        utils.copy_ex(_header_path,
                      os.path.join(PATH_EXTERNAL, 'python', 'include'))
Exemplo n.º 10
0
    def _make_base(self):
        if os.path.exists(self.base_path):
            cc.v('an exists version found, clean up...', self.base_path)
            utils.remove(self.base_path)

        cc.v('make pysrt folder...')
        utils.makedirs(self.base_path)

        cc.n('copy python extension dll...')
        utils.copy_ex(self.py_dll_path, self.modules_path)

        cc.v('remove useless modules...')
        for i in PY_MODULE_REMOVE_LINUX:
            utils.remove(self.modules_path, '{}.cpython-{}m-x86_64-linux-gnu.so'.format(i, ctx.py_ver))

        ext = utils.extension_suffixes()
        files = os.listdir(self.modules_path)
        for i in files:
            for n in ext:
                if i.find('_failed{}'.format(n)) != -1:
                    utils.remove(self.modules_path, i)
Exemplo n.º 11
0
    def _build_libssh(self, file_name):
        if not os.path.exists(self.LIBSSH_PATH_SRC):
            os.system('unzip "{}/{}" -d "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP))

        cc.n('build libssh...', end='')
        # if os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libssh.a')) and os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libssh_threads.a')):
        if os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libssh.a')):
            cc.w('already exists, skip.')
            return
        cc.v('')

        build_path = os.path.join(self.LIBSSH_PATH_SRC, 'build')

        cmake_define = ' -DCMAKE_INSTALL_PREFIX={path_release}' \
                       ' -DOPENSSL_INCLUDE_DIR={path_release}/include' \
                       ' -DOPENSSL_LIBRARIES={path_release}/lib' \
                       ' -DWITH_SFTP=ON' \
                       ' -DWITH_SERVER=ON' \
                       ' -DWITH_STATIC_LIB=ON' \
                       ' -DWITH_GSSAPI=OFF' \
                       ' -DWITH_ZLIB=OFF' \
                       ' -DWITH_PCAP=OFF' \
                       ' -DUNIT_TESTING=OFF' \
                       ' -DWITH_EXAMPLES=OFF' \
                       ' -DWITH_BENCHMARKS=OFF' \
                       ' -DWITH_NACL=OFF' \
                       ''.format(path_release=self.PATH_RELEASE)

        try:
            utils.cmake(build_path, 'Release', False, cmake_define)
        except:
            pass

        # because make install will fail because we can not disable ssh_shared target,
        # so we copy necessary files ourselves.
        utils.ensure_file_exists(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', 'libssh.a'))
        # utils.ensure_file_exists(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', 'threads', 'libssh_threads.a'))
        utils.copy_file(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src'), os.path.join(self.PATH_RELEASE, 'lib'), 'libssh.a')
        # utils.copy_file(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', 'threads'), os.path.join(self.PATH_RELEASE, 'lib'), 'libssh_threads.a')
        utils.copy_ex(os.path.join(self.LIBSSH_PATH_SRC, 'include'), os.path.join(self.PATH_RELEASE, 'include'), 'libssh')
Exemplo n.º 12
0
    def _build_libssh(self, file_name):
        cc.n('build libssh static library from source code... ', end='')
        out_file = os.path.join(self.LIBSSH_PATH_SRC, 'lib', 'libsshMT.lib')

        need_build = False
        if not os.path.exists(out_file):
            need_build = True

        if not need_build:
            cc.w('already exists, skip.')
            return
        cc.v('')

        cc.n('prepare libssh source code... ', end='')
        _include = os.path.join(self.LIBSSH_PATH_SRC, 'include', 'libssh')
        _src = os.path.join(self.LIBSSH_PATH_SRC, 'src')

        if not os.path.exists(_include) or not os.path.exists(_src):
            utils.unzip(os.path.join(PATH_DOWNLOAD, file_name), PATH_EXTERNAL)
            # os.rename(os.path.join(PATH_EXTERNAL, 'openssl-OpenSSL_{}'.format(_alt_ver)), self.OPENSSL_PATH_SRC)

            _unzipped_path = os.path.join(PATH_EXTERNAL,
                                          'libssh-{}'.format(env.ver_libssh))

            utils.copy_ex(os.path.join(_unzipped_path, 'include', 'libssh'),
                          _include)
            utils.copy_ex(os.path.join(_unzipped_path, 'src'), _src)

            utils.remove(_unzipped_path)

            if not os.path.exists(_include) or not os.path.exists(_src):
                raise RuntimeError('\ncan not prepare libssh source code.')
        else:
            cc.w('already exists, skip.')

        cc.i('build libssh...')
        sln_file = os.path.join(self.LIBSSH_PATH_SRC, 'libssh.vs2015.sln')
        utils.msvc_build(sln_file, 'libssh', ctx.target_path, ctx.bits_path,
                         False)
        utils.ensure_file_exists(out_file)
Exemplo n.º 13
0
    def _make_base(self):
        if os.path.exists(self.base_path):
            cc.v('an exists version found, clean up...', self.base_path)
            utils.remove(self.base_path)

        cc.v('make pysrt folder...')
        utils.makedirs(self.base_path)

        cc.n('copy python extension dll...')
        utils.copy_ex(self.py_dll_path, self.modules_path)

        cc.v('remove useless modules...')
        for i in PY_MODULE_REMOVE_LINUX:
            utils.remove(
                self.modules_path,
                '{}.cpython-{}m-x86_64-linux-gnu.so'.format(i, ctx.py_ver))

        ext = utils.extension_suffixes()
        files = os.listdir(self.modules_path)
        for i in files:
            for n in ext:
                if i.find('_failed{}'.format(n)) != -1:
                    utils.remove(self.modules_path, i)
Exemplo n.º 14
0
    def _build_installer():
        tmp_path = os.path.join(env.root_path, 'dist', 'client', 'windows', 'assist')
        tmp_app_path = os.path.join(tmp_path, 'apps')
        tmp_cfg_path = os.path.join(tmp_app_path, 'cfg')

        if os.path.exists(tmp_app_path):
            utils.remove(tmp_app_path)

        utils.makedirs(tmp_app_path)
        utils.makedirs(tmp_cfg_path)

        utils.copy_file(os.path.join(env.root_path, 'out', 'client', ctx.bits_path, ctx.target_path), tmp_app_path, 'tp_assist.exe')
        utils.copy_file(os.path.join(env.root_path, 'client', 'cfg'), tmp_cfg_path, ('tp-assist.windows.json', 'tp-assist.json'))

        utils.copy_file(os.path.join(env.root_path, 'client', 'cfg'), tmp_cfg_path, 'cacert.cer')
        utils.copy_file(os.path.join(env.root_path, 'client', 'cfg'), tmp_cfg_path, 'localhost.key')
        utils.copy_file(os.path.join(env.root_path, 'client', 'cfg'), tmp_cfg_path, 'localhost.pem')

        utils.copy_ex(os.path.join(env.root_path, 'client', 'tp_assist_win'), tmp_app_path, 'site')

        utils.makedirs(os.path.join(tmp_app_path, 'tools', 'putty'))
        utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'putty'), os.path.join(tmp_app_path, 'tools', 'putty'), 'putty.exe')

        utils.makedirs(os.path.join(tmp_app_path, 'tools', 'winscp'))
        utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'winscp'), os.path.join(tmp_app_path, 'tools', 'winscp'), 'WinSCP.exe')
        utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'winscp'), os.path.join(tmp_app_path, 'tools', 'winscp'), 'license.txt')

        utils.makedirs(os.path.join(tmp_app_path, 'tools', 'tprdp'))
        utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'tprdp-client.exe')
        utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'tprdp-replay.exe')
        utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'libeay32.dll')
        utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'ssleay32.dll')
        utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'msvcr120.dll')

        utils.copy_file(os.path.join(env.root_path, 'client', 'tools'), os.path.join(tmp_app_path, 'tools'), 'securecrt-telnet.vbs')

        utils.nsis_build(os.path.join(env.root_path, 'dist', 'client', 'windows', 'assist', 'installer.nsi'))
Exemplo n.º 15
0
    def _copy_files(self):
        utils.copy_ex(os.path.join(env.src_path, 'bin'),
                      os.path.join(self._install_path, 'bin'))
        utils.copy_ex(os.path.join(env.src_path, 'www'),
                      os.path.join(self._install_path, 'www'))

        if not os.path.exists(self._config_path):
            utils.copy_ex(os.path.join(env.src_path, 'tmp', 'etc'),
                          self._config_path)
Exemplo n.º 16
0
    def build_installer(self):
        cc.n('make teleport installer package...')

        if os.path.exists(self.base_tmp):
            utils.remove(self.base_tmp)

        self._build_web(self.base_path, 'windows', self.path_tmp_data)
        utils.copy_file(os.path.join(env.root_path, 'server', 'share', 'etc'), os.path.join(self.path_tmp_data, 'tmp', 'etc'), ('web.ini.in', 'web.ini'))
        utils.copy_file(os.path.join(env.root_path, 'server', 'share', 'etc'), os.path.join(self.path_tmp_data, 'tmp', 'etc'), ('core.ini.in', 'core.ini'))
        utils.copy_file(os.path.join(env.root_path, 'server', 'share', 'etc'), os.path.join(self.path_tmp_data, 'tmp', 'etc'), 'tp_ssh_server.key')

        out_path = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, ctx.target_path)
        bin_path = os.path.join(self.path_tmp_data, 'bin')
        utils.copy_ex(out_path, bin_path, 'tp_web.exe')
        utils.copy_ex(out_path, bin_path, 'tp_core.exe')
        utils.copy_ex(out_path, bin_path, 'tpssh.dll')
        utils.copy_ex(out_path, bin_path, 'tptelnet.dll')
        if with_rdp:
            utils.copy_ex(out_path, bin_path, 'tprdp.dll')

        utils.copy_ex(os.path.join(env.root_path, 'out', 'pysrt'), bin_path, (ctx.dist_path, 'pysrt'))

        # copy scripts
        utils.copy_ex(os.path.join(self.dist_path), self.path_tmp, 'setup.bat')
        utils.copy_ex(os.path.join(self.dist_path), self.path_tmp, 'script')

        if os.path.exists(self._final_file):
            utils.remove(self._final_file)

        utils.make_zip(self.path_tmp, self._final_file)
Exemplo n.º 17
0
    def build_installer(self):
        cc.n('make teleport installer package...')

        if os.path.exists(self.base_tmp):
            utils.remove(self.base_tmp)

        self._build_web(self.base_path, 'linux', self.path_tmp_data)

        utils.copy_file(os.path.join(env.root_path, 'server', 'share', 'etc'), os.path.join(self.path_tmp_data, 'tmp', 'etc'), ('web.ini.in', 'web.ini'))
        utils.copy_file(os.path.join(env.root_path, 'server', 'share', 'etc'), os.path.join(self.path_tmp_data, 'tmp', 'etc'), ('core.ini.in', 'core.ini'))
        utils.copy_file(os.path.join(env.root_path, 'server', 'share', 'etc'), os.path.join(self.path_tmp_data, 'tmp', 'etc'), 'tp_ssh_server.key')

        # fix new line flag
        utils.fix_new_line_flag(os.path.join(self.path_tmp_data, 'tmp', 'etc', 'web.ini'))
        utils.fix_new_line_flag(os.path.join(self.path_tmp_data, 'tmp', 'etc', 'core.ini'))

        out_path = os.path.join(env.root_path, 'out', 'server', 'linux', 'bin')
        bin_path = os.path.join(self.path_tmp_data, 'bin')
        utils.copy_ex(out_path, bin_path, 'tp_web')
        utils.copy_ex(out_path, bin_path, 'tp_core')
        utils.copy_ex(out_path, bin_path, 'libtpssh.so')
        utils.copy_ex(out_path, bin_path, 'libtptelnet.so')
        if with_rdp:
            utils.copy_ex(out_path, bin_path, 'libtprdp.so')

        utils.copy_ex(os.path.join(env.root_path, 'out', 'pysrt'), bin_path, (ctx.dist_path, 'pysrt'))

        # copy scripts
        utils.copy_ex(self.dist_path, self.path_tmp, 'setup.sh')
        utils.copy_ex(self.dist_path, self.path_tmp, 'script')
        utils.copy_ex(self.dist_path, self.path_tmp, 'daemon')

        if os.path.exists(self._final_file):
            utils.remove(self._final_file)

        utils.sys_exec('chmod +x {}'.format(os.path.join(self.path_tmp, 'setup.sh')))
        utils.make_targz(self.base_tmp, self.name, self._final_file)
Exemplo n.º 18
0
    def _copy_files(self):
        utils.copy_ex(os.path.join(env.src_path, 'bin'), os.path.join(self._install_path, 'bin'))
        utils.copy_ex(os.path.join(env.src_path, 'www'), os.path.join(self._install_path, 'www'))

        if not os.path.exists(self._config_path):
            utils.copy_ex(os.path.join(env.src_path, 'tmp', 'etc'), self._config_path)
Exemplo n.º 19
0
    def _build_installer():
        tmp_path = os.path.join(env.root_path, 'dist', 'client', 'windows',
                                'assist')
        tmp_app_path = os.path.join(tmp_path, 'apps')
        tmp_cfg_path = os.path.join(tmp_app_path, 'cfg')

        if os.path.exists(tmp_app_path):
            utils.remove(tmp_app_path)

        utils.makedirs(tmp_app_path)
        utils.makedirs(tmp_cfg_path)

        utils.copy_file(
            os.path.join(env.root_path, 'out', 'client', ctx.bits_path,
                         ctx.target_path), tmp_app_path, 'tp_assist.exe')
        utils.copy_file(
            os.path.join(env.root_path, 'client', 'tp_assist_win', 'runtime'),
            tmp_app_path, 'vcruntime140.dll')

        utils.copy_file(os.path.join(env.root_path, 'client',
                                     'cfg'), tmp_cfg_path,
                        ('tp-assist.windows.json', 'tp-assist.json'))
        utils.copy_file(os.path.join(env.root_path, 'client', 'cfg'),
                        tmp_cfg_path, 'cacert.cer')
        utils.copy_file(os.path.join(env.root_path, 'client', 'cfg'),
                        tmp_cfg_path, 'localhost.key')
        utils.copy_file(os.path.join(env.root_path, 'client', 'cfg'),
                        tmp_cfg_path, 'localhost.pem')

        # assist configuration web page
        utils.copy_ex(os.path.join(env.root_path, 'client', 'tp_assist_win'),
                      tmp_app_path, 'site')

        utils.makedirs(os.path.join(tmp_app_path, 'tools', 'putty'))
        utils.copy_file(
            os.path.join(env.root_path, 'client', 'tools', 'putty'),
            os.path.join(tmp_app_path, 'tools', 'putty'), 'putty.exe')

        utils.makedirs(os.path.join(tmp_app_path, 'tools', 'winscp'))
        utils.copy_file(
            os.path.join(env.root_path, 'client', 'tools', 'winscp'),
            os.path.join(tmp_app_path, 'tools', 'winscp'), 'WinSCP.exe')
        utils.copy_file(
            os.path.join(env.root_path, 'client', 'tools', 'winscp'),
            os.path.join(tmp_app_path, 'tools', 'winscp'), 'license.txt')

        utils.makedirs(os.path.join(tmp_app_path, 'tools', 'tprdp'))
        # utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'tprdp-client.exe')
        # utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'tprdp-replay.exe')
        # utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'libeay32.dll')
        # utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'ssleay32.dll')
        # utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'msvcr120.dll')
        utils.copy_file(
            os.path.join(env.root_path, 'client', 'tools', 'tprdp'),
            os.path.join(tmp_app_path, 'tools', 'tprdp'), 'wfreerdp.exe')

        utils.copy_file(os.path.join(env.root_path, 'client', 'tools'),
                        os.path.join(tmp_app_path, 'tools'),
                        'securecrt-telnet.vbs')

        # tp-player
        utils.copy_file(
            os.path.join(env.root_path, 'out', 'client', ctx.bits_path,
                         ctx.target_path), tmp_app_path, 'tp-player.exe')

        # qt-redist
        qt_redist_path = os.path.join(env.root_path, 'client', 'tools',
                                      'qt-redist')
        utils.copy_file(qt_redist_path, tmp_app_path, 'Qt5Core.dll')
        utils.copy_file(qt_redist_path, tmp_app_path, 'Qt5Gui.dll')
        utils.copy_file(qt_redist_path, tmp_app_path, 'Qt5Network.dll')
        utils.copy_file(qt_redist_path, tmp_app_path, 'Qt5Widgets.dll')
        utils.copy_ex(os.path.join(qt_redist_path, 'platforms'),
                      os.path.join(tmp_app_path, 'platforms'))
        utils.copy_ex(os.path.join(qt_redist_path, 'styles'),
                      os.path.join(tmp_app_path, 'styles'))
        utils.copy_ex(os.path.join(qt_redist_path, 'translations'),
                      os.path.join(tmp_app_path, 'translations'))

        # zlib
        suffix = 'd' if ctx.target_path == 'debug' else ''
        utils.copy_file(
            os.path.join(env.root_path, 'external', 'zlib', 'build',
                         ctx.target_path), tmp_app_path,
            'zlib{}.dll'.format(suffix))

        # openssl
        utils.copy_file(
            os.path.join(env.root_path, 'external', 'openssl', 'bin'),
            tmp_app_path, 'libcrypto-1_1.dll')
        utils.copy_file(
            os.path.join(env.root_path, 'external', 'openssl', 'bin'),
            tmp_app_path, 'libssl-1_1.dll')

        # final build
        utils.nsis_build(
            os.path.join(env.root_path, 'dist', 'client', 'windows', 'assist',
                         'installer.nsi'))
Exemplo n.º 20
0
    def build_installer(self):
        cc.n('make teleport installer package...')

        if os.path.exists(self.base_tmp):
            utils.remove(self.base_tmp)

        self._build_web(self.base_path, 'linux', self.path_tmp_data)

        utils.copy_file(os.path.join(env.root_path, 'server', 'share', 'etc'), os.path.join(self.path_tmp_data, 'tmp', 'etc'), ('web.ini.in', 'web.ini'))
        utils.copy_file(os.path.join(env.root_path, 'server', 'share', 'etc'), os.path.join(self.path_tmp_data, 'tmp', 'etc'), ('core.ini.in', 'core.ini'))
        utils.copy_file(os.path.join(env.root_path, 'server', 'share', 'etc'), os.path.join(self.path_tmp_data, 'tmp', 'etc'), 'tp_ssh_server.key')

        # fix new line flag
        utils.fix_new_line_flag(os.path.join(self.path_tmp_data, 'tmp', 'etc', 'web.ini'))
        utils.fix_new_line_flag(os.path.join(self.path_tmp_data, 'tmp', 'etc', 'core.ini'))

        out_path = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, 'bin')
        bin_path = os.path.join(self.path_tmp_data, 'bin')
        utils.copy_ex(out_path, bin_path, 'tp_web')
        utils.copy_ex(out_path, bin_path, 'tp_core')
        utils.copy_ex(out_path, bin_path, 'libtpssh.so')
        utils.copy_ex(out_path, bin_path, 'libtptelnet.so')
        if with_rdp:
            utils.copy_ex(out_path, bin_path, 'libtprdp.so')

        utils.copy_ex(os.path.join(env.root_path, 'out', 'pysrt'), bin_path, (ctx.dist_path, 'pysrt'))

        # 复制安装所需的脚本
        utils.copy_ex(os.path.join(self.dist_path), self.path_tmp, 'setup.sh')
        utils.copy_ex(os.path.join(self.dist_path), self.path_tmp, 'script')
        utils.copy_ex(os.path.join(self.dist_path), self.path_tmp, 'daemon')

        if os.path.exists(self._final_file):
            utils.remove(self._final_file)

        utils.make_targz(self.base_tmp, self.name, self._final_file)
Exemplo n.º 21
0
    def build_installer(self):
        cc.n('make teleport installer package...')

        if os.path.exists(self.base_tmp):
            utils.remove(self.base_tmp)

        self._build_web(self.base_path, 'windows', self.path_tmp_data)
        utils.copy_file(os.path.join(env.root_path, 'server', 'share', 'etc'), os.path.join(self.path_tmp_data, 'tmp', 'etc'), ('web.ini.in', 'web.ini'))
        utils.copy_file(os.path.join(env.root_path, 'server', 'share', 'etc'), os.path.join(self.path_tmp_data, 'tmp', 'etc'), ('core.ini.in', 'core.ini'))
        utils.copy_file(os.path.join(env.root_path, 'server', 'share', 'etc'), os.path.join(self.path_tmp_data, 'tmp', 'etc'), 'tp_ssh_server.key')

        out_path = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, ctx.target_path)
        bin_path = os.path.join(self.path_tmp_data, 'bin')
        utils.copy_ex(out_path, bin_path, 'tp_web.exe')
        utils.copy_ex(out_path, bin_path, 'tp_core.exe')
        utils.copy_ex(out_path, bin_path, 'tpssh.dll')
        utils.copy_ex(out_path, bin_path, 'tptelnet.dll')
        if with_rdp:
            utils.copy_ex(out_path, bin_path, 'tprdp.dll')

        utils.copy_ex(os.path.join(env.root_path, 'out', 'pysrt'), bin_path, (ctx.dist_path, 'pysrt'))

        # 复制安装所需的脚本
        utils.copy_ex(os.path.join(self.dist_path), self.path_tmp, 'setup.bat')
        utils.copy_ex(os.path.join(self.dist_path), self.path_tmp, 'script')

        if os.path.exists(self._final_file):
            utils.remove(self._final_file)

        utils.make_zip(self.path_tmp, self._final_file)
Exemplo n.º 22
0
    def _build_libssh(self, file_name):
        if not os.path.exists(self.LIBSSH_PATH_SRC):
            # os.system('tar -zxvf "{}/{}" -C "{}"'.format(PATH_DOWNLOAD, file_name, PATH_TMP))
            os.system('unzip "{}/{}" -d "{}"'.format(PATH_DOWNLOAD, file_name,
                                                     self.PATH_TMP))
            # os.rename(os.path.join(self.PATH_TMP, 'master'), os.path.join(self.PATH_TMP, 'libssh-{}'.format(LIBSSH_VER)))

        cc.n('build libssh...', end='')
        if os.path.exists(os.path.join(
                self.PATH_RELEASE, 'lib', 'libssh.a')) and os.path.exists(
                    os.path.join(self.PATH_RELEASE, 'lib',
                                 'libssh_threads.a')):
            cc.w('already exists, skip.')
            return
        cc.v('')

        build_path = os.path.join(self.LIBSSH_PATH_SRC, 'build')
        # utils.makedirs(build_path)

        # here is a bug in cmake v2.8.11 (default on ubuntu14), in FindOpenSSL.cmake,
        # it parse opensslv.h, use regex like this:
        #   REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*")
        # but in openssl-1.0.2h, the version define line is:
        #   # define OPENSSL_VERSION_NUMBER  0x1000208fL
        # notice there is a space char between # and define, so find openssl always fail.

        # old_p = os.getcwd()
        # os.chdir(build_path)
        # cmd = 'cmake' \
        #       ' -DCMAKE_INSTALL_PREFIX={}' \
        #       ' -D_OPENSSL_VERSION={}' \
        #       ' -DOPENSSL_INCLUDE_DIR={}/include' \
        #       ' -DOPENSSL_LIBRARIES={}/lib' \
        #       ' -DCMAKE_BUILD_TYPE=Release' \
        #       ' -DWITH_GSSAPI=OFF' \
        #       ' -DWITH_ZLIB=OFF' \
        #       ' -DWITH_STATIC_LIB=ON' \
        #       ' -DWITH_PCAP=OFF' \
        #       ' -DWITH_EXAMPLES=OFF' \
        #       ' -DWITH_NACL=OFF' \
        #       ' ..'.format(self.PATH_RELEASE, OPENSSL_VER, self.PATH_RELEASE, self.PATH_RELEASE)
        # cc.n(cmd)
        # os.system(cmd)
        # # os.system('make ssh_static ssh_threads_static')
        # os.system('make ssh_static')
        # # os.system('make install')
        # os.chdir(old_p)

        cmake_define = ' -DCMAKE_INSTALL_PREFIX={}' \
                       ' -D_OPENSSL_VERSION={}' \
                       ' -DOPENSSL_INCLUDE_DIR={}/include' \
                       ' -DOPENSSL_LIBRARIES={}/lib' \
                       ' -DWITH_GSSAPI=OFF' \
                       ' -DWITH_ZLIB=OFF' \
                       ' -DWITH_STATIC_LIB=ON' \
                       ' -DWITH_PCAP=OFF' \
                       ' -DWITH_TESTING=OFF' \
                       ' -DWITH_CLIENT_TESTING=OFF' \
                       ' -DWITH_EXAMPLES=OFF' \
                       ' -DWITH_BENCHMARKS=OFF' \
                       ' -DWITH_NACL=OFF' \
                       ' ..'.format(self.PATH_RELEASE, env.ver_openssl_number, self.PATH_RELEASE, self.PATH_RELEASE)

        try:
            utils.cmake(build_path, 'Release', False, cmake_define)
        except:
            pass

        # because make install will fail because we can not disable ssh_shared target,
        # so we copy necessary files ourselves.
        utils.ensure_file_exists(
            os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', 'libssh.a'))
        utils.ensure_file_exists(
            os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', 'threads',
                         'libssh_threads.a'))
        utils.copy_file(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src'),
                        os.path.join(self.PATH_RELEASE, 'lib'), 'libssh.a')
        utils.copy_file(
            os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', 'threads'),
            os.path.join(self.PATH_RELEASE, 'lib'), 'libssh_threads.a')
        utils.copy_ex(os.path.join(self.LIBSSH_PATH_SRC, 'include'),
                      os.path.join(self.PATH_RELEASE, 'include'), 'libssh')
Exemplo n.º 23
0
    def build_installer(self):
        cc.n('make teleport installer package...')

        if os.path.exists(self.base_tmp):
            utils.remove(self.base_tmp)

        self._build_web(self.base_path, 'linux', self.path_tmp_data)

        utils.copy_file(os.path.join(env.root_path, 'server', 'share', 'etc'),
                        os.path.join(self.path_tmp_data, 'tmp', 'etc'),
                        ('web.ini.in', 'web.ini'))
        utils.copy_file(os.path.join(env.root_path, 'server', 'share', 'etc'),
                        os.path.join(self.path_tmp_data, 'tmp', 'etc'),
                        ('core.ini.in', 'core.ini'))
        utils.copy_file(os.path.join(env.root_path, 'server', 'share', 'etc'),
                        os.path.join(self.path_tmp_data, 'tmp', 'etc'),
                        'tp_ssh_server.key')

        # out_path = os.path.join(env.root_path, 'out', 'eom_ts', ctx.target_path, ctx.dist_path)
        # out_path = os.path.join(env.root_path, 'out', 'eom_ts', ctx.bits_path, 'bin')
        # bin_path = os.path.join(self.tmp_path, 'bin')
        # utils.copy_file(out_path, bin_path, 'eom_ts')

        out_path = os.path.join(env.root_path, 'out', 'server', ctx.bits_path,
                                'bin')
        bin_path = os.path.join(self.path_tmp_data, 'bin')
        utils.copy_ex(out_path, bin_path, 'tp_web')
        utils.copy_ex(out_path, bin_path, 'tp_core')
        utils.copy_ex(out_path, bin_path, 'libtpssh.so')
        utils.copy_ex(out_path, bin_path, 'libtprdp.so')

        utils.copy_ex(os.path.join(env.root_path, 'out', 'pysrt'), bin_path,
                      (ctx.dist_path, 'pysrt'))

        # utils.copy_file(os.path.join(env.root_path, 'share', 'etc'), os.path.join(self.tmp_path, 'tmp', 'etc'), 'eom_ts.ini')
        # utils.copy_file(os.path.join(env.root_path, 'share', 'etc'), os.path.join(self.tmp_path, 'tmp', 'etc'), 'license.key')
        # utils.copy_ex(os.path.join(env.root_path, 'share', 'etc'), os.path.join(self.tmp_path, 'tmp', 'etc'), 'ssl')

        # utils.copy_ex(os.path.join(env.root_path, 'share', 'data'), os.path.join(self.tmp_path, 'tmp', 'data'), ('ts_db_release.db', 'ts_db.db'))
        # utils.copy_ex(os.path.join(env.root_path, 'server', 'share', 'data'), os.path.join(self.tmp_path, 'tmp', 'data'), 'main.sql')

        # utils.make_zip(self.tmp_path, os.path.join(self.tmp_path, '..', 'eom_ts.zip'))
        # utils.make_targz(os.path.join(self.tmp_path, '..'), 'teleport', 'teleport.tar.gz')
        # utils.remove(self.tmp_path)

        # make final installer.
        # cc.n('pack final server installer...')
        # out_file = os.path.join(env.root_path, 'dist', '{}.zip'.format(self.name))
        # out_file = os.path.join(env.root_path, 'out', 'installer', '{}.tar.gz'.format(self.name))

        # if os.path.exists(out_file):
        #     utils.remove(out_file)

        # # copy installer scripts.
        # for i in ['daemon', 'start.sh', 'stop.sh', 'status.sh']:
        # # for i in ['daemon_web', 'daemon_core', 'teleport.sh']:
        #     shutil.copy(os.path.join(self.dist_path, 'script', i), os.path.abspath(os.path.join(self.tmp_path, '..', i)))
        # for i in ['install.sh', 'uninst.sh']:
        #     shutil.copy(os.path.join(self.dist_path, 'script', i), os.path.abspath(os.path.join(self.tmp_path, '..', '..', i)))

        # 复制安装所需的脚本
        # utils.copy_ex(os.path.join(self.dist_path, 'script'), self.path_tmp, 'install.sh')
        # utils.copy_ex(os.path.join(self.dist_path, 'script'), self.path_tmp, 'uninst.sh')
        utils.copy_ex(os.path.join(self.dist_path), self.path_tmp, 'setup.sh')
        utils.copy_ex(os.path.join(self.dist_path), self.path_tmp, 'script')
        utils.copy_ex(os.path.join(self.dist_path), self.path_tmp, 'daemon')

        if os.path.exists(self._final_file):
            utils.remove(self._final_file)

        utils.make_targz(self.base_tmp, self.name, self._final_file)