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

From: Marius Vollmer marius.vollmer at nokia.com
Date: Mon Oct 19 17:41:52 EEST 2009
>> > 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
>
> I hope no package ships with dotfiles in directories other packages want
> to optify.

Yeah, well spotted!

I have pushed a new version of maemo-optify to gitorious that patches
maintainer scripts to do "late optification" for stuff that dpkg didn't
do.

It's not very well tested yet, of course, so please dig in!

    http://maemo.gitorious.org/maemo-af/maemo-optify

> I'd also like to bring up error handling: if /opt is almost full and
> you cannot migrate existing files, it would be bad to leave things in
> a broken state.

Yes.  It is unfortunately not possible to replace a directory with
something else atomically.  I think the best we can do is to move away
the old directory and put a symlink in its place with two syscalls and
hope that nothing happens in between.  The old directory can then be
removed afterwards.
More information about the maemo-developers mailing list