stages/authconfig: run authconfig
This applies the default authconfig settings to the tree. Note that the `/backups` directory is removed. The tool creaset this, and by default it should not exist, so this should be a noop. However, if you run this on a tree with existing backups, they would be lost.
This commit is contained in:
parent
306fd3ed96
commit
f7bf23faba
7 changed files with 1631 additions and 1 deletions
42
stages/org.osbuild.authconfig
Executable file
42
stages/org.osbuild.authconfig
Executable file
|
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/python3
|
||||
"""
|
||||
Configure authentication sources using authconfig.
|
||||
|
||||
Applies the default settings. Backups are cleared.
|
||||
|
||||
Notes:
|
||||
- Requires 'chroot' in the buildroot.
|
||||
- Runs the 'authconfig' binary from the image in the chroot.
|
||||
"""
|
||||
|
||||
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import osbuild.api
|
||||
|
||||
|
||||
SCHEMA = """
|
||||
"additionalProperties": false,
|
||||
"description": "Configure authentication sources."
|
||||
"""
|
||||
|
||||
|
||||
def main(tree):
|
||||
cmd = [
|
||||
"/usr/sbin/chroot", tree,
|
||||
"/usr/sbin/authconfig", "--nostart", "--updateall"
|
||||
]
|
||||
|
||||
subprocess.run(cmd, check=True)
|
||||
|
||||
shutil.rmtree(f"{tree}/var/lib/authselect/backups", ignore_errors=True)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = osbuild.api.arguments()
|
||||
r = main(args["tree"])
|
||||
sys.exit(r)
|
||||
Loading…
Add table
Add a link
Reference in a new issue