|
@ -210,28 +210,27 @@ XProxy 容器默认不自带 WireGuard 功能,需要额外安装 `wireguard-to |
|
|
#!/usr/bin/env python3 |
|
|
#!/usr/bin/env python3 |
|
|
# -*- coding: utf-8 -*- |
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
|
|
|
import os |
|
|
Alpine = '3.17' |
|
|
import re |
|
|
|
|
|
import sys |
|
|
|
|
|
|
|
|
|
|
|
alpine = '3.16' |
|
|
import os, re, sys |
|
|
|
|
|
|
|
|
if len(sys.argv) != 2: |
|
|
pkgName = sys.argv[1] |
|
|
print('Invalid argument') |
|
|
workDir = os.path.join(os.path.dirname(os.path.realpath(__file__)), pkgName) |
|
|
sys.exit(1) |
|
|
|
|
|
|
|
|
|
|
|
workDir = os.path.join(os.path.dirname(os.path.realpath(__file__)), sys.argv[1]) |
|
|
rawOutput = os.popen(' '.join([ |
|
|
|
|
|
'docker run --rm -w /tmp -v %s:/tmp' % workDir, |
|
|
output = os.popen(' '.join([ |
|
|
'alpine:%s' % Alpine, 'sh -c "apk update && apk fetch -R %s"' % pkgName |
|
|
'docker', 'run', '--rm', '-it', '-v', '%s:/pkg' % workDir, '-w', '/pkg', |
|
|
|
|
|
'alpine:%s' % alpine, 'sh', '-c', '\'apk update && apk fetch -R %s\'' % sys.argv[1] |
|
|
|
|
|
])).read() |
|
|
])).read() |
|
|
print("%(line)s\n%(msg)s%(line)s" % {'line': '=' * 88, 'msg': output}) |
|
|
|
|
|
|
|
|
print("%s\n%s%s" % ('=' * 88, rawOutput, '=' * 88), file = sys.stderr) |
|
|
|
|
|
|
|
|
with open(os.path.join(workDir, 'setup'), 'w') as script: |
|
|
with open(os.path.join(workDir, 'setup'), 'w') as script: |
|
|
script.write("#!/usr/bin/env sh\ncd \"$(dirname \"$0\")\"\napk add " + ' '.join([ |
|
|
setupCmd = '#!/usr/bin/env sh\ncd "$(dirname "$0")" && apk add --no-network --quiet ' |
|
|
s + '.apk' for s in re.findall(r'Downloading (\S+)', output) |
|
|
setupCmd += ' '.join([ |
|
|
]) + " --no-network --quiet\n") |
|
|
'%s.apk' % x for x in re.findall(r'Downloading (\S+)', rawOutput) |
|
|
|
|
|
]) |
|
|
|
|
|
script.write(setupCmd) |
|
|
|
|
|
|
|
|
os.system('chmod +x %s' % os.path.join(workDir, 'setup')) |
|
|
os.system('chmod +x %s' % os.path.join(workDir, 'setup')) |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
@ -241,7 +240,6 @@ $ cd /etc/scutweb |
|
|
$ mkdir -p ./toolset && cd ./toolset |
|
|
$ mkdir -p ./toolset && cd ./toolset |
|
|
$ python3 fetch.py wireguard-tools # 拉取wireguard-tools依赖 |
|
|
$ python3 fetch.py wireguard-tools # 拉取wireguard-tools依赖 |
|
|
··· |
|
|
··· |
|
|
··· |
|
|
|
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
拉取成功后将生成 `wireguard-tools` 文件夹,包含多个依赖的 `.apk` 安装包与 `setup` 安装脚本。 |
|
|
拉取成功后将生成 `wireguard-tools` 文件夹,包含多个依赖的 `.apk` 安装包与 `setup` 安装脚本。 |
|
|