maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   The Grand DEB Packaging Thread! (https://talk.maemo.org/showthread.php?t=80914)

Saturn 2012-08-25 22:14

Re: The Grand DEB Packaging Thread!
 
Quote:

Originally Posted by flotron (Post 1255160)
I packaged a theme and it installs without problems in its own folder, ok thats done. But i want To know for ex. I modify some file in the base folder, but when i uninstall (the theme) i want that the base folder go back to previous state, i mean that if any file was edited or deleted in the deb installing process when uninstall restore all that.
How can i tell meego that remember that when someone uninstall restore those files previous state?

Debian packaging allows you to have a file that is executed in the uninstallation. Put it in the debian folder and name it as postrm

here is an advanced example of something I'm using (it will execute different options depending on what the user asked, i.e. upgrade, remove or purge):

Code:

#!/bin/sh
echo "BEGIN postremove"

case "$1" in
upgrade*)
    echo Leaving files for use by upgrading version. 1>&2
    ;;
remove*)
    rm -f /etc/sudoers.d/cleven.sudoers
    update-sudoers
    ;;
purge*)
    rm -rf /opt/cleven
    rm -rf /home/user/.cleven
    update-sudoers
    ;;
esac
echo "  END of postremove"


flotron 2012-08-27 02:58

Re: The Grand DEB Packaging Thread!
 
Thank you Saturn but that is pure chinese for me :(

I saw in some deb packages something like this, for ex.:
theme.ini and below theme.ini.backup (or something like that, this is not exactly).

I assume that the files with the .backup extension will be restored after uninstallation.

Does anyone know something like this? It is possible?

I think that this method should make a backup of each file that would be replaced/edit/deleted with a .backup extension

thedead1440 2012-08-27 03:18

Re: The Grand DEB Packaging Thread!
 
your prerm file can contain the commands for replacing back the original files...

flotron 2012-08-27 23:39

Re: The Grand DEB Packaging Thread!
 
Quote:

Originally Posted by thedead1440 (Post 1256080)
your prerm file can contain the commands for replacing back the original files...

How would be a prerm script to replace "/usr/share/themes/base/meegotouch/libsysuid-screenlock-nokia/style/libsysuid-screenlock-nokia.css" to libsysuid-screenlock-nokia.css.backup

And then a postrm script to restore that .backup file?

If could someone post an example so i can get a better idea

flotron 2012-08-28 14:52

Re: The Grand DEB Packaging Thread!
 
Where i make the mistake in the preinst?

Code:

#!/bin/bash
mv /usr/share/themes/base/meegotouch/libsysuid-screenlock-nokia/style/libsysuid-screenlock-nokia.css /usr/share/themes/base/meegotouch/libsysuid-screenlock-nokia/style/libsysuid-screenlock-nokia.css.bkp
rm /usr/share/themes/base/meegotouch/libsysuid-screenlock-nokia/style/libsysuid-screenlock-nokia.css
exit 0


F2thaK 2012-08-28 23:04

Re: The Grand DEB Packaging Thread!
 
Code:

#!/bin/bash

mv -f /usr/share/themes/base/meegotouch/libsysuid-screenlock-nokia/style/libsysuid-screenlock-nokia.css /usr/share/themes/base/meegotouch/libsysuid-screenlock-nokia/style/libsysuid-screenlock-nokia.css.bkp
rm -rf /usr/share/themes/base/meegotouch/libsysuid-screenlock-nokia/style/libsysuid-screenlock-nokia.css

exit 0

+ blank line @ end

Saturn 2012-08-29 23:17

Re: The Grand DEB Packaging Thread!
 
@flotron replace also #!/bin/bash with #!/bin/sh
because bash is not by default installed, but sh is.

flotron 2012-08-29 23:55

Re: The Grand DEB Packaging Thread!
 
Quote:

Originally Posted by Saturn (Post 1257604)
@flotron replace also #!/bin/bash with #!/bin/sh
because bash is not by default installed, but sh is.

Gonna try that because i get "install interrupted. Try again?", maybe this will fix that

peterleinchen 2012-08-30 19:33

Re: The Grand DEB Packaging Thread!
 
For sure use sh instead of bash.

And I assume, that 'exit 0' will exit the installation, not only this script. Just remove that.
And there should be no need for a blank line at the end, but it does not hurt also.

flotron 2012-09-01 21:10

Re: The Grand DEB Packaging Thread!
 
Quote:

Originally Posted by peterleinchen (Post 1258101)
For sure use sh instead of bash.

And I assume, that 'exit 0' will exit the installation, not only this script. Just remove that.
And there should be no need for a blank line at the end, but it does not hurt also.

I change bash to sb and remove exit 0 and still get "install interrupted" try again?

Maybe i need some permission to modify that file?
"/usr/share/themes/base/meegotouch/libsysuid-screenlock-nokia/style/libsysuid-screenlock-nokia.css"


All times are GMT. The time now is 09:29.

vBulletin® Version 3.8.8