bcmd 0.6.12__tar.gz → 0.6.14__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of bcmd might be problematic. Click here for more details.
- {bcmd-0.6.12 → bcmd-0.6.14}/PKG-INFO +1 -1
- bcmd-0.6.14/bcmd/common/secret.py +69 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd/tasks/__init__.py +1 -1
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd/tasks/docs.py +4 -1
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd/tasks/proxy.py +15 -6
- bcmd-0.6.14/bcmd/tasks/wslProxy.py +59 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd.egg-info/PKG-INFO +1 -1
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd.egg-info/SOURCES.txt +2 -2
- {bcmd-0.6.12 → bcmd-0.6.14}/pyproject.toml +1 -1
- bcmd-0.6.12/bcmd/common/secret.py +0 -51
- bcmd-0.6.12/bcmd/tasks/debian.py +0 -78
- {bcmd-0.6.12 → bcmd-0.6.14}/MANIFEST.in +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/README.md +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd/__init__.py +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd/common/__init__.py +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd/common/func.py +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd/resources/project/main.py +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd/tasks/bin.py +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd/tasks/code.py +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd/tasks/crypto.py +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd/tasks/download.py +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd/tasks/image.py +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd/tasks/json.py +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd/tasks/lib.py +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd/tasks/math.py +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd/tasks/mirror.py +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd/tasks/pdf.py +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd/tasks/time.py +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd/tasks/upgrade.py +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd/tasks/wasabi.py +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd/utils/__init__.py +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd/utils/utils.py +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd.egg-info/dependency_links.txt +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd.egg-info/entry_points.txt +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd.egg-info/requires.txt +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/bcmd.egg-info/top_level.txt +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/setup.cfg +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/test/__init__.py +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/test/conftest.py +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/test/test_pdf.py +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/test/test_proxy.py +0 -0
- {bcmd-0.6.12 → bcmd-0.6.14}/test/test_wasabi.py +0 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import tkinter as tk
|
|
2
|
+
from tkinter import messagebox
|
|
3
|
+
from typing import Any, TypedDict
|
|
4
|
+
|
|
5
|
+
from async_lru import alru_cache
|
|
6
|
+
from beni import bcrypto, btask
|
|
7
|
+
from beni.bform import BForm
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class PypiSecret(TypedDict):
|
|
11
|
+
username: str
|
|
12
|
+
password: str
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@alru_cache
|
|
16
|
+
async def getPypi(value: str = '') -> PypiSecret:
|
|
17
|
+
return _getData(
|
|
18
|
+
'请输入 PYPI 密钥信息',
|
|
19
|
+
value or 'QbuF2mV/lqovtF5dskZGD7qHknYbNuF2QseWRtWxLZTPrC/jL1tcxV8JEKaRjLsu46PxJZ7zepJwggnUTIWnEAoV5VtgP2/hbuzxxHha8817kR5c65H9fXm8eOal7DYXsUoGPQMnm59UWNXUKjmIaP4sn9nySFlRYqa8sEZSbYQ4N0NL35Dpj1e3wyQxJ+7h2jwKAz50Hh8G4yAM3/js9+NUe4ymts+UXcwsP3ADIBMkzjnFc0lEYg2d+fw0A74XWCvoZPoGqHZR/THUOVNAYxoGgDzP4SPIk1XsmtpxvfO/DpJd/Cg/0fB3MYagGKI1+m6Bxqhvd1I/lf0YbM5y4E4=',
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class QiniuSecret(TypedDict):
|
|
24
|
+
bucket: str
|
|
25
|
+
baseUrl: str
|
|
26
|
+
ak: str
|
|
27
|
+
sk: str
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@alru_cache
|
|
31
|
+
async def getQiniu(value: str = '') -> QiniuSecret:
|
|
32
|
+
return _getData(
|
|
33
|
+
'请输入 七牛云 密钥信息',
|
|
34
|
+
value or 'vNroFKeKklrdcJ89suFm+iyuJsq/cyUB5+QWoeeiMc/J0oSLF9cg5rqbK1IRxF0cCQ8KmkQQhdVa+PI6kuTBhoSH6IviVTylzAOrJywEccz9jWkJkW28Y9Vo4ePZmfWf/j7wdxNB144z234KD8IxJn4lR2A0L9JN5kk1o1/hpcydXL74FNtt03lYL/E3WVcvpUfw37mri2HMYOfUw81dRwW35/hMuQjtq1BBrKrIsSKTHH44tROMcgyvt+Qy292AtDBcsYiZxBKhQtBFPMq/vUs=',
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _getData(title: str, content: str) -> Any:
|
|
39
|
+
|
|
40
|
+
class PasswordForm(BForm):
|
|
41
|
+
result: dict[str, Any] = {}
|
|
42
|
+
|
|
43
|
+
def __init__(self):
|
|
44
|
+
super().__init__(title=title)
|
|
45
|
+
self.passwordVar = tk.StringVar(value='')
|
|
46
|
+
ary = content.split(' ')
|
|
47
|
+
if len(ary) > 1:
|
|
48
|
+
self.addLabel('提示', ary[0])
|
|
49
|
+
self.addEntry('密码', self.passwordVar, width=30, password=True, focus=True, command=self.onBtn)
|
|
50
|
+
self.addBtn('确定', self.onBtn)
|
|
51
|
+
|
|
52
|
+
def onBtn(self):
|
|
53
|
+
try:
|
|
54
|
+
self.result.update(
|
|
55
|
+
bcrypto.decryptJson(content, self.passwordVar.get())
|
|
56
|
+
)
|
|
57
|
+
self.destroy()
|
|
58
|
+
except:
|
|
59
|
+
messagebox.showerror('密码错误', '密码错误,请重新输入')
|
|
60
|
+
|
|
61
|
+
def getResult(self):
|
|
62
|
+
return self.result
|
|
63
|
+
|
|
64
|
+
result = PasswordForm().run()
|
|
65
|
+
|
|
66
|
+
if result is None:
|
|
67
|
+
btask.abort('用户取消操作')
|
|
68
|
+
else:
|
|
69
|
+
return result
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
from . import bin
|
|
3
3
|
from . import code
|
|
4
4
|
from . import crypto
|
|
5
|
-
from . import debian
|
|
6
5
|
from . import docs
|
|
7
6
|
from . import download
|
|
8
7
|
from . import image
|
|
@@ -15,3 +14,4 @@ from . import proxy
|
|
|
15
14
|
from . import time
|
|
16
15
|
from . import upgrade
|
|
17
16
|
from . import wasabi
|
|
17
|
+
from . import wslProxy
|
|
@@ -98,7 +98,10 @@ async def userInput():
|
|
|
98
98
|
def getResult(self):
|
|
99
99
|
return self.varIsUpload.get(), self.varPassword.get()
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
result = BuildForm().run()
|
|
102
|
+
if not result:
|
|
103
|
+
btask.abort('用户取消操作')
|
|
104
|
+
isUpload, password = result
|
|
102
105
|
|
|
103
106
|
# 配置里面每个字段都尝试解密(实际效率较低但不影响使用)
|
|
104
107
|
for k, v in conf.items():
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import platform
|
|
3
2
|
from typing import Final
|
|
4
3
|
|
|
5
4
|
import psutil
|
|
@@ -25,10 +24,14 @@ async def proxy(
|
|
|
25
24
|
template = ''
|
|
26
25
|
|
|
27
26
|
# 针对不同的终端使用不同的模板
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
match platform.system():
|
|
28
|
+
case 'Windows':
|
|
29
|
+
if 'cmd.exe' in processNameAry:
|
|
30
|
+
template = cmdTemplate
|
|
31
|
+
elif set(['powershell.exe', 'pwsh.exe']) & set(processNameAry):
|
|
32
|
+
template = powerShellTemplate
|
|
33
|
+
case 'Linux':
|
|
34
|
+
template = linuxShellTemplate
|
|
32
35
|
|
|
33
36
|
btask.assertTrue(template, f'不支持当前终端({processNameAry})')
|
|
34
37
|
lineAry = textToAry(template.format(port))
|
|
@@ -54,3 +57,9 @@ powerShellTemplate = '''
|
|
|
54
57
|
$env:https_proxy="http://localhost:{0}"
|
|
55
58
|
$env:all_proxy="http://localhost:{0}"
|
|
56
59
|
'''
|
|
60
|
+
|
|
61
|
+
linuxShellTemplate = '''
|
|
62
|
+
export http_proxy="http://localhost:{0}"
|
|
63
|
+
export https_proxy="http://localhost:{0}"
|
|
64
|
+
export all_proxy="http://localhost:{0}"
|
|
65
|
+
'''
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
from typing import Final
|
|
2
|
+
|
|
3
|
+
import pyperclip
|
|
4
|
+
import typer
|
|
5
|
+
from beni import bcolor, btask
|
|
6
|
+
from beni.bfunc import syncCall, textToAry
|
|
7
|
+
|
|
8
|
+
app: Final = btask.newSubApp('WSL2 代理服务')
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@app.command()
|
|
12
|
+
@syncCall
|
|
13
|
+
async def linux(
|
|
14
|
+
port: int = typer.Argument(15236, help="代理服务器端口"),
|
|
15
|
+
):
|
|
16
|
+
'生成终端设置代理服务器的命令'
|
|
17
|
+
ip = "$(ip route | grep default | awk '{print $3}')"
|
|
18
|
+
lineAry = textToAry(f'''
|
|
19
|
+
export HTTP_PROXY=http://{ip}):{port}
|
|
20
|
+
export HTTPS_PROXY=http://{ip}):{port}
|
|
21
|
+
export ALL_PROXY=http://{ip}):{port}
|
|
22
|
+
curl https://google.com.hk
|
|
23
|
+
''')
|
|
24
|
+
msg = '\r\n' + '\n'.join(lineAry) + '\n'
|
|
25
|
+
pyperclip.copy(msg.strip() + '\n')
|
|
26
|
+
bcolor.printMagenta(msg)
|
|
27
|
+
bcolor.printYellow('已复制,可直接粘贴使用')
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@app.command()
|
|
31
|
+
@syncCall
|
|
32
|
+
async def windows(
|
|
33
|
+
port: int = typer.Argument(15236, help="代理服务器端口"),
|
|
34
|
+
off: bool = typer.Option(False, '--off', help='关闭代理'),
|
|
35
|
+
):
|
|
36
|
+
'设置防火墙以及端口转发'
|
|
37
|
+
|
|
38
|
+
firewallName = 'Allow Veee from WSL'
|
|
39
|
+
|
|
40
|
+
if not off:
|
|
41
|
+
template = f'''
|
|
42
|
+
New-NetFirewallRule -DisplayName "{firewallName}" -Direction Inbound -Action Allow -Protocol TCP -LocalPort {port} -RemoteAddress 172.0.0.0/8 -Profile Any
|
|
43
|
+
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport={port} connectaddress=127.0.0.1 connectport={port}
|
|
44
|
+
netstat -ano | findstr :{port} | findstr 0.0.0.0
|
|
45
|
+
'''
|
|
46
|
+
else:
|
|
47
|
+
template = f'''
|
|
48
|
+
netsh interface portproxy delete v4tov4 listenaddress=0.0.0.0 listenport={port}
|
|
49
|
+
Remove-NetFirewallRule -DisplayName "{firewallName}"
|
|
50
|
+
'''
|
|
51
|
+
lineAry = textToAry(template)
|
|
52
|
+
msg = '\r\n' + '\n'.join(lineAry) + '\n'
|
|
53
|
+
pyperclip.copy(msg.strip() + '\n')
|
|
54
|
+
bcolor.printMagenta(msg)
|
|
55
|
+
if not off:
|
|
56
|
+
bcolor.printYellow('开启防火墙以及端口转发')
|
|
57
|
+
else:
|
|
58
|
+
bcolor.printYellow('关闭防火墙以及端口转发')
|
|
59
|
+
bcolor.printYellow('已复制,可直接粘贴使用')
|
|
@@ -10,7 +10,6 @@ pyproject.toml
|
|
|
10
10
|
./bcmd/tasks/bin.py
|
|
11
11
|
./bcmd/tasks/code.py
|
|
12
12
|
./bcmd/tasks/crypto.py
|
|
13
|
-
./bcmd/tasks/debian.py
|
|
14
13
|
./bcmd/tasks/docs.py
|
|
15
14
|
./bcmd/tasks/download.py
|
|
16
15
|
./bcmd/tasks/image.py
|
|
@@ -23,6 +22,7 @@ pyproject.toml
|
|
|
23
22
|
./bcmd/tasks/time.py
|
|
24
23
|
./bcmd/tasks/upgrade.py
|
|
25
24
|
./bcmd/tasks/wasabi.py
|
|
25
|
+
./bcmd/tasks/wslProxy.py
|
|
26
26
|
./bcmd/utils/__init__.py
|
|
27
27
|
./bcmd/utils/utils.py
|
|
28
28
|
./test/__init__.py
|
|
@@ -45,7 +45,6 @@ bcmd/tasks/__init__.py
|
|
|
45
45
|
bcmd/tasks/bin.py
|
|
46
46
|
bcmd/tasks/code.py
|
|
47
47
|
bcmd/tasks/crypto.py
|
|
48
|
-
bcmd/tasks/debian.py
|
|
49
48
|
bcmd/tasks/docs.py
|
|
50
49
|
bcmd/tasks/download.py
|
|
51
50
|
bcmd/tasks/image.py
|
|
@@ -58,5 +57,6 @@ bcmd/tasks/proxy.py
|
|
|
58
57
|
bcmd/tasks/time.py
|
|
59
58
|
bcmd/tasks/upgrade.py
|
|
60
59
|
bcmd/tasks/wasabi.py
|
|
60
|
+
bcmd/tasks/wslProxy.py
|
|
61
61
|
bcmd/utils/__init__.py
|
|
62
62
|
bcmd/utils/utils.py
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import getpass
|
|
2
|
-
from typing import Any, TypedDict, cast
|
|
3
|
-
|
|
4
|
-
from async_lru import alru_cache
|
|
5
|
-
from beni import bcrypto, btask
|
|
6
|
-
from beni.bcolor import printRed
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class PypiSecret(TypedDict):
|
|
10
|
-
username: str
|
|
11
|
-
password: str
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@alru_cache
|
|
15
|
-
async def getPypi(value: str = '') -> PypiSecret:
|
|
16
|
-
return cast(
|
|
17
|
-
Any,
|
|
18
|
-
_getData(value or 'QbuF2mV/lqovtF5dskZGD7qHknYbNuF2QseWRtWxLZTPrC/jL1tcxV8JEKaRjLsu46PxJZ7zepJwggnUTIWnEAoV5VtgP2/hbuzxxHha8817kR5c65H9fXm8eOal7DYXsUoGPQMnm59UWNXUKjmIaP4sn9nySFlRYqa8sEZSbYQ4N0NL35Dpj1e3wyQxJ+7h2jwKAz50Hh8G4yAM3/js9+NUe4ymts+UXcwsP3ADIBMkzjnFc0lEYg2d+fw0A74XWCvoZPoGqHZR/THUOVNAYxoGgDzP4SPIk1XsmtpxvfO/DpJd/Cg/0fB3MYagGKI1+m6Bxqhvd1I/lf0YbM5y4E4='),
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class QiniuSecret(TypedDict):
|
|
23
|
-
bucket: str
|
|
24
|
-
baseUrl: str
|
|
25
|
-
ak: str
|
|
26
|
-
sk: str
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
@alru_cache
|
|
30
|
-
async def getQiniu(value: str = '') -> QiniuSecret:
|
|
31
|
-
return cast(
|
|
32
|
-
Any,
|
|
33
|
-
_getData(value or 'vNroFKeKklrdcJ89suFm+iyuJsq/cyUB5+QWoeeiMc/J0oSLF9cg5rqbK1IRxF0cCQ8KmkQQhdVa+PI6kuTBhoSH6IviVTylzAOrJywEccz9jWkJkW28Y9Vo4ePZmfWf/j7wdxNB144z234KD8IxJn4lR2A0L9JN5kk1o1/hpcydXL74FNtt03lYL/E3WVcvpUfw37mri2HMYOfUw81dRwW35/hMuQjtq1BBrKrIsSKTHH44tROMcgyvt+Qy292AtDBcsYiZxBKhQtBFPMq/vUs='),
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
def _getData(content: str) -> dict[str, Any]:
|
|
38
|
-
index = content.find(' ')
|
|
39
|
-
if index > -1:
|
|
40
|
-
tips = f'请输入密码({content[:index]}):'
|
|
41
|
-
else:
|
|
42
|
-
tips = '请输入密码:'
|
|
43
|
-
while True:
|
|
44
|
-
try:
|
|
45
|
-
pwd = getpass.getpass(tips)
|
|
46
|
-
return bcrypto.decryptJson(content, pwd)
|
|
47
|
-
except KeyboardInterrupt:
|
|
48
|
-
print('')
|
|
49
|
-
btask.abort('用户操作取消')
|
|
50
|
-
except BaseException:
|
|
51
|
-
printRed('密码错误')
|
bcmd-0.6.12/bcmd/tasks/debian.py
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
from typing import Final
|
|
3
|
-
|
|
4
|
-
from beni import bcolor, bfile, bpath, btask, binput
|
|
5
|
-
from beni.bfunc import syncCall
|
|
6
|
-
|
|
7
|
-
app: Final = btask.newSubApp('Debian 系统管理')
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
@app.command()
|
|
11
|
-
@syncCall
|
|
12
|
-
async def install_python():
|
|
13
|
-
'安装python脚本'
|
|
14
|
-
pythonZipFile = ''
|
|
15
|
-
pythonName = ''
|
|
16
|
-
pythonVersion = ''
|
|
17
|
-
bcolor.printYellow(f'官网地址:https://www.python.org/downloads/source/')
|
|
18
|
-
bcolor.printYellow(f'先从官网上下载 python 源码压缩包(.tar.xz)')
|
|
19
|
-
while True:
|
|
20
|
-
pythonZipFile = input('输入python压缩文件名(如:Python-3.12.1.tar.xz):').strip()
|
|
21
|
-
if pythonZipFile.endswith('.tar.xz'):
|
|
22
|
-
pythonName = pythonZipFile.replace('.tar.xz', '')
|
|
23
|
-
pythonVersion = '.'.join(pythonName.split('-')[-1].split('.')[:-1])
|
|
24
|
-
break
|
|
25
|
-
else:
|
|
26
|
-
print('输入有误,请重新输入')
|
|
27
|
-
cmdList: list[str] = [
|
|
28
|
-
f'apt update',
|
|
29
|
-
f'apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev libbz2-dev -y',
|
|
30
|
-
f'tar -xf {pythonZipFile}',
|
|
31
|
-
f'cd {pythonName}',
|
|
32
|
-
f'./configure --enable-optimizations', # 配置编译选项
|
|
33
|
-
f'make -j `nproc`', # 编译源代码,`nproc` 会利用所有可用的 CPU 核心加快编译速度
|
|
34
|
-
f'make altinstall', # 安装 Python,altinstall 避免替换默认的 python 命令
|
|
35
|
-
f'cd ..',
|
|
36
|
-
f'rm -rf {pythonName}',
|
|
37
|
-
f'rm -rf /usr/local/bin/python',
|
|
38
|
-
f'ln -s /usr/local/bin/python{pythonVersion} /usr/local/bin/python',
|
|
39
|
-
f'rm -rf /usr/local/bin/pip',
|
|
40
|
-
f'ln -s /usr/local/bin/pip{pythonVersion} /usr/local/bin/pip',
|
|
41
|
-
f'python --version',
|
|
42
|
-
f'pip --version',
|
|
43
|
-
f'pip install pipx',
|
|
44
|
-
f'pipx install bcmd',
|
|
45
|
-
]
|
|
46
|
-
shFile = bpath.desktop(f'install-python-{pythonName}.sh')
|
|
47
|
-
await bfile.writeText(shFile, '\n'.join(cmdList))
|
|
48
|
-
bcolor.printGreen(f'将以下两个文件拷贝到服务器上,然后执行 sh {shFile.name} 即可安装 python')
|
|
49
|
-
print(pythonZipFile)
|
|
50
|
-
print(shFile)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
@app.command()
|
|
54
|
-
@syncCall
|
|
55
|
-
async def install_software():
|
|
56
|
-
'安装常用软件'
|
|
57
|
-
await binput.confirm('即将安装这些软件(7z nginx mariadb),是否确认?')
|
|
58
|
-
cmdList: list[str] = [
|
|
59
|
-
f'echo 更新软件包列表',
|
|
60
|
-
f'apt update',
|
|
61
|
-
f'echo 安装 7z',
|
|
62
|
-
f'apt install p7zip-full -y',
|
|
63
|
-
f'echo 安装 nginx',
|
|
64
|
-
f'apt install nginx -y',
|
|
65
|
-
f'systemctl start nginx',
|
|
66
|
-
f'systemctl enable nginx',
|
|
67
|
-
f'systemctl status nginx',
|
|
68
|
-
f'echo 安装 MariaDB',
|
|
69
|
-
f'apt install mariadb-server -y',
|
|
70
|
-
f'systemctl start mariadb',
|
|
71
|
-
f'systemctl enable mariadb',
|
|
72
|
-
f"sed -i 's/bind-address/# bind-address/' /etc/mysql/mariadb.conf.d/50-server.cnf"
|
|
73
|
-
f'systemctl restart mariadb',
|
|
74
|
-
f'systemctl status mariadb',
|
|
75
|
-
|
|
76
|
-
]
|
|
77
|
-
for cmd in cmdList:
|
|
78
|
-
os.system(cmd)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|