mirror of
https://github.com/tuna/tunasync-scripts.git
synced 2025-04-20 04:12:42 +00:00
yum-sync: Migrate to newer tools
This commit is contained in:
parent
0bdf77b473
commit
867883dc24
10
dockerfiles/yum-sync/Dockerfile
Normal file
10
dockerfiles/yum-sync/Dockerfile
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
FROM centos:8
|
||||||
|
MAINTAINER Hongren Zheng <hongren.zheng@tuna.tsinghua.edu.cn>
|
||||||
|
|
||||||
|
RUN dnf makecache && \
|
||||||
|
dnf install -y 'dnf-command(reposync)' createrepo_c wget curl
|
||||||
|
|
||||||
|
RUN mkdir -p /home/tunasync-scripts
|
||||||
|
|
||||||
|
ENV HOME=/tmp
|
||||||
|
CMD /bin/bash
|
@ -197,6 +197,7 @@ def main():
|
|||||||
conf.write('''
|
conf.write('''
|
||||||
[main]
|
[main]
|
||||||
keepcache=0
|
keepcache=0
|
||||||
|
cachedir={cache_dir}
|
||||||
''')
|
''')
|
||||||
for name, url in combination_os_comp(arch):
|
for name, url in combination_os_comp(arch):
|
||||||
conf.write(f'''
|
conf.write(f'''
|
||||||
@ -219,7 +220,7 @@ enabled=1
|
|||||||
failed.append(('', arch))
|
failed.append(('', arch))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
cmd_args = ["reposync", "-a", arch, "-c", conf.name, "-d", "-p", str(args.working_dir.absolute()), "-e", cache_dir]
|
cmd_args = ["dnf", "reposync", "-a", arch, "-c", conf.name, "--delete", "-p", str(args.working_dir.absolute())]
|
||||||
print("Launching reposync", flush=True)
|
print("Launching reposync", flush=True)
|
||||||
# print(cmd_args)
|
# print(cmd_args)
|
||||||
ret = sp.run(cmd_args)
|
ret = sp.run(cmd_args)
|
||||||
@ -232,7 +233,7 @@ enabled=1
|
|||||||
if args.download_repodata:
|
if args.download_repodata:
|
||||||
download_repodata(url, path)
|
download_repodata(url, path)
|
||||||
else:
|
else:
|
||||||
cmd_args = ["createrepo", "--update", "-v", "-c", cache_dir, "-o", str(path), str(path)]
|
cmd_args = ["createrepo_c", "--update", "-v", "-c", cache_dir, "-o", str(path), str(path)]
|
||||||
# print(cmd_args)
|
# print(cmd_args)
|
||||||
ret = sp.run(cmd_args)
|
ret = sp.run(cmd_args)
|
||||||
calc_repo_size(path)
|
calc_repo_size(path)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user