mirror of
https://github.com/RROrg/rr.git
synced 2025-06-21 05:51:05 +08:00
remove vmdk
This commit is contained in:
parent
66f05d8215
commit
e365ddcf5b
12
.github/workflows/main.yml
vendored
12
.github/workflows/main.yml
vendored
@ -161,16 +161,16 @@ jobs:
|
|||||||
echo "Building..."
|
echo "Building..."
|
||||||
make BR2_EXTERNAL=../external
|
make BR2_EXTERNAL=../external
|
||||||
cd -
|
cd -
|
||||||
qemu-img convert -O vmdk arpl.img arpl-dyn.vmdk
|
# qemu-img convert -O vmdk arpl.img arpl-dyn.vmdk
|
||||||
qemu-img convert -O vmdk -o adapter_type=lsilogic arpl.img -o subformat=monolithicFlat arpl.vmdk
|
# qemu-img convert -O vmdk -o adapter_type=lsilogic arpl.img -o subformat=monolithicFlat arpl.vmdk
|
||||||
|
|
||||||
# Zip image and generate checksum
|
# Zip image and generate checksum
|
||||||
- name: Pack
|
- name: Pack
|
||||||
run: |
|
run: |
|
||||||
if [ -n "${{ env.VERSION }}" ]; then
|
if [ -n "${{ env.VERSION }}" ]; then
|
||||||
zip -9 "arpl-i18n-${{ env.VERSION }}.img.zip" arpl.img
|
zip -9 "arpl-i18n-${{ env.VERSION }}.img.zip" arpl.img
|
||||||
zip -9 "arpl-i18n-${{ env.VERSION }}.vmdk-dyn.zip" arpl-dyn.vmdk
|
# zip -9 "arpl-i18n-${{ env.VERSION }}.vmdk-dyn.zip" arpl-dyn.vmdk
|
||||||
zip -9 "arpl-i18n-${{ env.VERSION }}.vmdk-flat.zip" arpl.vmdk arpl-flat.vmdk
|
# zip -9 "arpl-i18n-${{ env.VERSION }}.vmdk-flat.zip" arpl.vmdk arpl-flat.vmdk
|
||||||
else
|
else
|
||||||
zip -9 "arpl-i18n.img.zip" arpl.img
|
zip -9 "arpl-i18n.img.zip" arpl.img
|
||||||
fi
|
fi
|
||||||
@ -209,6 +209,6 @@ jobs:
|
|||||||
prerelease: ${{ inputs.prerelease }}
|
prerelease: ${{ inputs.prerelease }}
|
||||||
files: |
|
files: |
|
||||||
arpl-i18n-${{ env.VERSION }}.img.zip
|
arpl-i18n-${{ env.VERSION }}.img.zip
|
||||||
arpl-i18n-${{ env.VERSION }}.vmdk-dyn.zip
|
# arpl-i18n-${{ env.VERSION }}.vmdk-dyn.zip
|
||||||
arpl-i18n-${{ env.VERSION }}.vmdk-flat.zip
|
# arpl-i18n-${{ env.VERSION }}.vmdk-flat.zip
|
||||||
update.zip
|
update.zip
|
||||||
|
60
.github/workflows/update.yml
vendored
60
.github/workflows/update.yml
vendored
@ -1,60 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (C) 2022 Ing <https://github.com/wjz304>
|
|
||||||
#
|
|
||||||
# This is free software, licensed under the MIT License.
|
|
||||||
# See /LICENSE for more information.
|
|
||||||
#
|
|
||||||
|
|
||||||
name: Update
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
push:
|
|
||||||
description: 'push'
|
|
||||||
default: false
|
|
||||||
type: boolean
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
configs:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@main
|
|
||||||
|
|
||||||
- name: Set up Python 3
|
|
||||||
uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: '3.10'
|
|
||||||
|
|
||||||
- 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"
|
|
||||||
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install -y libxml2-utils
|
|
||||||
pip install requests BeautifulSoup4 pyyaml
|
|
||||||
|
|
||||||
- name: update pats
|
|
||||||
run: |
|
|
||||||
python rssupdate.py
|
|
||||||
|
|
||||||
- name: Upload artifact
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: configs
|
|
||||||
path: |
|
|
||||||
files/board/arpl/overlayfs/opt/arpl/model-configs
|
|
||||||
|
|
||||||
- name: Check and Push
|
|
||||||
if: success() && inputs.push == true
|
|
||||||
run: |
|
|
||||||
git pull
|
|
||||||
status=$(git status -s | grep -E 'model-configs' | awk '{printf " %s", $2}')
|
|
||||||
if [ -n "${status}" ]; then
|
|
||||||
git add ${status}
|
|
||||||
git commit -m "update $(date +%Y-%m-%d" "%H:%M:%S)"
|
|
||||||
git push -f
|
|
||||||
fi
|
|
161
rssupdate.py
161
rssupdate.py
@ -1,161 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Copyright (C) 2022 Ing <https://github.com/wjz304>
|
|
||||||
#
|
|
||||||
# This is free software, licensed under the MIT License.
|
|
||||||
# See /LICENSE for more information.
|
|
||||||
#
|
|
||||||
|
|
||||||
import os, re, sys, subprocess, hashlib, requests, json, yaml
|
|
||||||
from urllib.parse import urlparse
|
|
||||||
from bs4 import BeautifulSoup
|
|
||||||
|
|
||||||
FILE_PATH = os.path.dirname(os.path.abspath(__file__))
|
|
||||||
|
|
||||||
headers = {
|
|
||||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3",
|
|
||||||
"Referer": "https://archive.synology.com/download/Os/DSM/",
|
|
||||||
"Accept-Language": "en-US,en;q=0.5",
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def fullversion(ver):
|
|
||||||
out = ver
|
|
||||||
arr = ver.split("-")
|
|
||||||
if len(arr) > 0:
|
|
||||||
a = arr[0].split(".")[0] if len(arr[0].split(".")) > 0 else "0"
|
|
||||||
b = arr[0].split(".")[1] if len(arr[0].split(".")) > 1 else "0"
|
|
||||||
c = arr[0].split(".")[2] if len(arr[0].split(".")) > 2 else "0"
|
|
||||||
d = arr[1] if len(arr) > 1 else "00000"
|
|
||||||
e = arr[2] if len(arr) > 2 else "0"
|
|
||||||
out = "{}.{}.{}-{}-{}".format(a, b, c, d, e)
|
|
||||||
return out
|
|
||||||
|
|
||||||
|
|
||||||
def md5sum(file):
|
|
||||||
md5Obj = ""
|
|
||||||
if os.path.isfile(file):
|
|
||||||
with open(file, "rb") as f:
|
|
||||||
md5Obj = hashlib.md5(f.read()).hexdigest()
|
|
||||||
return md5Obj
|
|
||||||
|
|
||||||
|
|
||||||
def getPATmd5sum(url):
|
|
||||||
filename = os.path.basename(url)
|
|
||||||
os.remove(filename)
|
|
||||||
# req = requests.get(url.replace(urlparse(url).netloc, 'cndl.synology.cn'))
|
|
||||||
req = requests.get(url)
|
|
||||||
with open(filename, "wb") as f:
|
|
||||||
f.write(req.content)
|
|
||||||
md5 = md5sum(filename)
|
|
||||||
os.remove(filename)
|
|
||||||
return md5
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
# Get models
|
|
||||||
models = []
|
|
||||||
|
|
||||||
configs = "files/board/arpl/overlayfs/opt/arpl/model-configs"
|
|
||||||
|
|
||||||
for filename in os.listdir(os.path.join(FILE_PATH, configs)):
|
|
||||||
if ".yml" in filename: # filename.endswith(".yml"):
|
|
||||||
models.append(filename.split(".yml")[0])
|
|
||||||
|
|
||||||
print(models)
|
|
||||||
|
|
||||||
pats = {}
|
|
||||||
|
|
||||||
# # Get beta pats
|
|
||||||
# # 临时对策, RC 64551 目前并没有在 archive.synology.com 上线, beta 又为 64216, 临时用 64216 的地址进行替换.
|
|
||||||
# req = requests.get('https://prerelease.synology.com/webapi/models?event=dsm72_beta', headers=headers)
|
|
||||||
# rels = json.loads(req.text)
|
|
||||||
# if "models" in rels and len(rels["models"]) > 0:
|
|
||||||
# for i in rels["models"]:
|
|
||||||
# if "name" not in i or "dsm" not in i: continue
|
|
||||||
# if i["name"] not in models: continue
|
|
||||||
# if i["name"] not in pats.keys(): pats[i["name"]]={}
|
|
||||||
# pats[i["name"]][fullversion(i["dsm"]["version"]).replace('64216','64551')] = i["dsm"]["url"].split('?')[0].replace('beta','release').replace('64216','64551')
|
|
||||||
|
|
||||||
req = requests.get("https://archive.synology.com/download/Os/DSM", headers=headers)
|
|
||||||
req.encoding = "utf-8"
|
|
||||||
bs = BeautifulSoup(req.text, "html.parser")
|
|
||||||
p = re.compile(r"(.*?)-(.*?)", re.MULTILINE | re.DOTALL)
|
|
||||||
l = bs.find_all("a", string=p)
|
|
||||||
for i in l:
|
|
||||||
ver = i.attrs["href"].split("/")[-1]
|
|
||||||
if not any([ver.startswith("6.2.4"), ver.startswith("7")]):
|
|
||||||
continue
|
|
||||||
req = requests.get(
|
|
||||||
"https://archive.synology.com{}".format(i.attrs["href"]), headers=headers
|
|
||||||
)
|
|
||||||
req.encoding = "utf-8"
|
|
||||||
bs = BeautifulSoup(req.text, "html.parser")
|
|
||||||
p = re.compile(r"^(.*?)_(.*?)_(.*?).pat$", re.MULTILINE | re.DOTALL)
|
|
||||||
data = bs.find_all("a", string=p)
|
|
||||||
for item in data:
|
|
||||||
p = re.compile(r"DSM_(.*?)_(.*?).pat", re.MULTILINE | re.DOTALL)
|
|
||||||
rels = p.search(item.attrs["href"])
|
|
||||||
if rels != None:
|
|
||||||
info = p.search(item.attrs["href"]).groups()
|
|
||||||
model = info[0].replace("%2B", "+")
|
|
||||||
if model not in models:
|
|
||||||
continue
|
|
||||||
if model not in pats.keys():
|
|
||||||
pats[model] = {}
|
|
||||||
pats[model][fullversion(ver)] = item.attrs["href"]
|
|
||||||
|
|
||||||
print(json.dumps(pats, indent=4))
|
|
||||||
|
|
||||||
for filename in os.listdir(os.path.join(FILE_PATH, configs)):
|
|
||||||
if ".yml" not in filename: # filename.endswith(".yml"):
|
|
||||||
continue
|
|
||||||
model = filename.split(".yml")[0]
|
|
||||||
|
|
||||||
data = ""
|
|
||||||
with open(
|
|
||||||
os.path.join(FILE_PATH, configs, filename), "r", encoding="utf-8"
|
|
||||||
) as f:
|
|
||||||
data = yaml.load(f, Loader=yaml.BaseLoader)
|
|
||||||
try:
|
|
||||||
isChange = False
|
|
||||||
for ver in data["builds"].keys():
|
|
||||||
tmp, url = "0.0.0-00000-0", ""
|
|
||||||
for item in pats[model].keys():
|
|
||||||
if str(ver) not in item:
|
|
||||||
continue
|
|
||||||
if item > tmp:
|
|
||||||
tmp, url = item, pats[model][item]
|
|
||||||
if url != "":
|
|
||||||
print("[I] {} get md5sum ...".format(url))
|
|
||||||
md5 = getPATmd5sum(url)
|
|
||||||
if md5 == "":
|
|
||||||
print("[E] {} get md5sum error".format(url))
|
|
||||||
return
|
|
||||||
|
|
||||||
isChange = True
|
|
||||||
# config.yml
|
|
||||||
# data["builds"][ver]["pat"] = hashdata # pyyaml 会修改文件格式
|
|
||||||
# yq -iy '.builds."25556".pat |= {url:"...", hash:"..."}' DS918+.yml # yq 也会修改文件格式
|
|
||||||
pat = data["builds"][ver]["pat"]
|
|
||||||
if not all(bool(key) for key in pat.keys()):
|
|
||||||
print("[E] {} builds.{} key error".format(filename, ver))
|
|
||||||
return
|
|
||||||
commands = [
|
|
||||||
"sed",
|
|
||||||
"-i",
|
|
||||||
"s|{}|{}|; s|{}|{}|".format(pat["url"], url, pat["md5"], md5),
|
|
||||||
os.path.join(FILE_PATH, configs, filename),
|
|
||||||
]
|
|
||||||
result = subprocess.check_output(commands)
|
|
||||||
|
|
||||||
# # pyyaml 会修改文件格式
|
|
||||||
# if isChange is True:
|
|
||||||
# with open(os.path.join(FILE_PATH, configs, filename), "w", encoding='utf-8') as f:
|
|
||||||
# yaml.dump(data, f, Dumper=yaml.SafeDumper, sort_keys=False) # 双引号: default_style='"',
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
Loading…
x
Reference in New Issue
Block a user