예제 #1
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'))
예제 #2
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)
예제 #3
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 pysbase folder...')
        utils.makedirs(self.base_path)

        cc.v('copy python core dll...')
        _exec_path = os.path.dirname(env.py_exec)
        # _win_system_path = os.path.join(os.getenv('SystemRoot'), 'system32')
        # if ctx.bits == BITS_32 and ctx.host_os_is_win_x64:
        #     _win_system_path = os.path.join(os.getenv('SystemRoot'), 'SysWOW64')

        if not os.path.exists(_exec_path):
            raise RuntimeError('can not locate python folder at:', _exec_path)

        pydll = self._get_py_dll_name()
        shutil.copy(os.path.join(_exec_path, pydll),
                    os.path.join(self.base_path, pydll))

        if ctx.py_ver == '34':
            msvcrdll = 'msvcr100.dll'
        elif ctx.py_ver == '37':
            msvcrdll = 'vcruntime140.dll'
        else:
            raise RuntimeError('unknown msvc runtime for this python version.')
        shutil.copy(os.path.join(_exec_path, msvcrdll),
                    os.path.join(self.base_path, msvcrdll))

        super()._copy_modules()
예제 #4
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)
예제 #5
0
    def build_server(self):
        cc.n('build server app (tp_core/libtpssh/libtelnet/librdp/tp_web)...')

        out_path = os.path.join(env.root_path, 'out', 'server', ctx.bits_path,
                                'bin')
        out_files = list()
        out_files.append(os.path.join(out_path, 'tp_core'))
        out_files.append(os.path.join(out_path, 'tp_web'))
        out_files.append(os.path.join(out_path, 'libtpssh.so'))
        out_files.append(os.path.join(out_path, 'libtptelnet.so'))
        if with_rdp:
            out_files.append(os.path.join(out_path, 'libtprdp.so'))

        for f in out_files:
            if os.path.exists(f):
                utils.remove(f)

        utils.makedirs(out_path)

        utils.cmake(os.path.join(env.root_path, 'cmake-build'),
                    ctx.target_path, False)
        # utils.strip(out_file)

        for f in out_files:
            if os.path.exists(f):
                utils.ensure_file_exists(f)
예제 #6
0
    def _build_libuv(self, file_name):
        if not self._download_libuv(file_name):
            return
        cc.n('prepare libuv source code...', end='')
        if not os.path.exists(self.LIBUV_PATH_SRC):
            os.system('unzip "{}/{}" -d "{}"'.format(PATH_DOWNLOAD, file_name,
                                                     self.PATH_TMP))

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

        # we need following...
        # brew install automake libtool

        old_p = os.getcwd()
        os.chdir(self.LIBUV_PATH_SRC)
        os.system('sh autogen.sh')
        os.system('./configure --prefix={} --with-pic'.format(
            self.PATH_RELEASE))
        os.system('make')
        os.system('make install')
        os.chdir(old_p)

        rm = [
            'libuv.la', 'libuv.dylib', 'libuv.so.1', 'libuv.so',
            'libuv.so.1.0.0'
        ]
        for i in rm:
            _path = os.path.join(self.PATH_RELEASE, 'lib', i)
            if os.path.exists(_path):
                utils.remove(_path)
예제 #7
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 pysbase folder...')
        utils.makedirs(self.base_path)

        cc.v('copy python core dll...')
        _exec_path = os.path.dirname(env.py_exec)
        # _win_system_path = os.path.join(os.getenv('SystemRoot'), 'system32')
        # if ctx.bits == BITS_32 and ctx.host_os_is_win_x64:
        #     _win_system_path = os.path.join(os.getenv('SystemRoot'), 'SysWOW64')

        if not os.path.exists(_exec_path):
            raise RuntimeError('can not locate python folder at:', _exec_path)

        pydll = self._get_py_dll_name()
        shutil.copy(os.path.join(_exec_path, pydll), os.path.join(self.base_path, pydll))

        if ctx.py_ver == '34':
            msvcrdll = 'msvcr100.dll'
        elif ctx.py_ver == '37':
            msvcrdll = 'vcruntime140.dll'
        else:
            raise RuntimeError('unknown msvc runtime for this python version.')
        shutil.copy(os.path.join(_exec_path, msvcrdll), os.path.join(self.base_path, msvcrdll))

        super()._copy_modules()
