How about.pet pre and post uninstall scripts?

Under development: PCMCIA, wireless, etc.
Post Reply
Message
Author
_Mark_
Posts: 97
Joined: Thu 24 Sep 2009, 07:17

How about.pet pre and post uninstall scripts?

#1 Post by _Mark_ »

A question for you PET experts
Is it possible to create a pre and post uninstall script for a .pet?

I know you can create a puninstall.sh to run post un-installation script but I want to run one pre uninstall and post uninstall

Thanks
Mark

noryb009
Posts: 634
Joined: Sat 20 Mar 2010, 22:28

#2 Post by noryb009 »

You can use pinstall.sh for an install script.

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#3 Post by amigo »

puppy's package manager does not support pre-install or pre-remove scripts.

User avatar
Sit Heel Speak
Posts: 2595
Joined: Fri 31 Mar 2006, 03:22
Location: downwind

#4 Post by Sit Heel Speak »

But, of course, you can include in your .pet package a pre-uninstall script. You'll just have to instruct the user prominently somehow, upon installation, to run the pre-uninstall script first before uninstalling. And hope they remember to do so. Maybe if, when you create the .pet, you give it the description "RUN PRE-UNINSTALL-(name) BEFORE UNINSTALLING!!!" so they will see this warning when they go to click-it-to-uninstall in Puppy Package Manager. Or maybe put a pre-uninstall script icon on the desktop.

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#5 Post by sc0ttman »

You could create an "installer" pet file, which contains other pet files and a pinstall script like this one:

Example: petinstaller.pet contains this pinstall script:

Code: Select all

petget ~/petfile1.pet
petget ~/petfile2.pet
rm ~/petfile1.pet
rm ~/petfile2.pet
(the "~" means "/root")

And in your "petinstaller" pet file, you would the following files:

Code: Select all

/petinstaller/root/petfile1.pet
/petinstaller/root/petfile2.pet
/petinstaller/pinstall.sh
And pet files an indeed contain an uninstall script, simply add:

Code: Select all

/petinstaller/puninstall.sh
NOTE:
Doing an "installer" pet this way, is definitely NOT the recommended or accepted standard way, but it should work fine.
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

_Mark_
Posts: 97
Joined: Thu 24 Sep 2009, 07:17

#6 Post by _Mark_ »

Thanks for the feeback all, food for thought, will have to have a think on the best way forward.

And who changed the title of my thread, bit rude if you ask me

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#7 Post by Lobster »

Flash (moderator) has probably changed the title
to something more comprehensible to our forum members.
It is not done often and is meant kindly :)
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#8 Post by technosaurus »

Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

_Mark_
Posts: 97
Joined: Thu 24 Sep 2009, 07:17

#9 Post by _Mark_ »

Lobster wrote:Flash (moderator) has probably changed the title
to something more comprehensible to our forum members.
It is not done often and is meant kindly :)
You are assuming that my original title was not comprehensible!

All that was added was the "How about" which to me sounds a bit daft considering the nature of the question

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#10 Post by Karl Godt »

/usr/local/petget/installpkg.sh

Code: Select all

if [ -f /pinstall.sh ];then #pet pkgs.
 chmod +x /pinstall.sh
 cd /
 sh /pinstall.sh
 rm -f /pinstall.sh
fi
if [ -f /install/doinst.sh ];then #slackware pkgs.
 chmod +x /install/doinst.sh
 cd /
 sh /install/doinst.sh
 rm -rf /install
fi
#v424 .pet pkgs may have a post-uninstall script...
if [ -f /puninstall.sh ];then
 mv -f /puninstall.sh /root/.packages/${DLPKG_NAME}.remove
fi
A dotpet is made at "/" :
mkdir /MYDOTPETNAME-VERSION
mkdir /MYDOTPETNAME-VERSION/etc
mkdir ALLDIRS
do not forget
mkdir /MYDOTPETNAME-VERSION/usr/local/lib/X11/mini-icons
mkdir /MYDOTPETNAME-VERSION/usr/share/applications

