View previous topic :: View next topic |
Author |
Message |
Xharlie n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 21 May 2017 Posts: 13
|
Posted: Wed Jul 17, 2024 12:10 pm Post subject: Ergonomic configuration of CONFIG_PROTECT |
|
|
I currently have `CONFIG_PROTECT` customised in `/etc/portage/profile/make.defaults` as an unwieldy, long, space-separated string.
Is there some better way to configure this variable that would support multiple lines and perhaps comments so I could state *why* certain files are in it? (I could add one big comment at the top of `/etc/portage/profile/make.defaults` but not inline, adjacent to the file paths.)
For full disclosure, this is mine, at present:
Code: | CONFIG_PROTECT="/usr/share/X11/xkb/rules/evdev.xml /usr/share/X11/xkb/symbols/gb /usr/lib64/firefox/distribution/distribution.ini /usr/lib64/firefox/distribution/policies.json /usr/lib64/thunderbird/distribution/distribution.ini /usr/lib64/thunderbird/distribution/policies.json" |
It's growing, though, because I keep finding files being silently overwritten by packages.
(Today's one was the `gb` keyboard layout file to which I had added a custom *variant*. I tried adding my variant in my own file in `/usr/share/X11/xkb/symbols/` but KDE wouldn't show the right language icon unless I appended my variant to the `gb` file, hence the desired overwrite protection.) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
rab0171610 Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 24 Dec 2022 Posts: 406
|
Posted: Wed Jul 17, 2024 1:13 pm Post subject: |
|
|
Code: | CONFIG_PROTECT="/usr/share/X11/xkb/rules/evdev.xml /usr/share/X11/xkb/symbols/gb /usr/lib64/firefox/distribution/distribution.ini /usr/lib64/firefox/distribution/policies.json /usr/lib64/thunderbird/distribution/distribution.ini /usr/lib64/thunderbird/distribution/policies.json" |
Can make use of an escape delimiter '\' anywhere after the spaces:
Code: |
CONFIG_PROTECT="/usr/share/X11/xkb/rules/evdev.xml /usr/share/X11/xkb/symbols/gb /usr/lib64/firefox/distribution/distribution.ini \
/usr/lib64/firefox/distribution/policies.json /usr/lib64/thunderbird/distribution/distribution.ini \
/usr/lib64/thunderbird/distribution/policies.json"
|
This allows one line to wrap to the next line to make it more human readable. This escape character '\' will escape the newline character inserted in the document when hitting enter on the keyboard.
Also, you can try to limit your use of config protect entries. For example, you can use the /etc/xkb/symbols/ and /etc/xkb/rules directory to mirror the /usr/share/X11/xkb/rules and /usr/share/X11/xkb/symbols directories. You can put your modified or custom config files there. "You may also use $XDG_CONFIG_HOME/xkb/, or $HOME/.config/xkb/ if the $XDG_CONFIG_HOME environment variable is not defined" per:
https://xkbcommon.org/doc/current/user-configuration.html
If that is correct and current, then you should be able to use any directory you wish by setting the $XDG_CONFIG_HOME environment variable.
See also:
https://wiki.archlinux.org/index.php?title=X_keyboard_extension&diff=prev&oldid=362133
https://bbs.archlinux.org/viewtopic.php?id=286561 |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
grknight Retired Dev
![Retired Dev Retired Dev](/images/ranks/rank-retired.gif)
Joined: 20 Feb 2015 Posts: 1837
|
Posted: Wed Jul 17, 2024 1:48 pm Post subject: |
|
|
For CONFIG_PROTECT, use custom /etc/env.d entries as needed. They are cumulative over all files and allow comments in the file. Just don't name the same as something Gentoo would use. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Hu Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
Joined: 06 Mar 2007 Posts: 22392
|
Posted: Wed Jul 17, 2024 3:18 pm Post subject: Re: Ergonomic configuration of CONFIG_PROTECT |
|
|
Xharlie wrote: | I currently have `CONFIG_PROTECT` customised in `/etc/portage/profile/make.defaults` as an unwieldy, long, space-separated string. | Why are you putting it there? /etc/portage/make.conf is reserved to the user, and seems better suited to your purpose. Xharlie wrote: | Is there some better way to configure this variable that would support multiple lines and perhaps comments so I could state *why* certain files are in it? | Yes. Code: | $ grep CONFIG_PROTECT /etc/portage/make.conf
# Add /a to $CONFIG_PROTECT to start
CONFIG_PROTECT="/a"
# Append /b to $CONFIG_PROTECT, to continue
CONFIG_PROTECT="$CONFIG_PROTECT /b"
$ emerge --info | grep -w CONFIG_PROTECT
CONFIG_PROTECT="/a /b /etc /usr/share/gnupg/qualified.txt" |
Xharlie wrote: | It's growing, though, because I keep finding files being silently overwritten by packages. | Packages will silently overwrite any file that they own, if it is not protected. Before customizing a file owned by a package, add it to CONFIG_PROTECT.
You can also use newlines instead of spaces within the string, if you want multiple lines without needing to repeat the literal $CONFIG_PROTECT. There is no need for a backslash to continue inside the string. However, while inside the string, you cannot use comments, so if you want per-block comments, those will need to use the form I show above. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|