maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Optification confusion (https://talk.maemo.org/showthread.php?t=38100)

ruskie 2009-12-22 19:35

Optification confusion
 
As we have to live with this stu.... that is optification can we atleast agree on how it should be done.

I look into /opt and see:

/opt/maemo
/opt/openvpn
/opt/fmradio
etc... etc... etc...

Also what needs to be optified? libs? or only large media files, executables etc...?

Reading:
http://wiki.maemo.org/Documentation/...opt_and_MyDocs

Doesn't reveal much, the same for it's root:
http://wiki.maemo.org/Documentation/...d_Distributing

The way I would see it is just have a secondary /usr like tree under /opt/maemo and use that only. Anything outside of that should be a valid bug... no need to put more of a mess than necessary.

kwotski 2009-12-22 19:48

Re: Optification confusion
 
Well the standard allows either, it seems:

Quote:

A package to be installed in /opt must locate its static files in a separate /opt/<package> or /opt/<provider> directory tree, where <package> is a name that describes the software package and <provider> is the provider's LANANA registered name.
( http://www.pathname.com/fhs/pub/fhs-...FTWAREPACKAGES )

There is one massive mailing list thread about this issue starting here

fnordianslip 2009-12-22 19:52

Re: Optification confusion
 
It may depend on whether package builders manually optify their package, or if they use maemo-optify to do it. maemo-optify seems to put stuff in /opt/maemo.

jebba 2009-12-22 22:04

Re: Optification confusion
 
Some ramblings (i'm tired, sry for lack of clarity):

Code:

/etc/opt : Configuration files for /opt
Purpose

Host-specific configuration files for add-on application software packages must be installed within the directory /etc/opt/<subdir>, where <subdir> is the name of the subtree in /opt where the static data from that package is stored.


We should probably have by default a:

Code:

ln -s /opt/etc /etc/opt

Since /opt packages are supposed to put their configs in /etc, but that could make the root filesystem grow a lot too, depending. In the case of the wonderful asterisk, the /etc files are 600k alone!

maemo-optify will only do files greater than 2k, but this isn't so great in all cases. Asterisk, for example, has a jillion little sound files, so if it used maemo-optify, it would still write like 1M to /.


Using maemo-optify in debian/rules doesn't use the /opt/maemo subdir, but using maemo-optify-deb does.


I just wish we could completely ditch the /opt thing entirely. sigh.

-Jeff
http://wiki.maemo.org/User:Jebba

mikkov 2009-12-22 22:40

Re: Optification confusion
 
Quote:

Originally Posted by jebba (Post 438238)
maemo-optify will only do files greater than 2k, but this isn't so great in all cases. Asterisk, for example, has a jillion little sound files, so if it used maemo-optify, it would still write like 1M to /.

maemo-optify links the directory if the package name and directory name are the same. Usually works fine for applications which have only one package, but for multi package apps it's not so great.

Quote:

Originally Posted by jebba (Post 438238)
Using maemo-optify in debian/rules doesn't use the /opt/maemo subdir, but using maemo-optify-deb does.

Hmm, using maemo-optify is rules and maemo-optfiy-deb should produce exactly same output. (And in my experience they do)

krk969 2010-02-05 17:23

Re: Optification confusion
 
have a general question , if an app needs to download files and store settings, this needs to be done in the /opt or /home partition ?
/opt means that the app needs to run as root no ?

im assuming here that the files downloaded/ settings for the app are considerably large size, in the order of a few hundred KB lets say.

cheers.

Flandry 2010-02-05 17:27

Re: Optification confusion
 
You should keep the settings in the user's config directory, so /home/user/.appname/. If the app needs to download large amounts of data, you should probably store it in opt or ~/MyDocs, depending on the nature of the data.

For PrBoom i tell users they can put their own wads in /opt/doom/wads, and to make that easier, chown it to user in the postinst script.

krk969 2010-02-05 17:31

Re: Optification confusion
 
Quote:

Originally Posted by Flandry (Post 512126)
You should keep the settings in the user's config directory, so /home/user/.appname/. If the app needs to download large amounts of data, you should probably store it in opt or ~/MyDocs, depending on the nature of the data.

For PrBoom i tell users they can put their own wads in /opt/doom/wads, and to make that easier, chown it to user in the postinst script.

thanks Flandry, these data that Im talking about are huge xml files so I'd want them to be in /opt and not take up space, they get deleted by the app if they are +7 days old.

Could you brief me how I can go about the postinst script while packaging my app so I can chmown the /opt/<app> path to my application ?

*EDIT*
a quick search helped. It looks like a normal file without any predefined format.
I just need to have my shell commands in there I guess and it will be run after the debian package is installed.
please correct if this is not rightly stated.

cheers

Flandry 2010-02-05 18:13

Re: Optification confusion
 
Yeah that's right. It's a script in ./debian called postinst or <packagename>.postinst that runs after the installation. It sounds like what you want is indeed a directory in opt, probably a subdir of the app directory so that you can just put the data in there. Then you'd have a line in postinst:

chown user /opt/myappsdir/data

Make sure you create the directory in the install or postinst and that uninstalling the package properly removes it. Make sure that any data files that get installed during package install are also changed to user ownership, so they can be deleted by the app later on.

There's almost certainly a better way to do this. It wouldn't work if e.g. the user had changed their user name to something else. This is just what i've used and it works ok in a single-user N900 setup.

krk969 2010-02-05 20:55

Re: Optification confusion
 
Quote:

Originally Posted by Flandry (Post 512184)
Yeah that's right. It's a script in ./debian called postinst or <packagename>.postinst that runs after the installation. .......

does it only run when installing using aptitude ?
I dont think my chown command ran when I installed the deb file using dpkg

my postinst.ex file looks like this

Code:

#!/bin/sh

gtk-update-icon-cache -f /usr/share/icons/hicolor
chown -R user /opt/myapp/

set -e

case "$1" in
    configure)
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

exit 0

cheers


All times are GMT. The time now is 03:01.

vBulletin® Version 3.8.8