예제 #8
0
 def fix_output(self):
     # remove .so files, otherwise will link to .so but not .a in default.
     # rm = ['libsqlite3.la', 'libsqlite3.so.0', 'libsqlite3.so', 'libsqlite3.so.0.8.6', 'libuv.la', 'libuv.so.1', 'libuv.so', 'libuv.so.1.0.0']
     rm = ['libuv.la', 'libuv.dylib', 'libuv.so.1', 'libuv.so', 'libuv.so.1.0.0']
     for i in rm:
         _path = os.path.join(self.PATH_RELEASE, 'lib', i)
         if os.path.exists(_path):
             utils.remove(_path)
예제 #9
0
 def _remove_py_cache(self, path):
     for parent, dir_list, _ in os.walk(path):
         for d in dir_list:
             d = d.lower()
             if d == '__pycache__':
                 utils.remove(os.path.join(parent, d))
                 continue
             self._remove_py_cache(os.path.join(parent, d))
예제 #10
0
 def _remove_py_cache(self, path):
     for parent, dir_list, _ in os.walk(path):
         for d in dir_list:
             d = d.lower()
             if d == '__pycache__':
                 utils.remove(os.path.join(parent, d))
                 continue
             self._remove_py_cache(os.path.join(parent, d))
예제 #11
0
 def build_exe(self):
     cc.i('build tp_assist...')
     sln_file = os.path.join(env.root_path, 'client', 'tp_assist_win', 'tp_assist.vs2015.sln')
     out_file = os.path.join(env.root_path, 'out', 'client', ctx.bits_path, ctx.target_path, 'tp_assist.exe')
     if os.path.exists(out_file):
         utils.remove(out_file)
     utils.msvc_build(sln_file, 'tp_assist', ctx.target_path, ctx.bits_path, False)
     utils.ensure_file_exists(out_file)
예제 #12
0
 def fix_output(self):
     # remove .so files, otherwise will link to .so but not .a in default.
     # rm = ['libsqlite3.la', 'libsqlite3.so.0', 'libsqlite3.so', 'libsqlite3.so.0.8.6', 'libuv.la', 'libuv.so.1', 'libuv.so', 'libuv.so.1.0.0']
     rm = ['libuv.la', 'libuv.so.1', 'libuv.so', 'libuv.so.1.0.0']
     for i in rm:
         _path = os.path.join(self.PATH_RELEASE, 'lib', i)
         if os.path.exists(_path):
             utils.remove(_path)
예제 #13
0
 def build_player(self):
     cc.i('build tp-player...')
     prj_path = os.path.join(env.root_path, 'client', 'tp-player')
     out_file = os.path.join(env.root_path, 'out', 'client', ctx.bits_path, ctx.target_path, 'tp-player.exe')
     if os.path.exists(out_file):
         utils.remove(out_file)
     utils.qt_build(prj_path, 'tp-player', ctx.bits_path, ctx.target_path)
     utils.ensure_file_exists(out_file)
예제 #14
0
 def build_exe(self):
     cc.i('build tp_assist...')
     sln_file = os.path.join(env.root_path, 'client', 'tp_assist_win', 'tp_assist.vs2017.sln')
     out_file = os.path.join(env.root_path, 'out', 'client', ctx.bits_path, ctx.target_path, 'tp_assist.exe')
     if os.path.exists(out_file):
         utils.remove(out_file)
     utils.msvc_build(sln_file, 'tp_assist', ctx.target_path, ctx.bits_path, False)
     utils.ensure_file_exists(out_file)
