maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Optifying problem (https://talk.maemo.org/showthread.php?t=40124)

timperi 2010-01-11 20:48

Optifying problem
 
I optified my project, but when i uninstall it with dpkg -r, it leaves behind the symbolic links that i made in the postinst.

how can i remove these automatically during uninstallation?

this is what i have in postinst now:

Code:

#!/bin/sh
# postinst script for boulderdash
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <postinst> `abort-remove'
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package


case "$1" in
    configure)
        ln -s /opt/maemo/usr/bin/boulderdash /usr/bin/
        ln -s /opt/maemo/usr/share/icons/hicolor/64x64/apps/boulderdash_64x64.png /usr/share/icons/hicolor/64x64/apps/
        chmod a+x /opt/maemo/usr/bin/boulderdash
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
        rm /usr/bin/boulderdash
        rm /usr/share/icons/hicolor/64x64/apps/boulderdash_64x64.png
    ;;

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

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0


VDVsx 2010-01-11 22:23

Re: Optifying problem
 
Quote:

Originally Posted by timperi (Post 465082)
I optified my project, but when i uninstall it with dpkg -r, it leaves behind the symbolic links that i made in the postinst.

how can i remove these automatically during uninstallation?

this is what i have in postinst now:

Code:

#!/bin/sh
# postinst script for boulderdash
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <postinst> `abort-remove'
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package


case "$1" in
    configure)
        ln -s /opt/maemo/usr/bin/boulderdash /usr/bin/
        ln -s /opt/maemo/usr/share/icons/hicolor/64x64/apps/boulderdash_64x64.png /usr/share/icons/hicolor/64x64/apps/
        chmod a+x /opt/maemo/usr/bin/boulderdash
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
        rm /usr/bin/boulderdash
        rm /usr/share/icons/hicolor/64x64/apps/boulderdash_64x64.png
    ;;

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

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0


Why are you doing the symbolics links in the postinst script instead of in the rules script ?

timperi 2010-01-12 17:40

Re: Optifying problem
 
Quote:

Originally Posted by VDVsx (Post 465285)
Why are you doing the symbolics links in the postinst script instead of in the rules script ?

Because i don't know any better. Thanks for the tip, I'll look into that rules-script :D

VDVsx 2010-01-12 19:06

Re: Optifying problem
 
Quote:

Originally Posted by timperi (Post 466734)
Because i don't know any better. Thanks for the tip, I'll look into that rules-script :D

If you put the same code in the rules script, it will solve your problem.

If you want to learn a bit more about these scripts, you can find some info here: http://www.debian.org/doc/debian-pol...erscripts.html

egoshin 2010-01-12 19:47

Re: Optifying problem
 
Quote:

Originally Posted by VDVsx (Post 466895)
If you put the same code in the rules script, it will solve your problem.

If you want to learn a bit more about these scripts, you can find some info here: http://www.debian.org/doc/debian-pol...erscripts.html

Which rules script - the reference actually describes only build time rules but not installation?

(Sorry for bother you).

mikkov 2010-01-12 19:52

Re: Optifying problem
 
Quote:

Originally Posted by timperi (Post 465082)
I optified my project, but when i uninstall it with dpkg -r, it leaves behind the symbolic links that i made in the postinst.

how can i remove these automatically during uninstallation?

this is what i have in postinst now:

Sorry, but you're doing it all wrong.

Use maemo-optify. Simplest is to make debian/optify file with "auto" in it. Then run maemo-optify-deb for debs produced with dpkg-buildpackage.

Other option is to install directly to /opt/boulderdash directory

Sasler 2010-01-12 20:10

Re: Optifying problem
 
Quote:

Originally Posted by mikkov (Post 466997)
Sorry, but you're doing it all wrong.

Use maemo-optify. Simplest is to make debian/optify file with "auto" in it. Then run maemo-optify-deb for debs produced with dpkg-buildpackage.

Other option is to install directly to /opt/boulderdash directory

Does maemo-optify work in Windows using MADDE? If not, what would be the best way to optify in Windwos?

mikkov 2010-01-12 20:16

Re: Optifying problem
 
Quote:

Originally Posted by Sasler (Post 467032)
Does maemo-optify work in Windows using MADDE? If not, what would be the best way to optify in Windwos?

I don't know. But if you're sending packages to autobuilder, maemo-optify works there. Testing before uploading hard, if it doesn't work.

Installing directly to /opt is always possible, I assume.

Sasler 2010-01-12 20:20

Re: Optifying problem
 
Quote:

Originally Posted by mikkov (Post 467045)
I don't know. But if you're sending packages to autobuilder, maemo-optify works there. Testing before uploading hard, if it doesn't work.

Yes, I am sending them to autobuilder, but I'm using Maemo Extras Assistant. Do I need to somehow to tell it to optify and how?

