18 Star 0 Fork 1

openKylin/grub2-signed

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
download-grub2 989 Bytes
一键复制 编辑 原始数据 按行查看 历史
openKylinBot 提交于 2022-05-13 23:50 . Import Upstream version 1.142
#! /usr/bin/python3
import re
import shutil
from urllib.parse import urlparse, urlunparse
from urllib.request import urlopen
import apt
import apt_pkg
ARCH_TO_EFI_NAME = {
'amd64': 'x64',
'arm64': 'aa64',
}
arch = apt_pkg.config['Apt::Architecture']
efi_name = ARCH_TO_EFI_NAME[arch]
cache = apt.Cache()
grub_efi = cache["grub-efi-%s" % (arch)].candidate
pool_parsed = urlparse(grub_efi.uri)
dists_dir = "/dists/%s/main/uefi/grub2-%s/current/" % (
grub_efi.origins[0].archive, grub_efi.architecture)
for base in (
"gcd%s.efi.signed" % (efi_name),
"grub%s.efi.signed" % (efi_name),
"grubnet%s.efi.signed" % (efi_name),
"version",
):
dists_parsed = list(pool_parsed)
dists_parsed[2] = re.sub(r"/pool/.*", dists_dir + base, dists_parsed[2])
dists_uri = urlunparse(dists_parsed)
print("Downloading %s ..." % dists_uri)
with urlopen(dists_uri) as dists, open(base, "wb") as out:
shutil.copyfileobj(dists, out)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openkylin/grub2-signed.git
git@gitee.com:openkylin/grub2-signed.git
openkylin
grub2-signed
grub2-signed
openkylin/yangtze

搜索帮助