예제 #15
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'))
예제 #16
0
    def build_installer(self):
        cc.i('make tp_assist dmg file...')

        json_file = os.path.join(env.root_path, 'dist', 'client', 'macos', 'dmg.json')
        dmg_file = os.path.join(env.root_path, 'out', 'client', 'macos', '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)
예제 #17
0
    def build_exe(self):
        cc.i('build tp_assist...')

        configuration = ctx.target_path.capitalize()

        proj_file = os.path.join(env.root_path, 'client', 'tp_assist_macos', 'TP-Assist.xcodeproj')
        out_file = os.path.join(env.root_path, 'client', 'tp_assist_macos', 'build', configuration, 'TP-Assist.app')
        if os.path.exists(out_file):
            utils.remove(out_file)
        utils.xcode_build(proj_file, 'TP-Assist', configuration, False)
        utils.ensure_file_exists(os.path.join(out_file, 'Contents', 'Info.plist'))
예제 #18
0
    def build_player(self):
        cc.i('build tp-player...')
        prj_path = os.path.join(env.root_path, 'client', 'tp-player')
        out_file = os.path.join(env.root_path, 'out', 'client', ctx.bits_path, ctx.target_path, 'tp-player.app')
        if os.path.exists(out_file):
            utils.remove(out_file)
        utils.qt_build(prj_path, 'tp-player', ctx.bits_path, ctx.target_path)
        utils.ensure_file_exists(os.path.join(out_file, 'Contents', 'Info.plist'))

        # for deployment
        utils.qt_deploy(out_file)
예제 #19
0
    def build_exe(self):
        cc.i('build tp_assist...')

        configuration = ctx.target_path.capitalize()

        proj_file = os.path.join(env.root_path, 'client', 'tp_assist_macos', 'tp_assist.xcodeproj')
        out_file = os.path.join(env.root_path, 'client', 'tp_assist_macos', 'build', ctx.target_path, 'tp_assist.app')
        if os.path.exists(out_file):
            utils.remove(out_file)
        utils.xcode_build(proj_file, 'tp_assist', configuration, False)
        utils.ensure_file_exists(os.path.join(out_file, 'Contents', 'Info.plist'))
예제 #20
0
    def build_installer(self):
        cc.i('build assist package for website...')

        name = 'teleport-assist-{}'.format(VER_TELEPORT_ASSIST)

        out_path = os.path.join(env.root_path, 'out', 'installer')
        utils.makedirs(out_path)

        out_file = os.path.join(out_path, '{}.exe'.format(name))
        utils.remove(out_file)

        self._build_installer()

        utils.ensure_file_exists(out_file)
예제 #21
0
    def build_installer(self):
        cc.i('build assist installer...')

        name = 'teleport-assist-{}-{}'.format(ctx.dist, VER_TP_ASSIST)

        out_path = os.path.join(env.root_path, 'out', 'installer')
        utils.makedirs(out_path)

        out_file = os.path.join(out_path, '{}.exe'.format(name))
        utils.remove(out_file)

        self._build_installer()

        utils.ensure_file_exists(out_file)
예제 #22
0
    def _make_python_zip(self):
        cc.n('make python.zip...')

        out_file = os.path.join(self.base_path, 'python.zip')
        if os.path.exists(out_file):
            utils.remove(out_file)

        _tmp_ = os.path.join(self.base_path, '_tmp_')
        if os.path.exists(_tmp_):
            cc.v('clear up temp folder...')
            utils.remove(_tmp_)

        cc.v('copying Python `Lib` folder...')
        shutil.copytree(self.py_lib_path, _tmp_)

        cc.v('remove useless folders and files...')
        for i in self.py_lib_remove:
            utils.remove(_tmp_, i)

        cc.v('compile .py to .pyc...')
        makepyo.make(_tmp_)

        cc.v('compress into python.zip...')
        utils.make_zip(_tmp_, out_file, from_parent=False)
        utils.ensure_file_exists(out_file)

        cc.v('remove temp folder...')
        utils.remove(_tmp_)
예제 #23
0
    def _make_python_zip(self):
        cc.n('make python.zip...')

        out_file = os.path.join(self.base_path, 'python.zip')
        if os.path.exists(out_file):
            utils.remove(out_file)

        _tmp_ = os.path.join(self.base_path, '_tmp_')
        if os.path.exists(_tmp_):
            cc.v('clear up temp folder...')
            utils.remove(_tmp_)

        cc.v('copying Python `Lib` folder...')
        shutil.copytree(self.py_lib_path, _tmp_)

        cc.v('remove useless folders and files...')
        for i in self.py_lib_remove:
            utils.remove(_tmp_, i)

        cc.v('compile .py to .pyc...')
        makepyo.make(_tmp_)

        cc.v('compress into python.zip...')
        utils.make_zip(_tmp_, out_file, from_parent=False)
        utils.ensure_file_exists(out_file)

        cc.v('remove temp folder...')
        utils.remove(_tmp_)
예제 #24
0
    def build_installer(self):
        cc.i('build assist installer...')

        name = 'teleport-assist-{}-{}'.format(ctx.dist, VER_TP_ASSIST)

        out_path = os.path.join(env.root_path, 'out', 'installer')
        utils.makedirs(out_path)

        out_file = os.path.join(out_path, '{}.exe'.format(name))
        utils.remove(out_file)

        self._build_installer()

        utils.ensure_file_exists(out_file)
예제 #25
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)
예제 #26
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)
예제 #27
0
    def build_server(self):
        cc.n('build web server ...')
        # notice: now we can not build debug version of tp_web.exe
        if ctx.target_path == 'debug':
            cc.w('cannot build debug version of tp_web, skip.')
        else:
            sln_file = os.path.join(env.root_path, 'server', 'tp_web', 'src', 'tp_web.vs2017.sln')
            out_file = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, ctx.target_path, 'tp_web.exe')
            if os.path.exists(out_file):
                utils.remove(out_file)
            utils.msvc_build(sln_file, 'tp_web', ctx.target_path, ctx.bits_path, False)
            utils.ensure_file_exists(out_file)

        cc.n('build core server ...')
        sln_file = os.path.join(env.root_path, 'server', 'tp_core', 'core', 'tp_core.vs2017.sln')
        out_file = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, ctx.target_path, 'tp_core.exe')
        if os.path.exists(out_file):
            utils.remove(out_file)
        utils.msvc_build(sln_file, 'tp_core', ctx.target_path, ctx.bits_path, False)
        utils.ensure_file_exists(out_file)

        cc.n('build SSH protocol ...')
        sln_file = os.path.join(env.root_path, 'server', 'tp_core', 'protocol', 'ssh', 'tpssh.vs2017.sln')
        out_file = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, ctx.target_path, 'tpssh.dll')
        if os.path.exists(out_file):
            utils.remove(out_file)
        utils.msvc_build(sln_file, 'tpssh', ctx.target_path, ctx.bits_path, False)
        utils.ensure_file_exists(out_file)
        utils.copy_file(os.path.join(env.root_path, 'external', 'libssh', 'lib', ctx.target_path), os.path.join(env.root_path, 'out', 'server', ctx.bits_path, ctx.target_path), 'ssh.dll')

        cc.n('build TELNET protocol ...')
        sln_file = os.path.join(env.root_path, 'server', 'tp_core', 'protocol', 'telnet', 'tptelnet.vs2017.sln')
        out_file = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, ctx.target_path, 'tptelnet.dll')
        if os.path.exists(out_file):
            utils.remove(out_file)
        utils.msvc_build(sln_file, 'tptelnet', ctx.target_path, ctx.bits_path, False)
        utils.ensure_file_exists(out_file)

        if with_rdp:
            cc.n('build RDP protocol ...')
            sln_file = os.path.join(env.root_path, 'server', 'tp_core', 'protocol', 'rdp', 'tprdp.vs2017.sln')
            out_file = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, ctx.target_path, 'tprdp.dll')
            if os.path.exists(out_file):
                utils.remove(out_file)
            utils.msvc_build(sln_file, 'tprdp', ctx.target_path, ctx.bits_path, False)
            utils.ensure_file_exists(out_file)
