pmb.config: write config file to xdg location

This commit is contained in:
Martijn Braam 2020-05-25 19:36:10 +02:00
parent 445410d08c
commit de3b709af5
No known key found for this signature in database
GPG Key ID: C4280ACB000B060F
2 changed files with 10 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import os
#
from pmb.config.load import load
from pmb.config.save import save
from pmb.config.xdg import get_xdg_config_home
from pmb.config.merge_with_args import merge_with_args
@ -65,7 +66,7 @@ defaults = {
# aes-xts-plain64 would be better, but this is not supported on LineageOS
# kernel configs
"cipher": "aes-cbc-plain64",
"config": os.path.expanduser("~") + "/.config/pmbootstrap.cfg",
"config": os.path.join(get_xdg_config_home(), "pmbootstrap.cfg"),
"device": "qemu-amd64",
"extra_packages": "none",
"fork_alpine": False,

8
pmb/config/xdg.py Normal file
View File

@ -0,0 +1,8 @@
import os
def get_xdg_config_home():
home = os.path.expanduser('~')
xdg_config_home = os.environ.get('XDG_CONFIG_HOME') \
or os.path.join(home, '.config')
return os.path.join(xdg_config_home, 'pmbootstrap')