<div dir="ltr">On Fri, Sep 20, 2013 at 3:39 PM, Gary Buhrmaster <span dir="ltr">&lt;<a href="mailto:gary.buhrmaster@gmail.com" target="_blank">gary.buhrmaster@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><div class="h5">On Fri, Sep 20, 2013 at 8:16 PM, Richard Shaw &lt;<a href="mailto:hobbes1069@gmail.com">hobbes1069@gmail.com</a>&gt; wrote:<br>

&gt; Ok, yuck... First problem: Broken upgrade path.<br>
&gt;<br>
&gt; Because there are files not part of the package in /usr/share/mythweb/data,<br>
&gt; it does not remove the directory upon upgrade, which means the symlink to<br>
&gt; /usr/lib/mythweb/data fails (actually gets some random number appended it).<br>
&gt;<br>
&gt; This means I&#39;m going to have to handle both the symlinking and data<br>
&gt; migration in %post, fun.<br>
<br>
</div></div>It has been some time since I wrote complex spec files, but<br>
you might be able to do some of the work in the %pre section,<br>
testing $1 to see if you are upgrading (move the cached<br>
files elsewhere), and then in %post move them to the new<br>
locations.  Making it all work right is not at all fun (as I recall).<br>
I suspect that you are not the first package to have this<br>
problem, so there should be a documented method to deal<br>
with this somewhere in the Fedora docs.  Good luck!</blockquote><div><br></div><div>Yup, I have a test package but yum/rpm is telling me the data directories between the two packages conflict... Right now I&#39;ve got the symbolic link in %install and then a %pre and %post to migrate the data.</div>
<div><br></div><div>%pre</div><div># If this is an upgrade</div><div>if [ $1 -gt 1 ] ; then</div><div>    # If data exists and is a directory then we need to migrate it to /var</div><div>    if [ -d &quot;%{_datadir}/%{name}/data&quot; ] ; then</div>
<div>        mv %{_datadir}/%{name}/data %{_datadir}/%{name}/_tmp_data</div><div>    fi</div><div>fi</div><div><br></div><div>%post</div><div># If this is an upgrade</div><div>if [ $1 -gt 1 ] ; then</div><div>    # If there is data to migrate, let&#39;s do it</div>
<div>    if [ -e &quot;%{_datadir}/%{name}/_tmp_data&quot; ] ; then</div><div>        mv %{_datadir}/%{name}/_tmp_data %{_sharedstatedir}/%{name}/</div><div>    fi</div><div>fi </div><div><br></div><div>Thanks,</div><div>
Richard</div></div></div></div>