예제 #28
0
    def build_server(self):
        cc.n('build web server ...')
        # notice: now we can not build debug version of tp_web.exe
        if ctx.target_path == 'debug':
            cc.w('cannot build debug version of tp_web, skip.')
        else:
            sln_file = os.path.join(env.root_path, 'server', 'tp_web', 'src',
                                    'tp_web.vs2015.sln')
            out_file = os.path.join(env.root_path, 'out', 'server',
                                    ctx.bits_path, ctx.target_path,
                                    'tp_web.exe')
            if os.path.exists(out_file):
                utils.remove(out_file)
            utils.msvc_build(sln_file, 'tp_web', ctx.target_path,
                             ctx.bits_path, False)
            utils.ensure_file_exists(out_file)

        cc.n('build core server ...')
        sln_file = os.path.join(env.root_path, 'server', 'tp_core', 'core',
                                'tp_core.vs2015.sln')
        out_file = os.path.join(env.root_path, 'out', 'server', ctx.bits_path,
                                ctx.target_path, 'tp_core.exe')
        if os.path.exists(out_file):
            utils.remove(out_file)
        utils.msvc_build(sln_file, 'tp_core', ctx.target_path, ctx.bits_path,
                         False)
        utils.ensure_file_exists(out_file)

        cc.n('build SSH protocol ...')
        sln_file = os.path.join(env.root_path, 'server', 'tp_core', 'protocol',
                                'ssh', 'tpssh.vs2015.sln')
        out_file = os.path.join(env.root_path, 'out', 'server', ctx.bits_path,
                                ctx.target_path, 'tpssh.dll')
        if os.path.exists(out_file):
            utils.remove(out_file)
        utils.msvc_build(sln_file, 'tpssh', ctx.target_path, ctx.bits_path,
                         False)
        utils.ensure_file_exists(out_file)

        if os.path.exists(
                os.path.join(env.root_path, 'server', 'tp_core', 'protocol',
                             'ssh', 'tpssh.vs2015.sln')):
            cc.n('build RDP protocol ...')
            sln_file = os.path.join(env.root_path, 'server', 'tp_core',
                                    'protocol', 'rdp', 'tprdp.vs2015.sln')
            out_file = os.path.join(env.root_path, 'out', 'server',
                                    ctx.bits_path, ctx.target_path,
                                    'tprdp.dll')
            if os.path.exists(out_file):
                utils.remove(out_file)
            utils.msvc_build(sln_file, 'tprdp', ctx.target_path, ctx.bits_path,
                             False)
            utils.ensure_file_exists(out_file)
