How to uninstall with a script? - Solved

Issues and / or general discussion relating to Puppy

Moderator: Forum moderators

Post Reply
mow9902
Posts: 195
Joined: Fri Jul 24, 2020 11:57 pm
Has thanked: 15 times
Been thanked: 61 times

How to uninstall with a script? - Solved

Post by mow9902 »

Hi - I realize that one would normally uninstall a PET package by using the uninstall function in the PPM.

However, I have a particular situation where I would like to be able to uninstall via a script. Is this possible? ie I would like to create a script to:
1. install a PET
2. ....use the installed application
3. uninstall the PET
4. restart-x

The main reason for doing it this way is that the application in question (chinese input) changes my system fonts (which it needs to do). This is necessary while I am using the app, but once I have finished I would like to set the fonts back the way they would normally be.

If there is another way to do this I'm grateful to take suggestions.

I am using Fossapup64 with kernel 5.4.53.

Thanks

Replies were much appreciated - problem solved - thank you all.

Last edited by mow9902 on Sat Jun 04, 2022 10:36 pm, edited 1 time in total.
User avatar
amethyst
Posts: 2414
Joined: Tue Dec 22, 2020 6:35 am
Has thanked: 57 times
Been thanked: 504 times

Re: How to uninstall with a script?

Post by amethyst »

This is a good one. The real problem comes at uninstalling the pet because there are several scripts involved to achieve this. I do have 2 scripts that makes the process quicker . For installing my script basically tries to eliminate all ((or limit)) the pop-up screens. For uninstall the best I can come up with is a script that opens the Package Manager. If you only need to use an application temporarily during a session I would rather suggest converting that specific pet file to an sfs file. sfs files can be loaded and unloaded very quickly with a script(s)...but the problem here is that this will probably not work for you due to the fact that the sfs is loaded "underneath" the base sfs, so your new fonts will not have preference. A user published an application called sfs_load-above. The latter is an application to load the sfs "above" the base sfs which is what you want in this case. I would use it with care though but it could work for you.
I attach it here (remove the fake .gz extension). Personally, I would stick with installing and uninstalling the pet as this is the safer option in this scenario. I attach my 2 scripts here (don't know if it will work with Fossa, I don't have that Puppy). These are right-click scripts so you need to place it in the "Open With" menu.

PS - Okay, I've checked out the sfs_load-above utility. It works but seems an addition to the builtin sfs_load module. This is what I did - I extracted the 2 files from the sfs_load-above package, then renamed that sfs_load script to sfs_load-above and then copied the 2 files to /usr/sbin. Now you can run the sfs_load-above script whenever needed. To unload the sfs, you do not have to run the sfs_load-above script again but can use this command:

Code: Select all

sfs_load -u -c -q- LocationAndNameOfSfs

[/b]

Attachments
QuickPetInstallUninstall.zip
(3.93 KiB) Downloaded 28 times
sfs_load-above-4.sfs.gz
(24 KiB) Downloaded 25 times
Last edited by amethyst on Tue May 31, 2022 9:47 am, edited 3 times in total.
User avatar
MochiMoppel
Posts: 1232
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 21 times
Been thanked: 437 times

Re: How to uninstall with a script?

Post by MochiMoppel »

mow9902 wrote: Mon May 30, 2022 10:40 pm

Hi - I realize that one would normally uninstall a PET package by using the uninstall function in the PPM.

However, I have a particular situation where I would like to be able to uninstall via a script. Is this possible? ie I would like to create a script to:
1. install a PET
2. ....use the installed application
3. uninstall the PET
4. restart-x

So you also want to install via script, not just uninstall? If the PET doesn't contain pinstall/puninstall scripts and doesn't overwrite existing files then installation (without using PPM) could be fairly simple. Basically all that is needed is extracting the files contained in the PET and - if required - updating the menu.

Later you could uninstall (=delete) the extracted files, provided you haven't deleted the PET file or a least keep a list of the extracted files.

User avatar
rerwin
Posts: 156
Joined: Fri Jul 17, 2020 4:35 pm
Location: Maine, USA
Has thanked: 1 time
Been thanked: 82 times

Re: How to uninstall with a script?

Post by rerwin »

mow9902 wrote: Mon May 30, 2022 10:40 pm

I would like to be able to uninstall via a script. Is this possible? ie I would like to create a script to:
1. install a PET
2. ....use the installed application
3. uninstall the PET
4. restart-x

Try this:
1. petget (petname)
2. ....use the installed application
3. petget -(petname)
4. restartwm

User avatar
amethyst
Posts: 2414
Joined: Tue Dec 22, 2020 6:35 am
Has thanked: 57 times
Been thanked: 504 times

Re: How to uninstall with a script?

Post by amethyst »

petget -(petname)

Thanks!!! :thumbup:

User avatar
norgo
Posts: 283
Joined: Mon Jul 13, 2020 6:39 pm
Location: Germany
Has thanked: 6 times
Been thanked: 111 times
Contact:

Re: How to uninstall with a script?

Post by norgo »

to remove packages you can use pkg

example to remove a package

Code: Select all

pkg u package

example to remove multiple packages at once

Code: Select all

pkg u package1 package2 package3

example to install a package

Code: Select all

pkg i package

to remove builtin packages use this command
example

Code: Select all

remove_builtin packagename
Post Reply

Return to “Users”