Add admin.repos.* qrexec services
This is a prerequisite for QubesOS/qubes-issues#4550.
This commit is contained in:
parent
2ec29a4d4c
commit
888073df05
7
qubes-rpc-policy/admin.repos.Disable
Normal file
7
qubes-rpc-policy/admin.repos.Disable
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
## Note that policy parsing stops at the first match,
|
||||||
|
## so adding anything below "$anyvm $anyvm action" line will have no effect
|
||||||
|
|
||||||
|
## Please use a single # to start your custom comments
|
||||||
|
|
||||||
|
dom0 dom0 allow
|
||||||
|
$anyvm $anyvm deny
|
7
qubes-rpc-policy/admin.repos.Enable
Normal file
7
qubes-rpc-policy/admin.repos.Enable
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
## Note that policy parsing stops at the first match,
|
||||||
|
## so adding anything below "$anyvm $anyvm action" line will have no effect
|
||||||
|
|
||||||
|
## Please use a single # to start your custom comments
|
||||||
|
|
||||||
|
dom0 dom0 allow
|
||||||
|
$anyvm $anyvm deny
|
7
qubes-rpc-policy/admin.repos.List
Normal file
7
qubes-rpc-policy/admin.repos.List
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
## Note that policy parsing stops at the first match,
|
||||||
|
## so adding anything below "$anyvm $anyvm action" line will have no effect
|
||||||
|
|
||||||
|
## Please use a single # to start your custom comments
|
||||||
|
|
||||||
|
dom0 dom0 allow
|
||||||
|
$anyvm $anyvm deny
|
24
qubes-rpc/admin.repos.Disable
Executable file
24
qubes-rpc/admin.repos.Disable
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
# Empty output indicates success; any input indicates error (probably an exception)
|
||||||
|
|
||||||
|
import dnf
|
||||||
|
import iniparse
|
||||||
|
import sys
|
||||||
|
|
||||||
|
base = dnf.Base()
|
||||||
|
|
||||||
|
base.read_all_repos()
|
||||||
|
|
||||||
|
reponame = sys.stdin.readline()
|
||||||
|
repo = base.repos[reponame]
|
||||||
|
|
||||||
|
# Loosely based on write_raw_configfile() from DNF source code,
|
||||||
|
# because that method was introduced in DNF 2.0 but Qubes dom0 has DNF 1.x.
|
||||||
|
with open(repo.repofile) as fp:
|
||||||
|
ini = iniparse.INIConfig(fp)
|
||||||
|
|
||||||
|
ini[reponame]['enabled'] = 0
|
||||||
|
|
||||||
|
with open(repo.repofile, 'w') as fp:
|
||||||
|
fp.write(str(ini))
|
24
qubes-rpc/admin.repos.Enable
Executable file
24
qubes-rpc/admin.repos.Enable
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
# Empty output indicates success; any input indicates error (probably an exception)
|
||||||
|
|
||||||
|
import dnf
|
||||||
|
import iniparse
|
||||||
|
import sys
|
||||||
|
|
||||||
|
base = dnf.Base()
|
||||||
|
|
||||||
|
base.read_all_repos()
|
||||||
|
|
||||||
|
reponame = sys.stdin.readline()
|
||||||
|
repo = base.repos[reponame]
|
||||||
|
|
||||||
|
# Loosely based on write_raw_configfile() from DNF source code,
|
||||||
|
# because that method was introduced in DNF 2.0 but Qubes dom0 has DNF 1.x.
|
||||||
|
with open(repo.repofile) as fp:
|
||||||
|
ini = iniparse.INIConfig(fp)
|
||||||
|
|
||||||
|
ini[reponame]['enabled'] = 1
|
||||||
|
|
||||||
|
with open(repo.repofile, 'w') as fp:
|
||||||
|
fp.write(str(ini))
|
11
qubes-rpc/admin.repos.List
Executable file
11
qubes-rpc/admin.repos.List
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import dnf
|
||||||
|
|
||||||
|
base = dnf.Base()
|
||||||
|
|
||||||
|
base.read_all_repos()
|
||||||
|
|
||||||
|
for repo in base.repos.all():
|
||||||
|
l = [repo.id, repo.name, 'enabled' if repo.enabled else 'disabled']
|
||||||
|
print('\0'.join(l))
|
Loading…
Reference in New Issue
Block a user