Skip to content

Commit

Permalink
替换打包过程中的证书更新方式
Browse files Browse the repository at this point in the history
相同的命令就 travis 里面报错,估计旧版 curl 中某些关键数据是硬编码没法改
  • Loading branch information
SeaHOH committed Jan 9, 2022
1 parent 6d3bae5 commit 22a3dc5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
5 changes: 1 addition & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@ script:
- export PYTHON_VERSION=3.9.9
- export PYTHON_IMPL_VERSION=cp39
- export RELEASE_VERSION=$(grep -oP '[0-9\.ab]+' local/__init__.py)
- export CA_MOZILLA=./cert/cacerts/mozilla.pem
- export CA_GOOGLE=./cert/cacerts/google.pem

before_deploy:
- curl -L --cacert ${CA_MOZILLA} -o ${CA_MOZILLA} https://curl.se/ca/cacert.pem
- curl -L --cacert ${CA_GOOGLE} -o ${CA_GOOGLE} https://pki.goog/roots.pem
- python launcher/updatecas.py -u -d --all
- python launcher/buildipdb.py -u -d --17mon
- python launcher/builddomains.py -u -d --felix

Expand Down
34 changes: 32 additions & 2 deletions launcher/updatecas.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,40 @@ def update(*dss):
logger = getlogger(is_main)

if is_main:
if len(sys.argv) < 2:
print('使用 "--help" 可查看命令行参数说明\n')
if '--help' in sys.argv:
print('''
用法:
--help 显示此使用提示
-u 下载的证书文件不放入脚本目录而是更新到相邻的 data 目录
交互模式下参数 "-u" 无效
指定可用数据源,交互模式中无效
--all 更新所有证书数据源
指定数据源并配合以下参数时不会进入交互模式,适用于自动/无人职守模式
-d 跳过代理设置使用直连,使用参数 "-p" 时参数 "-d" 无效
-p 主机名(IP 或域名):端口
非交互模式使用 HTTP 代理,无效地址或无法链接代理时会直接结束脚本
''')

if parse_set_proxy(int('--all' in sys.argv)) is None:
for ds in (ds_GOOGLE, ds_MOZILLA):
if '-u' not in sys.argv:
ds.path = os.path.basename(ds.path)
_update(ds)
sys.exit(0)

import copy
parse_set_proxy(0)
while True:
cwd = select_path(0, 1)
if '-u' in sys.argv:
cwd = 0
else:
cwd = select_path(0, 1)
if cwd is None:
continue
dss = copy.deepcopy((ds_GOOGLE, ds_MOZILLA))
Expand Down

0 comments on commit 22a3dc5

Please sign in to comment.