symlink in particular directory using rpm spec

2019-06-25 23:32发布

问题:

rpm created using spec file will create directory "directory1" and all files in /var/lib/directory1.

For another use case i want to create another directory in "/var/lib" which should be a symlink to directory1.

eg: 
cd /var/lib/
ls -la
directory2 -> directory1 
directory1

how is it possible to do achieve this without using absolute paths in spec file?

回答1:

%install
mkdir -p %{buildroot}/%{_sharedstatedir}/directory1
ln -s directory1 %{buildroot}/%{_sharedstatedir}/directory2

%files
%{_sharedstatedir}/directory1
%{_sharedstatedir}/directory2