Use $XDG_CONFIG_HOME instead of hardcoded path (MR 1969)

This commit is contained in:
Ralf Rachinger 2020-08-23 13:51:42 +02:00
parent 86d61b8012
commit 72e24f7f96
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
3 changed files with 3 additions and 5 deletions

View File

@ -68,7 +68,7 @@ set_alias_pmbootstrap() {
pmbootstrap="$pmbootstrap_dir"/pmbootstrap.py
# shellcheck disable=SC2139
alias pmbootstrap="\"$pmbootstrap\""
if [ -e ~/.config/pmbootstrap.cfg ]; then
if [ -e "${XDG_CONFIG_HOME:-$HOME/.config}"/pmbootstrap.cfg ]; then
"$pmbootstrap" work_migrate
else
echo "NOTE: First run of pmbootstrap, running 'pmbootstrap init'"

View File

@ -68,7 +68,7 @@ defaults = {
"ccache_size": "5G",
"is_default_channel": True,
"cipher": "aes-xts-plain64",
"config": os.path.expanduser("~") + "/.config/pmbootstrap.cfg",
"config": (os.environ.get('XDG_CONFIG_HOME') or os.path.expanduser("~/.config")) + "/pmbootstrap.cfg",
"device": "qemu-amd64",
"extra_packages": "none",
"fork_alpine": False,

View File

@ -7,7 +7,6 @@ via SSH if expected processes are running.
We use an extra config file (based on ~/.config/pmbootstrap.cfg), because we
need to change it a lot (e.g. UI, username, ...).
"""
import os
import pytest
import sys
import shutil
@ -78,8 +77,7 @@ class QEMU(object):
def run(self, args, tmpdir, ui="none"):
# Copy and adjust user's pmbootstrap.cfg
config = str(tmpdir) + "/pmbootstrap.cfg"
shutil.copyfile(os.path.expanduser("~") + "/.config/pmbootstrap.cfg",
config)
shutil.copyfile(args.config, config)
pmbootstrap_run(args, config, ["config", "device", "qemu-amd64"])
pmbootstrap_run(args, config, ["config", "kernel", "virt"])
pmbootstrap_run(args, config, ["config", "extra_packages", "none"])