예제 #29
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)
예제 #30
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)
예제 #31
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'))
예제 #32
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)
예제 #33
0
    def build_server(self):
        cc.n('build server app (tp_core/libtpssh/libtelnet/librdp/tp_web)...')

        out_path = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, 'bin')
        out_files = list()
        out_files.append(os.path.join(out_path, 'tp_core'))
        out_files.append(os.path.join(out_path, 'tp_web'))
        out_files.append(os.path.join(out_path, 'libtpssh.so'))
        out_files.append(os.path.join(out_path, 'libtptelnet.so'))
        if with_rdp:
            out_files.append(os.path.join(out_path, 'libtprdp.so'))

        for f in out_files:
            if os.path.exists(f):
                utils.remove(f)

        utils.makedirs(out_path)

        utils.cmake(os.path.join(env.root_path, 'cmake-build'), ctx.target_path, False)
        # utils.strip(out_file)

        for f in out_files:
            if os.path.exists(f):
                utils.ensure_file_exists(f)
예제 #34
0
파일: main.py 프로젝트: eomsoft/teleport
    def _delete_files(self, del_settings):
        utils.remove(os.path.join(self._install_path, 'bin'))
        utils.remove(os.path.join(self._install_path, 'www'))
        if del_settings:
            utils.remove(self._data_path)
            # utils.remove(self._config_path)
            # utils.remove(self._log_path)

            # only remove the installation path when it empty.
            try:
                os.rmdir(self._install_path)
            except OSError:
                pass
예제 #35
0
파일: main.py 프로젝트: zydudu/teleport
    def _delete_files(self, del_settings):
        utils.remove(os.path.join(self._install_path, 'bin'))
        utils.remove(os.path.join(self._install_path, 'www'))
        if del_settings:
            utils.remove(self._data_path)
            # utils.remove(self._config_path)
            # utils.remove(self._log_path)

            # only remove the installation path when it empty.
            try:
                os.rmdir(self._install_path)
            except OSError:
                pass
예제 #36
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)
예제 #37
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)
예제 #38
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)
예제 #39
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'))
예제 #40
0
파일: main.py 프로젝트: eomsoft/teleport
    def _delete_files(self, del_settings):
        utils.remove(os.path.join(self._install_path, 'bin'))
        utils.remove(os.path.join(self._install_path, 'www'))

        utils.remove(os.path.join(self._install_path, 'start.sh'))
        utils.remove(os.path.join(self._install_path, 'stop.sh'))
        utils.remove(os.path.join(self._install_path, 'status.sh'))

        # only remove the installation path when it empty.
        try:
            os.rmdir(self._install_path)
        except OSError:
            pass  # maybe the install path not empty.

        if del_settings:
            utils.remove(self._data_path)