echo > /MYDOTPETNAME-VERSION/pinstall.sh
echo > /MYDOTPETNAME-VERSION/puninstall.sh
geany /MYDOTPETNAME-VERSION/pinstall,sh
geany /MYDOTPETNAME-VERSION/puninstall.sh

save the p[un]install.sh
and run dir2pet

User avatar
Sit Heel Speak
Posts: 2595
Joined: Fri 31 Mar 2006, 03:22
Location: downwind

#11 Post by Sit Heel Speak »

_Mark_ wrote:And who changed the title of my thread, bit rude if you ask me
My guess is, the title with the leading dot caused a problem when trying to load it, or maybe when trying to locally save it, in the moderator's browser. Opera had no trouble with this thread as originally titled.

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#12 Post by Karl Godt »

I want to run one pre uninstall and post uninstall
puppy's package manager does not support pre-install or pre-remove scripts.
I really think that is a suggestion for the installpkg.sh :

Code: Select all

if [ -f /ppreinstall.sh ];then #pet pkgs.
 chmod +x /ppreinstall.sh
 cd /
 sh /ppreinstall.sh
 rm -f /ppreinstall.sh
fi
before

Code: Select all

cd $DLPKG_PATH
case $DLPKG_BASE in
 *.pet)
to get the possibility for backups :

Code: Select all

if test -d /root/.PKG ; then mv /root/.PKG /root/.PKG-instNEWPKG.bak; fi
if test -f /usr/bin/PKGBIN ; then mv /usr/bin/PKGBIN /usr/bin/PKGBIN-instNEWWPKG.bak;fi
and the /usr/local/petget/removepreview.sh
could have something like

Code: Select all

if [ -f /root/.packages/${DB_pkgname}.preremove ];then
 /bin/sh /root/.packages/${DB_pkgname}.preremove
 rm -f /root/.packages/${DB_pkgname}.preremove
before

Code: Select all

export REM_DIALOG="<window title=\"Puppy Package Manager\" icon-name=\"gtk-about\">
  <vbox>
   <pixmap><input file>/usr/local/lib/X11/pixmaps/question.xpm</input></pixmap>
   <text><label>Click 'OK' button to confirm that you wish to uninstall package '$DB_pkgname'</label></text>
which would need

Code: Select all

if [ -f /ppreuninstall.sh ];then
 mv -f /ppreuninstall.sh /root/.packages/${DLPKG_NAME}.preremove
fi
if [ -f /ppostuninstall.sh ];then
 mv -f /ppostuninstall.sh /root/.packages/${DLPKG_NAME}.postremove
fi
at /usr/local/petget
actually the pinstall.sh and puninstall.sh are getting executed after the main part of the [un]installation and are practically postp[un]install.sh

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#13 Post by Karl Godt »

An workaround for a pre-install.sh would be

Code: Select all

mkdir /MYPKGNAME
mkdir /MYPKGNAME/MYPKGNAME
mkdir /MYPKGNAME/MYPKGNAME/usr[etc root ...]
which would install the PKG at "/"
and let the pinstall.sh `cp -r /MYPKGNAME/* /` and `rm -r /MYPKGNAME` at the very end of it .

_Mark_
Posts: 97
Joined: Thu 24 Sep 2009, 07:17

#14 Post by _Mark_ »

Thanks for all the feedback all, I have now reworked things and now don't need a pinstall or puninstall

Karl Godt

While I'm sure all the information you gave is excellent I didn't understand half of it :D but thanks for taking the time to post it all

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#15 Post by Karl Godt »

I must say , that I did not really understood the initial question either . I thought it would have been a typing mistake :wink:

But after reading the whole page several times i think that i even got sc0ttman's post :

Just create a preinstallscript that downloads the real package via wget or curl and installs it and a postinstallscript to remove everything .

And about a dot at the begining of the headline : I don't know if this forces this thread to be a hidden folder on the server .

Post Reply