title: Create symlink in RPM
body: <p>I have a specific version of a software on Linux and I am packaging a .jar file (meant to upgrade the existing software) in an rpm and then trying to re-create a symlink to point to the latest version of the jar. I tried using <code>%post</code> and <code>%postun</code> to create and delete the symbolic link (in case it exists already), however this does not work. I have seen a few posts on the internet, but they did not work.</p>
  
  <p>As a workaround, I tried to create the symlink in puppet. For this I used something like below:</p>
  
  <pre><code>if $version == ‘1.1'  {
      file { '/usr/share/prog/software.jar':
      ensure  =&gt; 'symlink',
      target  =&gt; '/usr/share/prog/java/software-1.1-bin.jar',
  }
  </code></pre>
  
  <p>But even here, the new version jar is getting created, but not the symlink. </p>
  
  <p>Please let me know if anybody has solved this problem before.</p>
  
  <p>Below is the spec file that I had used:</p>
  
  <pre><code>%define base_install_dir %{_datadir}/prog
  
  Name:cdplayer
  Version:1.1
  Epoch:1
  Release:2el6
  Source:cdplayer-1.1-bin.jar
  BuildArch:noarch
  %description    
  %prep
  %install
  %{__mkdir} -p %{buildroot}%{base_install_dir}
  %{__install} -D -m 755 %{SOURCE0} %{buildroot}%{base_install_dir}
  
  %post
  ln -s -f /usr/share/prog/cdplayer-1.1-bin.jar /usr/share/prog/cdplayer.jar
  %postun
  %{__rm} -f /usr/share/prog/cdplayer.jar
  %files
  %defattr(-,root,root,-)
  %dir %{base_install_dir}
  %{base_install_dir}/*
  
  %changelog
  </code></pre>