Quote:

Originally Posted by mikkov (Post 467045)
Installing directly to /opt is always possible, I assume.

I tried that, but I must have done something wrong, because nothing worked. ;)

mikkov 2010-01-12 20:24

Re: Optifying problem
 
Quote:

Originally Posted by Sasler (Post 467055)
Yes, I am sending them to autobuilder, but I'm using Maemo Extras Assistant. Do I need to somehow to tell it to optify and how?

auto in debian/optify file is the hint for autobuilder.

rontti 2010-01-12 20:38

Re: Optifying problem
 
Quote:

Originally Posted by Sasler (Post 467032)
Does maemo-optify work in Windows using MADDE? If not, what would be the best way to optify in Windwos?

maemo-optify is not delivered with MADDE. I think that we can add it for next MADDE release when I'm integrated it in.

VDVsx 2010-01-12 22:10

Re: Optifying problem
 
Quote:

Originally Posted by VDVsx (Post 466895)
If you put the same code in the rules script, it will solve your problem.

Actually was very wrong, I didn't looked to our script carefully, probably I was a bit sleepy :).

Anyway if you want to create symlink the best and easy option is using maemo-optify as mikkov explained.

timperi 2010-01-13 17:45

Re: Optifying problem
 
Quote:

Originally Posted by mikkov (Post 466997)
Sorry, but you're doing it all wrong.

Use maemo-optify. Simplest is to make debian/optify file with "auto" in it. Then run maemo-optify-deb for debs produced with dpkg-buildpackage.

Other option is to install directly to /opt/boulderdash directory

I can't use maemo-optify, i'm using MADDE on windows too, as Sasler is. I don't want to go the autobuilder road either, because this package isn't going to maemo.org repositories.

Installing directly to /opt is working very well so far, as i've done it already. The only problem is that i don't know how to remove the symlinks while removing the package.

I guess i could just transfer the .deb to the N900, run maemo-optify on it there, and get the package back. It seems kind of an unnecessary hassle to me. I already know where the files have to be, and i already know that there has to be some symlinks in the right places, so why can't i just make a .deb that does that automatically?

Nathan 2010-01-14 20:55

Re: Optifying problem
 
Quote:

Originally Posted by timperi (Post 468792)
Installing directly to /opt is working very well so far, as i've done it already. The only problem is that i don't know how to remove the symlinks while removing the package.

For simplicity, right now; How about you just create a postrm or prerm script in the debian folder to delete your symlink if it exists.

Quote:

I guess i could just transfer the .deb to the N900, run maemo-optify on it there, and get the package back. It seems kind of an unnecessary hassle to me. I already know where the files have to be, and i already know that there has to be some symlinks in the right places, so why can't i just make a .deb that does that automatically?
Nope, you can't just transfer the deb to the n900 and run maemo-optify on it -- thats too late in the process. maemo-optify has to run before it actually turns it into the single file package.

Now the proper method would be in the debian/rules file in the install section create a rule that creates the symlink. Then the package manager would automatically delete the symlinks for you when you de-installed.

Nathan

mikkov 2010-01-14 21:05

Re: Optifying problem
 
Quote:

Originally Posted by timperi (Post 468792)
Installing directly to /opt is working very well so far, as i've done it already. The only problem is that i don't know how to remove the symlinks while removing the package.

You shouldn't create any symlinks in postinst script. If you really need them, they should be included in the actual package. I think dh_link can help creating them http://man.he.net/man1/dh_link

timperi 2010-01-14 21:06

Re: Optifying problem
 
Quote:

Originally Posted by Nathan (Post 472104)
Now the proper method would be in the debian/rules file in the install section create a rule that creates the symlink. Then the package manager would automatically delete the symlinks for you when you de-installed.
Nathan

Thank you, i will look into the rules file, and try to figure out what to write in there to make things happen.

javispedro 2010-01-14 21:09

Re: Optifying problem
 
Quote:

Originally Posted by Nathan (Post 472104)
Nope, you can't just transfer the deb to the n900 and run maemo-optify on it -- thats too late in the process. maemo-optify has to run before it actually turns it into the single file package.

.. though you might be able to run maemo-optify-deb on it.

timperi 2010-01-14 21:14

Re: Optifying problem
 
Quote:

Originally Posted by mikkov (Post 472131)
You shouldn't create any symlinks in postinst script. If you really need them, they should be included in the actual package. I think dh_link can help creating them http://man.he.net/man1/dh_link

I had a feeling that was the wrong way, but tried it anyway :D
Now since i'm running on MADDE, and it doesn't seem to have dh_link available, i think i will have to find a way to make the symlinks some other way.

And i really need the symlinks, how else could i place everything in the /opt/... subfolders?


All times are GMT. The time now is 21:12.

vBulletin® Version 3.8.8