0%

Termux使用小记

termux使用小记

1.使用rclone挂载网盘

  • 1.1安装rclone
1
pkg install rclone
  • 1.2授权(以 onedrive 为例)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
rclone authorize "onedrive"
会出现以下信息:
2018/01/23 20:28:56 NOTICE: Config file "C:\\Users\\Administrator\\.config\\rclo

ne\\rclone.conf" not found - using defaults

Choose OneDrive account type?

* Say b for a OneDrive business account

* Say p for a personal OneDrive account

b) Business

p) Personal

b/p> p #这里选择个人版,你想挂载Business就选择b

If your browser doesn't open automatically go to the following link: http://127.

0.0.1:53682/auth #接下来会弹出浏览器,要求你登录账号进行授权

Log in and authorize rclone for access

Waiting for code...

Got code

Paste the following into your remote machine --->

{"access_token":"xxxx"} #请复制{xx}整个内容,后面需要用到

<---End paste

第三步:配置(链接网盘,以 onedrive 为例)展开目录

rclone config

会出现以下信息:

n) New remote

s) Set configuration password

q) Quit config

n/s/q> n

name> Rats #随便填,后面要用到

Type of storage to configure.

Choose a number from below, or type in your own value

1 / Amazon Drive

\ "amazon cloud drive"

2 / Amazon S3 (also Dreamhost, Ceph, Minio)

\ "s3"

3 / Backblaze B2

\ "b2"

4 / Box

\ "box"

5 / Cache a remote

\ "cache"

6 / Dropbox

\ "dropbox"

7 / Encrypt/Decrypt a remote

\ "crypt"

8 / FTP Connection

\ "ftp"

9 / Google Cloud Storage (this is not Google Drive)

\ "google cloud storage"

10 / Google Drive

\ "drive"

11 / Hubic

\ "hubic"

12 / Local Disk

\ "local"

13 / Microsoft Azure Blob Storage

\ "azureblob"

14 / Microsoft OneDrive

\ "onedrive"

15 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)

\ "swift"

16 / Pcloud

\ "pcloud"

17 / QingCloud Object Storage

\ "qingstor"

18 / SSH/SFTP Connection

\ "sftp"

19 / Webdav

\ "webdav"

20 / Yandex Disk

\ "yandex"

21 / http Connection

\ "http"

Storage> 14 #选择14,Microsoft OneDrive

Microsoft App Client Id - leave blank normally.

client_id> #留空

Microsoft App Client Secret - leave blank normally.

client_secret> #留空

Remote config

Choose OneDrive account type?

* Say b for a OneDrive business account

* Say p for a personal OneDrive account

b) Business

p) Personal

b/p> p #这里选择个人版,你想挂载Business就选择b

Use auto config?

* Say Y if not sure

* Say N if you are working on a remote or headless machine

y) Yes

n) No

y/n> n #选择n

For this to work, you will need rclone available on a machine that has a web browser available.

Execute the following on your machine:

rclone authorize "onedrive"

Then paste the result below:

result> {"access_token":""} #输入之前在客户端授权的内容

--------------------

[Rats]

client_id =

client_secret =

token = {"access_token":""}

--------------------

y) Yes this is OK

e) Edit this remote

d) Delete this remote

y/e/d> y # 选择y

Current remotes:

Name Type

==== ====

Rats onedrive

e) Edit existing remote

n) New remote

d) Delete remote

r) Rename remote

c) Copy remote

s) Set configuration password

q) Quit config

e/n/d/r/c/s/q> q #选择q退出

2.onedrive挂载

  • 2.1 用magisk manager 安装rclone模块
  • 2.2 在/data/data/com.termux/files/home/.config/rclone路径下把rclone.conf文件移动到/sdcard/.rclone/目录里,没有就手动创建。然后在.rclone里新建.global.param文件填入
    1
    2
    NETCHK_ADDR=baidu.com     #如果不想把网盘挂载到内置储存目录就不用复制下面的了
    CACHEMODE=minimal BINDSD=1 ADD_PARAMS=--fast-list --allow-non-empty HTTP=0 FTP=0
    ps:再空格一行,保存并退出(这里是重点,圈起来,要考)
  • 2.3新建.*.params文件填入
    1
    BUFFERSIZE=0 CACHEMAXSIZE=1G CACHEINFOAGE=30m DIRCACHETIME=1h ATTRTIMEOUT=30s READAHEAD=128k CACHEMODE=off DISABLE=0 READONLY=0 BINDSD=1 BINDPOINT= ADD_PARAMS= REPLACE_PARAMS=
  • 2.4Termux执行挂载命令:
    1
    输入su 回车获取让termux获取root权限 再运行 /sbin/rclone remount 等待命令运行完成即可。 默认是挂载在 /mnt/cloud/ , /sd/cloud/(内存目录)和/storage/cloud/目录下

    参考资料

    https://www.muabl.cn/1494.html