Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 25 Oct 2014, 10:50
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
How about.pet pre and post uninstall scripts?
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
_Mark_

Joined: 24 Sep 2009
Posts: 97

PostPosted: Fri 04 Feb 2011, 17:48    Post_subject:  How about.pet pre and post uninstall scripts?  

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
Back to top
View user's profile Send_private_message 
noryb009

Joined: 20 Mar 2010
Posts: 540

PostPosted: Fri 04 Feb 2011, 21:12    Post_subject:  

You can use pinstall.sh for an install script.
Back to top
View user's profile Send_private_message 
amigo

Joined: 02 Apr 2007
Posts: 2261

PostPosted: Sat 05 Feb 2011, 03:38    Post_subject:  

puppy's package manager does not support pre-install or pre-remove scripts.
Back to top
View user's profile Send_private_message 
Sit Heel Speak


Joined: 30 Mar 2006
Posts: 2595
Location: downwind

PostPosted: Sat 05 Feb 2011, 04:35    Post_subject:  

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.
Back to top
View user's profile Send_private_message 
sc0ttman


Joined: 16 Sep 2009
Posts: 2385
Location: UK

PostPosted: Sat 05 Feb 2011, 06:00    Post_subject:  

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:

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:
/petinstaller/root/petfile1.pet
/petinstaller/root/petfile2.pet
/petinstaller/pinstall.sh


And pet files an indeed contain an uninstall script, simply add:

Code:
/petinstaller/puninstall.sh


NOTE:
Doing an "installer" pet this way, is definitely NOT the recommended or accepted standard way, but it should work fine.

_________________
Akita Linux, VLC-GTK, Pup Search, Pup File Search
Back to top
View user's profile Send_private_message 
_Mark_

Joined: 24 Sep 2009
Posts: 97

PostPosted: Sat 05 Feb 2011, 17:47    Post_subject:  

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
Back to top
View user's profile Send_private_message 
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15117
Location: Paradox Realm

PostPosted: Sat 05 Feb 2011, 23:52    Post_subject:  

Flash (moderator) has probably changed the title
to something more comprehensible to our forum members.
It is not done often and is meant kindly Smile

_________________
Puppy WIKI
Back to top
View user's profile Send_private_message Visit_website 
technosaurus


Joined: 18 May 2008
Posts: 4353

PostPosted: Sun 06 Feb 2011, 01:50    Post_subject:  

Example:
http://bkhome.org/blog/?viewDetailed=02079

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send_private_message 
_Mark_

Joined: 24 Sep 2009
Posts: 97

PostPosted: Sun 06 Feb 2011, 07:38    Post_subject:  

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 Smile


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
Back to top
View user's profile Send_private_message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Sun 06 Feb 2011, 16:07    Post_subject:  

/usr/local/petget/installpkg.sh
Code:

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
Back to top
View user's profile Send_private_message Visit_website 
Sit Heel Speak


Joined: 30 Mar 2006
Posts: 2595
Location: downwind

PostPosted: Sun 06 Feb 2011, 16:35    Post_subject:  

_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.
Back to top
View user's profile Send_private_message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Mon 07 Feb 2011, 13:00    Post_subject:  

Quote:
I want to run one pre uninstall and post uninstall
Quote:
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:
if [ -f /ppreinstall.sh ];then #pet pkgs.
 chmod +x /ppreinstall.sh
 cd /
 sh /ppreinstall.sh
 rm -f /ppreinstall.sh
fi

before
Code:
cd $DLPKG_PATH
case $DLPKG_BASE in
 *.pet)

to get the possibility for backups :
Code:
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:
if [ -f /root/.packages/${DB_pkgname}.preremove ];then
 /bin/sh /root/.packages/${DB_pkgname}.preremove
 rm -f /root/.packages/${DB_pkgname}.preremove

before
Code:
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:
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
Back to top
View user's profile Send_private_message Visit_website 
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Mon 07 Feb 2011, 14:08    Post_subject:  

An workaround for a pre-install.sh would be
Code:
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 .
Back to top
View user's profile Send_private_message Visit_website 
_Mark_

Joined: 24 Sep 2009
Posts: 97

PostPosted: Mon 07 Feb 2011, 18:52    Post_subject:  

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 Very Happy but thanks for taking the time to post it all
Back to top
View user's profile Send_private_message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Mon 07 Feb 2011, 19:31    Post_subject:  

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 .
Back to top
View user's profile Send_private_message Visit_website 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0955s ][ Queries: 11 (0.0113s) ][ GZIP on ]