Reply
Thread Tools
Saturn's Avatar
Posts: 1,648 | Thanked: 2,122 times | Joined on Mar 2007 @ UNKLE's Never Never Land
#101
Originally Posted by flotron View Post
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"
 

The Following User Says Thank You to Saturn For This Useful Post:
flotron's Avatar
Posts: 418 | Thanked: 506 times | Joined on Jan 2012 @ Argentina
#102
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

Last edited by flotron; 2012-08-27 at 23:31.
 
Moderator | Posts: 6,215 | Thanked: 6,400 times | Joined on Nov 2011
#103
your prerm file can contain the commands for replacing back the original files...
 

The Following User Says Thank You to thedead1440 For This Useful Post:
flotron's Avatar
Posts: 418 | Thanked: 506 times | Joined on Jan 2012 @ Argentina
#104
Originally Posted by thedead1440 View Post
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's Avatar
Posts: 418 | Thanked: 506 times | Joined on Jan 2012 @ Argentina
#105
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's Avatar
Posts: 4,365 | Thanked: 2,467 times | Joined on Jan 2010 @ Australia Mate
#106
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
 

The Following User Says Thank You to F2thaK For This Useful Post:
Saturn's Avatar
Posts: 1,648 | Thanked: 2,122 times | Joined on Mar 2007 @ UNKLE's Never Never Land
#107
@flotron replace also #!/bin/bash with #!/bin/sh
because bash is not by default installed, but sh is.
 

The Following 2 Users Say Thank You to Saturn For This Useful Post:
flotron's Avatar
Posts: 418 | Thanked: 506 times | Joined on Jan 2012 @ Argentina
#108
Originally Posted by Saturn View Post
@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's Avatar
Posts: 4,117 | Thanked: 8,901 times | Joined on Aug 2010 @ Ruhrgebiet, Germany
#109
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's Avatar
Posts: 418 | Thanked: 506 times | Joined on Jan 2012 @ Argentina
#110
Originally Posted by peterleinchen View Post
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"
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 17:17.