LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   installpkg but in reverse? (https://www.linuxquestions.org/questions/slackware-14/installpkg-but-in-reverse-4175652098/)

Okie 04-13-2019 03:32 PM

installpkg but in reverse?
 
has anybody ever had a need to uninstall a package but instead of removepkg just deleting the files have a package tool that moves them to /tmp/[package-name]/ including their required symlinks and runs makepkg back in to a package for reinstalling at a later time

not too often, but once in a while i wished i had something that could do that

RandomTroll 04-13-2019 03:59 PM

You can write a script that reads the installation file in /var/log/packages

LuckyCyborg 04-13-2019 04:07 PM

From the manual of removepkg
Code:

      --preserve packagename
              If specified, the complete package subtree is reconstructed in /var/lib/pkgtools/setup/tmp/preserved_packages/packagename.

However, I do not think that it is capable to reconstruct completely packages which contains /etc files which are renamed or have the permissions changed on installation, or they are already tuned by user.

Okie 04-13-2019 04:17 PM

LuckyCyborg, i will give that a try on a non test package to see how well it does, thanks i did not know --preserve was even there, and ya on the modified /etc/ files if it at least saves a copy i can always fix it since i dont do much in /etc unless necessary (if it aint broke, dont fix it)

Okie 04-13-2019 04:24 PM

1 Attachment(s)
Random Troll, can the mv command read those files in /var/log/packages and move the listed files somewhere like /tmp/[package-name] ?

-----

this is what removepkg --preserve did

Didier Spaier 04-13-2019 04:27 PM

Not an answer to your question, but why not save the package somewhere, if you think it could become unavailable from the servers?

Okie 04-13-2019 04:35 PM

Didier it might be the answer but it is a solution, but not a solution that is always available, like if i am out camping far away and i dont have internet access, i like the idea that if i can keep an old package archived on my drive somewhere just in case i need it later,

i plan to spend some time in the south west deserts of the USA soon and there wont always be internet access, i think that --preserve option with removepkg will do it

LuckyCyborg 04-13-2019 05:27 PM

Quote:

Originally Posted by Okie (Post 5984666)
this is what removepkg --preserve did

Yes, the "--preserve" flag preserves the files on a reconstructed package, WHEN that particular package is removed from system.

Sorry, but I do not know certainly what you intend to do and certainly I do not intend to go the ol' RTFM, however you can see all available options doing "man removepkg"

BTW, if I remember right, another alternative is "removepkg --copy" which reconstruct the package WITHOUT removing it from system.

RandomTroll 04-13-2019 11:58 PM

Quote:

Originally Posted by Okie (Post 5984666)
Random Troll, can the mv command read those files in /var/log/packages and move the listed files somewhere like /tmp/[package-name]

Look for yourself. It has the full file name minus the initial slash. The other options people have mentioned look better. I'm no expert. This doesn't resolve conflicts, i.e., if a file appears in another package.

Because I spent years without an Internet connection I keep a copy of every package I use. You may find makepkg more useful. I just remembered it and have never used it. One would think it could use a package definition.

solarfields 04-14-2019 04:00 AM

Check this post by Ruarí:
https://www.linuxquestions.org/quest...2/#post5139643


All times are GMT -5. The time now is 09:44 AM.