Avoid disabling relinking globally, create symlink after spec-helper is run

Based on how __os_post_install is redifined in cross-avr-gcc.spec
This commit is contained in:
Mikhail Novosyolov 2019-11-24 19:23:56 +03:00
parent 62da69ad7b
commit 1468817ede

View file

@ -89,7 +89,7 @@
Summary: Samba SMB server
Name: samba
Version: 4.10.10
Release: 9
Release: 10
Epoch: 1
License: GPLv3+
Group: System/Servers
@ -1488,14 +1488,6 @@ install -m0644 examples/smb.conf.default %{buildroot}/%{_sysconfdir}/%{name}/smb
sed -i -e 's,@ROSA_PLATFORM@,%{rosa_release},g' %{buildroot}/%{_sysconfdir}/%{name}/smb.conf
sed -i -e 's,@smb_usershare_dir@,%{smb_usershare_dir},g' %{buildroot}/%{_sysconfdir}/%{name}/smb.conf
mkdir -p %{buildroot}/%{_libdir}/cups/backend
( cd %{buildroot}%{_libdir}/cups/backend ; ln -s %{_libexecdir}/samba/smbspool_krb5_wrapper smb )
# Prevent running /usr/share/spec-helper/relink_symlinks which will break this symlink.
# /usr/lib64/cups is a symlink to /usr/lib/cups, for some reasons this or sth else breaks
# lstat() on a the symlink smb -> ../../samba/smbspool_krb5_wrapper, so disable converting
# this absolute symlink to a relative one (and it disables converting other symlinks).
export DONT_RELINK=1
echo 127.0.0.1 localhost > %{buildroot}/%{_sysconfdir}/%{name}/lmhosts
install -c -m 755 %{SOURCE10} %{buildroot}%{_datadir}/%{name}/scripts/print-pdf
@ -1541,3 +1533,19 @@ install -m 0644 %{SOURCE42} %{buildroot}%{_sysconfdir}/avahi/services/smb.servic
sed -i -e 's,@SAMBA_VERSION@,%{version},g' -e 's,@ROSA_VERSION@,%{rosa_release},g' \
%{buildroot}%{_sysconfdir}/avahi/services/smb.service
%endif
# /usr/share/spec-helper/relink_symlinks breaks this symlink: an absolute symlink was
# created inside %%install, but then relink_symlinks converted it to a relative one.
# /usr/lib64/cups is a symlink to /usr/lib/cups, for some reasons this or sth else breaks
# lstat() on a a relative symlink smb -> ../../samba/smbspool_krb5_wrapper, so, to avoid
# disabling relinking symlinks globally, create this symlink after spec-helper is run
# instead of doing this in %%install.
%define __os_install_post_sh ./__os_install_post.sh
cat << EOF > %{__os_install_post_sh}
%__os_install_post
mkdir -p %{buildroot}/%{_libdir}/cups/backend
( cd %{buildroot}%{_libdir}/cups/backend
ln -s %{_libexecdir}/samba/smbspool_krb5_wrapper smb )
EOF
chmod +x %{__os_install_post_sh}
%define __os_install_post %{__os_install_post_sh}