-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtermux.py
47 lines (39 loc) · 1.38 KB
/
termux.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python3
from ast import Not
import os
# 启用 termux 的两行键盘
termux_config_path = "~/.termux"
termux_stat = os.stat(termux_config_path)
if not os.path.exists(termux_config_path):
os.mkdir("./termux")
file = open(termux_config_path+"/termux.properties", mode='a')
key='''
extra-keys = [['ESC','/','-','HOME','UP','END','PGUP'],['TAB','CTRL','ALT','LEFT','DOWN','RIGHT','PGDN']]
echo "bell-character = ignore
'''
file.write(key)
file.close()
# 安装一些软件,可以根据情况进行筛选
cmd = "pkg install -y openssh cowsay ffmpeg zsh wget curl build-essential cmake python termux-tools termux-api"
os.system(cmd)
# 更新启动标语
cmd = "cowsay Don't do anything stupid > /data/data/com.termux/files/usr/etc/motd"
os.system(cmd)
# 启用内部存储
cmd = "termux-setup-storage"
os.system(cmd)
# 安装 youtube-dl
cmd_list = [
'pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple',
'pip install youtube-dl'
]
for cmd in cmd_list:
os.system(cmd)
# 安装 oh-my-zsh
cmd_list = [
'sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"',
'git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/plugins/zsh-syntax-highlighting',
"sed -i 's/plugins=(git)/plugins=(git zsh-syntax-highlighting)/g' ~/.zshrc"
]
for cmd in cmd_list:
os.system(cmd)