[maemo-developers] Optification breaks package on upgrade from non-optified older version

From: Marius Vollmer marius.vollmer at nokia.com
Date: Fri Oct 16 16:58:59 EEST 2009
ext Thomas Perl <th.perl at gmail.com> writes:

> I don't really know much about dpkg internals, but maybe it would be
> possible for maemo-optify to add a small script to postinst that will do
> something like this (in pseudocode):
>
> for each (symlinkname in the package) do
>     if (symlinkname points to /opt) and (symlinkname is a directory) then
>         if (symlinkname is an empty directory) then
>             remove directory, recreate correct symlink
>         else
>             create symlinks inside the directory
>         endif
>     endif
> endfor

What about a slight variation:

for each (symlinkname in the package) do
    if (symlinkname should point to /opt) and (symlinkname is a directory) then
        cp -a symlinkname/* to /opt/maemo/symlinkname/
        rm -rf symlinkname
        ln -s /opt/maemo/symlinkname symlinkname
    endif
endfor

This would migrate the existing files and would establish a symlink
structure that matches what is in the package.

(What a hack.)
More information about the maemo-developers mailing list