Creating symlink in /usr/bin when creating an RPM

Solution 1:

ln -sf /opt/bupc2.8/bin/upcc ${RPM_BUILD_ROOT}/%{_bindir}

The link needs to be created in the %build section and it also needs to point to where you're installing the RPM.

Before creating the link make sure that the destination directory exists, i.e. ${RPM_BUILD_ROOT}/%{_bindir}. You can use mkdir or install -d for this.

Solution 2:

macro %{__ln_s} is good also

example add symbolic link post install:

%post
%{__ln_s} -f %{_bindir}/exec %{_bindir}/exec2

example remove symbolic link uninstall:

%postun
rm -f %{_bindir}/exec2

Tags:

Rpm