Skip to content

Commit

Permalink
Unify qubes-os XDG config directory
Browse files Browse the repository at this point in the history
fixes: QubesOS/qubes-issues#8694
Removing space and upper-case letters from qubes-manager configuration
directory. Migrating old config to new unified config directory.
  • Loading branch information
alimirjamali committed Jul 28, 2024
1 parent 4011bc6 commit dd9408d
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion qubesmanager/qube_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@
from datetime import datetime, timedelta
from functools import partial
from os import path
import xdg.BaseDirectory
import pathlib
import shutil

from qubesadmin import exc
from qubesadmin import utils
from qubesadmin.tools import qvm_start

# pylint: disable=import-error
from PyQt5.QtCore import (Qt, QAbstractTableModel, QObject, pyqtSlot, QEvent,
QSettings, QRegExp, QSortFilterProxyModel, QSize, QPoint, QTimer)
QSettings, QRegExp, QSortFilterProxyModel, QSize, QPoint, QTimer,
QCoreApplication)

# pylint: disable=import-error
from PyQt5.QtWidgets import (QLineEdit, QStyledItemDelegate, QToolTip,
Expand Down Expand Up @@ -718,6 +722,21 @@ def __init__(self, qt_app, qubes_app, dispatcher, _parent=None):
super().__init__()
self.setupUi(self)

# migrate old config file to the unified config directory
# TODO: Remove this block when Qubes R4.3 becomes End-of-Life
old_config_home = xdg.BaseDirectory.xdg_config_home + \
'/The Qubes Project'
new_config_home = xdg.BaseDirectory.xdg_config_home + '/qubes-os'
config_file = 'qubes-qube-manager.conf'
old_config_file = old_config_home + '/' + config_file
new_config_file = new_config_home + '/' + config_file
if path.isfile(old_config_file) and not path.isfile(new_config_file):
pathlib.Path(new_config_home).mkdir(parents=True, exist_ok=True)
shutil.copy(old_config_file, new_config_file)

QCoreApplication.setOrganizationName('qubes-os')
QCoreApplication.setOrganizationDomain('qubes-os.org')
QCoreApplication.setApplicationName('qubes-qube-manager')
self.manager_settings = QSettings(self)

self.qubes_app = qubes_app
Expand Down

0 comments on commit dd9408d

Please sign in to comment.