-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ostree: move admindir to /etc/alternatives.admindir
`ostree container commit` wipes /var and thereby erases the data in /var/lib/alternatives; the directory used to store configs/symlinks of alternatives. /var is not a good place for storing such configs since it won't receive updates on bootc images either. We need to move to another location. Hence, use /etc/alternatives.admindir when running on an ostree-based system unless /var/lib/alternatives is already present; a user may have worked around the problem. This way we enable alternatives to work on ostree-based systems without breaking backwards compat. Fixes: #9 Signed-off-by: Valentin Rothberg <[email protected]>
- Loading branch information
Showing
7 changed files
with
100 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/sh | ||
|
||
# Already symlinked, nothing to do | ||
if [[ -L /var/lib/alternatives ]]; then | ||
Check warning Code scanning / shellcheck SC3010 Warning
In POSIX sh, [[ ]] is undefined.
|
||
exit 0; | ||
fi | ||
|
||
# Make sure that the admindir exists | ||
mkdir -p /etc/alternatives.admindir | ||
|
||
# Migrate the contents | ||
if [[ -d /var/lib/alternatives ]]; then | ||
Check warning Code scanning / shellcheck SC3010 Warning
In POSIX sh, [[ ]] is undefined.
|
||
mv /var/lib/alternatives/* /etc/alternatives.admindir | ||
rm -r /var/lib/alternatives | ||
fi | ||
|
||
# Create the symlink | ||
ln -s /etc/alternatives.admindir /var/lib/alternatives |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ License: GPL-2.0-only | |
URL: https://github.com/fedora-sysv/chkconfig | ||
Source: https://github.com/fedora-sysv/chkconfig/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz | ||
|
||
BuildRequires: gcc gettext libselinux-devel make newt-devel popt-devel pkgconfig(systemd) | ||
BuildRequires: gcc gettext libselinux-devel make newt-devel popt-devel pkgconfig(systemd) systemd-rpm-macros | ||
# beakerlib might not be available on CentOS Stream any more | ||
%if 0%{?fedora} | ||
BuildRequires: beakerlib | ||
|
@@ -93,11 +93,17 @@ mkdir -p $RPM_BUILD_ROOT/etc/chkconfig.d | |
%files -n alternatives | ||
%license COPYING | ||
%dir /etc/alternatives | ||
%ghost /etc/alternatives.admindir | ||
%ghost /var/lib/alternatives | ||
%dir %{_libexecdir}/alternatives-migration | ||
%{_prefix}/lib/systemd/system/alternatives-migration.service | ||
%{_sbindir}/update-alternatives | ||
%{_sbindir}/alternatives | ||
%{_mandir}/*/update-alternatives* | ||
%{_mandir}/*/alternatives* | ||
%dir /var/lib/alternatives | ||
|
||
%postun | ||
%systemd_postun alternatives-migration.service | ||
|
||
%changelog | ||
* Fri Jun 21 2024 Jan Macku <[email protected]> - 1.28-1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ msgid "" | |
msgstr "" | ||
"Project-Id-Version: PACKAGE VERSION\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-07-26 11:46+0200\n" | ||
"POT-Creation-Date: 2024-07-30 14:56+0200\n" | ||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
"Language-Team: LANGUAGE <[email protected]>\n" | ||
|
@@ -562,22 +562,27 @@ msgstr "" | |
msgid "failed to remove %s: %s\n" | ||
msgstr "" | ||
|
||
#: ../alternatives.c:1365 | ||
#: ../alternatives.c:1300 ../alternatives.c:1469 | ||
#, c-format | ||
msgid "admindir %s invalid\n" | ||
msgstr "" | ||
|
||
#: ../alternatives.c:1394 | ||
#, c-format | ||
msgid "--family can't contain the symbol '@'\n" | ||
msgstr "" | ||
|
||
#: ../alternatives.c:1427 | ||
#: ../alternatives.c:1457 | ||
#, c-format | ||
msgid "altdir %s invalid\n" | ||
msgstr "" | ||
|
||
#: ../alternatives.c:1432 | ||
#: ../alternatives.c:1463 | ||
#, c-format | ||
msgid "admindir %s invalid\n" | ||
msgid "creating admindir: %s\n" | ||
msgstr "" | ||
|
||
#: ../alternatives.c:1442 | ||
#: ../alternatives.c:1479 | ||
#, c-format | ||
msgid "alternatives version %s\n" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[Unit] | ||
Description=Migrate /var/lib/alternatives to /etc/alternatives.admindir | ||
Documentation=man:alternatives(8) | ||
|
||
# This should run before any other daemons/tools that may use alternatives | ||
DefaultDependencies=no | ||
After=sysinit.target | ||
Before=basic.target shutdown.target | ||
Conflicts=shutdown.target | ||
# In case /var is remote-mounted | ||
RequiresMountsFor=/var | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/libexec/alternatives-migration | ||
|
||
[Install] | ||
WantedBy=default.target |