Skip to content

Commit 70d81a8

Browse files
committed
Allow ~/.config/bb_clientd subdirectory
When having multiple configuration files, the ~/.config directory gets cleaner when they are all gathered in the subdirectory bb_clientd. Keep the old behaviour with files straight in ~/.config for backwards compatibility.
1 parent 0313de5 commit 70d81a8

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,9 @@ journalctl --user -u bb_clientd -f
7878

7979
By default, bb\_clientd will use the configuration file that is also
8080
shipped with this repository. It is possible to override configuration
81-
options by creating a file named `~/.config/bb_clientd.jsonnet` that
82-
uses the following structure:
81+
options by creating a file named `~/.config/bb_clientd.jsonnet` or
82+
`~/.config/bb_clientd/bb_clientd.jsonnet` that uses the following
83+
structure:
8384

8485
```jsonnet
8586
local defaultConfiguration = import 'bb_clientd_defaults.jsonnet';

configs/linux/launch_bb_clientd_linux.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,19 @@ if [ "$1" = "start" ]; then
2323
# Use either the user provided or system-wide configuration file, based
2424
# on whether the former is present.
2525
config_file=/usr/lib/bb_clientd/bb_clientd.jsonnet
26-
personal_config_file="${HOME}/.config/bb_clientd.jsonnet"
26+
personal_config_file="${HOME}/.config/bb_clientd/bb_clientd.jsonnet"
27+
28+
# TODO: 2025-04-08 Remove migration code after a year.
29+
old_personal_config_file="${HOME}/.config/bb_clientd.jsonnet"
30+
if [ -f "$old_personal_config_file" ]; then
31+
echo "Found ${old_personal_config_file}, moving it to ${personal_config_file}"
32+
mkdir -p "${HOME}/.config/bb_clientd"
33+
mv "$old_personal_config_file" "$personal_config_file"
34+
rm -f "${HOME}/.config/bb_clientd_defaults.jsonnet"
35+
fi
36+
2737
if [ -f "${personal_config_file}" ]; then
28-
ln -sf "${config_file}" "${HOME}/.config/bb_clientd_defaults.jsonnet"
38+
ln -sf "${config_file}" "${HOME}/.config/bb_clientd/bb_clientd_defaults.jsonnet"
2939
config_file="${personal_config_file}"
3040
fi
3141

0 commit comments

Comments
 (0)