forked from buhonghao/Redpill_CustomBuild
-
Notifications
You must be signed in to change notification settings - Fork 0
321 lines (274 loc) · 14.9 KB
/
exts.yml
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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
#
# Copyright (C) 2022 Ing <https://github.com/wjz304>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#
name: Get Exts and Loads
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
exts:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main
- name: Initialization environment
run : |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
sudo timedatectl set-timezone "Asia/Shanghai"
- name: Checkout rp-ext s
run: |
sudo rm -rf rp-ext_pocopico
git clone https://github.com/pocopico/rp-ext rp-ext_pocopico
# 容错
rm -f rp-ext_pocopico/asix/releases/ds3617xs_42218.json
rm -f rp-ext_pocopico/ax88179_178a/releases/ds3617xs_42218.json
rm -f rp-ext_pocopico/dm9601/releases/ds3617xs_42218.json
rm -f rp-ext_pocopico/nct6775/releases/dva3221_42218.json
rm -f rp-ext_pocopico/sfc/releases/ds918p_25556.json
rm -f rp-ext_pocopico/v9fs/releases/ds918p_42218.json
#igc 临时对策
rm -rf rp-ext_pocopico/igc
svn co https://github.com/jim3ma/synology-igc/trunk/igc rp-ext_pocopico/igc
sudo rm -rf rp-ext_wjz304
git clone https://github.com/wjz304/rp-ext rp-ext_wjz304
# 容错
rm -f rp-ext_wjz304/asix/releases/ds3617xs_42218.json
rm -f rp-ext_wjz304/ax88179_178a/releases/ds3617xs_42218.json
rm -f rp-ext_wjz304/dm9601/releases/ds3617xs_42218.json
rm -f rp-ext_wjz304/nct6775/releases/dva3221_42218.json
rm -f rp-ext_wjz304/sfc/releases/ds918p_25556.json
rm -f rp-ext_wjz304/v9fs/releases/ds918p_42218.json
#igc 临时对策
rm -rf rp-ext_wjz304/igc
svn co https://github.com/jim3ma/synology-igc/trunk/igc rp-ext_wjz304/igc
- name: Get exts lsit
shell: python
run: |
# -*- coding: utf-8 -*-
import os, json, hashlib
root = '' # os.path.dirname(os.path.abspath(__file__))
def getjsonfile(file):
data = None
if os.path.isfile(file):
try:
with open(file, 'r') as f:
data = json.load(f)
except Exception as err:
print(err)
return data
def sha256sum(file):
sha256 = ''
if os.path.isfile(file):
with open(file, "rb") as f:
sha256=hashlib.sha256(f.read()).hexdigest()
return sha256
def pathstrsub(exp, reglist=[]):
ret = exp
try:
for re in reglist:
ret = ret.replace(re[0], re[1])
except Exception as err:
print(err)
return ret
def getextslist(work = 'rp-ext', reglist=[]):
exts = {}
try:
jext = 'rpext-index.json'
extdirs = os.listdir(os.path.join(root, work))
extdirs.sort()
print(extdirs)
for extdir in extdirs:
if extdir.startswith('.') or extdir.startswith('redpill'):
continue
if os.path.isdir(os.path.join(root, work, extdir)):
data_index = getjsonfile(os.path.join(root, work, extdir, jext))
if data_index != None:
try:
keys = data_index["releases"].keys()
for key in keys:
suffix = ''
data_releases = getjsonfile(os.path.join(root, work, pathstrsub(data_index["releases"][key], reglist)))
if data_releases != None:
if "files" in data_releases:
for file in data_releases["files"]:
sha256_online = file["sha256"]
sha256_local = sha256sum(os.path.join(root, work, pathstrsub( file["url"], reglist)))
if sha256_online != sha256_local:
suffix = '#'
print('file: {} -- key: {} -- error: {} -- really: {}'.format(pathstrsub(data_index["releases"][key], reglist), pathstrsub(file["url"], reglist), sha256_online, sha256_local))
else:
suffix = '*'
print('file: {} -- may not exists'.format(pathstrsub(data_index["releases"][key], reglist)))
if key in exts.keys():
exts[key][extdir + suffix] = data_index["info"]["description"]
else:
exts[key] = { extdir + suffix: data_index["info"]["description"]}
except Exception as err:
print(err)
except Exception as err:
print(err)
return exts
def getlkmslist(work = 'rp-ext', reglist=[]):
lkms = {}
try:
jext = 'rpext-index.json'
extdirs = os.listdir(os.path.join(root, work))
extdirs.sort()
print(extdirs)
for extdir in extdirs:
if not extdir.startswith('redpill') or '-' in extdir:
continue
if os.path.isdir(os.path.join(root, work, extdir)):
data_index = getjsonfile(os.path.join(root, work, extdir, jext))
if data_index != None:
try:
keys = data_index["releases"].keys()
for key in keys:
suffix = ''
data_releases = getjsonfile(os.path.join(root, work, pathstrsub(data_index["releases"][key], reglist)))
if data_releases != None:
if "files" in data_releases:
for file in data_releases["files"]:
sha256_online = file["sha256"]
sha256_local = sha256sum(os.path.join(root, work, pathstrsub( file["url"], reglist)))
if sha256_online != sha256_local:
suffix = '#'
print('file: {} -- key: {} -- error: {} -- really: {}'.format(pathstrsub(data_index["releases"][key], reglist), pathstrsub(file["url"], reglist), sha256_online, sha256_local))
else:
suffix = '*'
print('file: {} -- may not exists'.format(pathstrsub(data_index["releases"][key], reglist)))
if key in lkms.keys():
lkms[key][extdir + suffix] = data_index["info"]["description"]
else:
lkms[key] = { extdir + suffix: data_index["info"]["description"]}
except Exception as err:
print(err)
except Exception as err:
print(err)
return lkms
if __name__ == '__main__':
exts = {}
lkms = {}
print('####################### pocopico #######################')
reglist=[]
reglist.append(['https://raw.githubusercontent.com/pocopico/rp-ext/master/',''])
reglist.append(['https://github.com/pocopico/rp-ext/raw/main/',''])
reglist.append(['https://github.com/pocopico/rp-ext/blob/main/',''])
reglist.append(['https://raw.githubusercontent.com/jim3ma/synology-igc/master/',''])
exts["pocopico"] = getextslist('rp-ext_pocopico', reglist)
lkms["pocopico"] = getlkmslist('rp-ext_pocopico', reglist)
print('####################### wjz304 #######################')
reglist=[]
reglist.append(['https://raw.githubusercontent.com/wjz304/rp-ext/master/',''])
reglist.append(['https://raw.githubusercontent.com/jim3ma/synology-igc/master/',''])
exts["wjz304"] = getextslist('rp-ext_wjz304', reglist)
lkms["wjz304"] = getlkmslist('rp-ext_wjz304', reglist)
if len(exts) > 0:
print('####################### exts #######################')
print(json.dumps(exts, indent=4))
with open(os.path.join(root, 'exts.json'), 'w', encoding='utf-8') as f:
f.write(json.dumps(exts, indent=4))
if len(lkms) > 0:
print('####################### lkms #######################')
print(json.dumps(lkms, indent=4))
with open(os.path.join(root, 'lkms.json'), 'w', encoding='utf-8') as f:
f.write(json.dumps(lkms, indent=4))
- name: Check and Push
run: |
if [ -n "$(git status -s | grep -E 'exts.json|lkms.json')" ]; then
git add $(git status -s | grep -E 'exts.json|lkms.json' | awk '{printf " %s", $2}')
git commit -m "update $(date +%Y-%m-%d" "%H:%M:%S)"
git push -f
fi
loads:
runs-on: ubuntu-latest
needs: exts
steps:
- name: Checkout
uses: actions/checkout@main
- name: Initialization environment
run : |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
sudo timedatectl set-timezone "Asia/Shanghai"
- name: Checkout redpill-load s
run: |
sudo rm -rf redpill-load_pocopico_develop
git clone --branch develop https://github.com/pocopico/redpill-load.git redpill-load_pocopico_develop
sudo rm -rf redpill-load_pocopico_jun
git clone --branch jun https://github.com/pocopico/redpill-load.git redpill-load_pocopico_jun
sudo rm -rf redpill-load_jumkey_develop
git clone --branch develop https://github.com/jumkey/redpill-load.git redpill-load_jumkey_develop
sudo rm -rf redpill-load_PeterSuh-Q3_master
git clone --branch master https://github.com/PeterSuh-Q3/redpill-load.git redpill-load_PeterSuh-Q3_master
sudo rm -rf redpill-load_wjz304_test-dev
git clone --branch test-dev https://github.com/wjz304/redpill-load.git redpill-load_wjz304_test-dev
sudo rm -rf redpill-load_wjz304_test-jun
git clone --branch test-jun https://github.com/wjz304/redpill-load.git redpill-load_wjz304_test-jun
- name: Get loads lsit
shell: python
run: |
# -*- coding: utf-8 -*-
import os, json
root = '' # os.path.dirname(os.path.abspath(__file__))
def getloadlist(work = 'redpill-load', ignore=[]):
load = {}
try:
lkms = {}
with open('lkms.json', mode="r") as f:
lkms = json.loads(f.read())['wjz304'] # 暂时只匹配自己
platforms = os.listdir(os.path.join(root, work, 'config'))
platforms.sort()
print(platforms)
for platform in platforms:
if platform.startswith('.') or platform.startswith('_'):
continue
if os.path.isdir(os.path.join(root, work, 'config', platform)):
versions = os.listdir(os.path.join(root, work, 'config', platform))
versions.sort()
print(versions)
for version in versions:
if version in ignore:
continue
if os.path.exists(os.path.join(root, work, 'config', platform, version, 'config.json')):
key = platform.replace('+', 'p').lower() + '_' + version.split('-')[-1]
if key in lkms:
if not all(item.endswith('*') or item.endswith('#') for item in lkms[key]):
if platform not in load:
load[platform] = []
load[platform].append(version)
except Exception as err:
print(err)
return load
if __name__ == '__main__':
loads = {}
ignore=['7.0-41222', '7.0-41890', '7.1.0-42550', '7.1.0-42621', '7.1.1-42951']
print('################### pocopico_develop ###################')
loads["pocopico_develop"] = getloadlist('redpill-load_pocopico_develop', ignore)
print('##################### pocopico_jun #####################')
loads["pocopico_jun"] = getloadlist('redpill-load_pocopico_jun', ignore)
print('#################### jumkey_develop ####################')
loads["jumkey_develop"] = getloadlist('redpill-load_jumkey_develop', ignore)
print('################## PeterSuh-Q3_master ##################')
loads["PeterSuh-Q3_master"] = getloadlist('redpill-load_PeterSuh-Q3_master', ignore)
print('################## wjz304_test-dev ##################')
loads["wjz304_test-dev"] = getloadlist('redpill-load_wjz304_test-dev', ignore)
print('################## wjz304_test-jun ##################')
loads["wjz304_test-jun"] = getloadlist('redpill-load_wjz304_test-jun', ignore)
if len(loads) > 0:
print('####################### loads #######################')
print(json.dumps(loads, indent=4))
with open(os.path.join(root, 'loads.json'), 'w', encoding='utf-8') as f:
f.write(json.dumps(loads, indent=4))
- name: Check and Push
run: |
if [ -n "$(git status -s | grep loads.json)" ]; then
git add loads.json
git commit -m "update $(date +%Y-%m-%d" "%H:%M:%S)"
git push -f
fi