SHA256
3
0
forked from pool/dpkg

Accepting request 543853 from home:pluskalm:branches:system:packagemanager

- Move update alternatives database to new location

OBS-URL: https://build.opensuse.org/request/show/543853
OBS-URL: https://build.opensuse.org/package/show/system:packagemanager/dpkg?expand=0&rev=53
This commit is contained in:
Tomáš Chvátal 2017-11-20 12:45:54 +00:00 committed by Git OBS Bridge
parent 0af91d4729
commit a6e5a74596
2 changed files with 23 additions and 6 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Nov 20 09:13:55 UTC 2017 - mpluskal@suse.com
- Move update alternatives database to new location
-------------------------------------------------------------------
Tue Nov 7 19:57:49 UTC 2017 - mpluskal@suse.com

View File

@ -22,7 +22,7 @@ Release: 0
Summary: Maintain symbolic links determining default commands
License: GPL-2.0+
Group: System/Management
Url: http://ftp.de.debian.org/debian/pool/main/d/dpkg/
URL: http://ftp.de.debian.org/debian/pool/main/d/dpkg/
Source0: http://ftp.de.debian.org/debian/pool/main/d/dpkg/dpkg_%{version}.tar.xz
Source3: sensible-editor
Patch0: update-alternatives-suse.patch
@ -33,7 +33,9 @@ BuildRequires: automake
BuildRequires: libtool
BuildRequires: ncurses-devel
BuildRequires: pkgconfig
%requires_eq rpm
# As we are using macros from rpm for location we need to have same rpm as
# one used during build of this package
Requires: %(rpm -q --queryformat '%{NAME} = %{VERSION}-%{RELEASE}\n' rpm)
Requires(post): coreutils
Requires(post): update-alternatives
Provides: alternatives = %{version}
@ -57,8 +59,8 @@ particular preference.
%build
autoreconf -fvi
%configure \
--disable-silent-rules \
--with-admindir=%{_dbpath}
--disable-silent-rules \
--with-admindir=%{_localstatedir}/lib
make -C lib/compat %{?_smp_mflags}
make -C utils/ %{?_smp_mflags}
@ -68,7 +70,7 @@ make -C man/ %{?_smp_mflags}
install -d -m 0755 %{buildroot}/%{_sbindir}/
install -d -m 0755 %{buildroot}/%{_mandir}/man1/
install -d -m 0755 %{buildroot}/%{_sysconfdir}/alternatives
install -d -m 0755 %{buildroot}/%{_dbpath}/alternatives
install -d -m 0755 %{buildroot}%{_localstatedir}/lib/alternatives
install -d -m 0755 %{buildroot}/%{_localstatedir}/log
install -pm 0755 utils/%{name} %{buildroot}/%{_sbindir}
@ -76,6 +78,16 @@ ln -s %{name} %{buildroot}/%{_sbindir}/alternatives
install -pm 0644 man/%{name}.1 %{buildroot}/%{_mandir}/man1/
%post
# Migrate to new location
if [ -d %{_dbpath}/alternatives ]; then
echo "migrating update alternatives database to new location"
# We proceed even if no alternatives directory exists, such situation
# occurs in buildroot environment (we can't buildrequire package
# itself).
mv -f %{_dbpath}/alternatives/* /var/lib/alternatives/ || :
rmdir %{_dbpath}/alternatives ||:
fi
touch %{_localstatedir}/log/alternatives.log
# Fix broken alternatives list bnc#969171
cd %{_sysconfdir}/alternatives/
@ -87,7 +99,7 @@ done
%files
%doc COPYING
%dir %{_sysconfdir}/alternatives
%dir %{_dbpath}/alternatives
%dir %{_localstatedir}/lib/alternatives
%{_sbindir}/alternatives
%{_sbindir}/update-alternatives
%{_mandir}/man1/update-alternatives.1%{ext_man}