예제 #41
0
파일: main.py 프로젝트: eomsoft/teleport
 def _uninstall_service(self):
     # old version, the daemon named `eom_ts`.
     utils.remove('/etc/init.d/eom_ts')
     utils.remove('/etc/rc2.d/S50eom_ts')
     utils.remove('/etc/rc3.d/S50eom_ts')
     utils.remove('/etc/rc4.d/S50eom_ts')
     utils.remove('/etc/rc5.d/S50eom_ts')
     # from 2.0.0.1, the daemon rename to `teleport`.
     utils.remove('/etc/init.d/teleport')
     utils.remove('/etc/rc2.d/S50teleport')
     utils.remove('/etc/rc3.d/S50teleport')
     utils.remove('/etc/rc4.d/S50teleport')
     utils.remove('/etc/rc5.d/S50teleport')
     # from 3.0.0.3, the start order changed from 50 to 95 for MySQL compatible, because start order of MySQL is 64.
     utils.remove('/etc/rc2.d/S95teleport')
     utils.remove('/etc/rc3.d/S95teleport')
     utils.remove('/etc/rc4.d/S95teleport')
     utils.remove('/etc/rc5.d/S95teleport')
예제 #42
0
파일: main.py 프로젝트: stlcours/teleport-1
 def _uninstall_service(self):
     # old version, the daemon named `eom_ts`.
     utils.remove('/etc/init.d/eom_ts')
     utils.remove('/etc/rc2.d/S50eom_ts')
     utils.remove('/etc/rc3.d/S50eom_ts')
     utils.remove('/etc/rc4.d/S50eom_ts')
     utils.remove('/etc/rc5.d/S50eom_ts')
     # from 2.0.0.1, the daemon rename to `teleport`.
     utils.remove('/etc/init.d/teleport')
     utils.remove('/etc/rc2.d/S50teleport')
     utils.remove('/etc/rc3.d/S50teleport')
     utils.remove('/etc/rc4.d/S50teleport')
     utils.remove('/etc/rc5.d/S50teleport')
예제 #43
0
파일: main.py 프로젝트: zydudu/teleport
    def _delete_files(self, del_settings):
        utils.remove(os.path.join(self._install_path, 'bin'))
        utils.remove(os.path.join(self._install_path, 'www'))

        utils.remove(os.path.join(self._install_path, 'start.sh'))
        utils.remove(os.path.join(self._install_path, 'stop.sh'))
        utils.remove(os.path.join(self._install_path, 'status.sh'))

        # only remove the installation path when it empty.
        try:
            os.rmdir(self._install_path)
        except OSError:
            pass  # maybe the install path not empty.

        if del_settings:
            utils.remove(self._data_path)
예제 #44
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)
예제 #45
0
파일: main.py 프로젝트: zydudu/teleport
 def _uninstall_service(self):
     # old version, the daemon named `eom_ts`.
     utils.remove('/etc/init.d/eom_ts')
     utils.remove('/etc/rc2.d/S50eom_ts')
     utils.remove('/etc/rc3.d/S50eom_ts')
     utils.remove('/etc/rc4.d/S50eom_ts')
     utils.remove('/etc/rc5.d/S50eom_ts')
     # from 2.0.0.1, the daemon rename to `teleport`.
     utils.remove('/etc/init.d/teleport')
     utils.remove('/etc/rc2.d/S50teleport')
     utils.remove('/etc/rc3.d/S50teleport')
     utils.remove('/etc/rc4.d/S50teleport')
     utils.remove('/etc/rc5.d/S50teleport')
     # from 3.0.0.3, the start order changed from 50 to 95 for MySQL compatible, because start order of MySQL is 64.
     utils.remove('/etc/rc2.d/S95teleport')
     utils.remove('/etc/rc3.d/S95teleport')
     utils.remove('/etc/rc4.d/S95teleport')
     utils.remove('/etc/rc5.d/S95teleport')