UNinstalling Gramps

the first thing i want to do in my fresh install script (after asking if all the trees have been backed up) is uninstall the current version of Gramps being sure all the files have been removed. on Ubuntu (and surely on Debian) all i would need to do is “dpkg --purge gramps”. but how would i do this if Gramps has been built from source? does building from source on Ubuntu/Debian do the install or create a “.deb” file to be separately installed? if the former, is there a safe way to uninstall it? any leftover files from a previous version might revert behavior of old cold still in a newer version (e.g. no longer having the file might workaround a problem).

# Next time you need to install something with python setup.py -- which should be never but things happen. 

python setup.py install --record files.txt

# This will cause all the installed files to be printed to that directory.
# Then when you want to uninstall it simply run; be careful with the 'sudo'

cat files.txt | xargs sudo rm -rf

credit goes to

@myusuf3

myusuf3/ uninstall.sh for the gist on github,

what if it was previously installed without the person running the script having any idea how or even if it had been done. my first idea is to check dpkg. if it hast it in its list, then i would have dpkg purge it. beyond that i need to work things out. i’m sure this script will evolve over time.

Hi Phil,
I don’t know which version you installed from source. But let’s assume you had v5.1.2, which you obtained from ‘https://github.com/gramps-project/gramps/releases’ (click on ‘Assets’ to see the files). After unzipping the source in any folder you will see a file named “INSTALL”. This contains install and uninstall instructions. Reading it with any editor gives:

Uninstall old version
If you do a source install in the same place as an existing install,
you need to remove the old version first. You can delete the old
version by deleting the installed directories. For example, if your installation prefix is /usr/local, remove the following:
/usr/local/share/gramps
/usr/local/lib/pythonx.x/site-packages/gramps
If you installed with a package manager you might instead need to remove
/usr/local/lib/pythonx.x/dist-packages/gramps

replacing pythonx.x with the python version you used, e.g. python3.4.
Also remove any gramps .egg files that are installed along with the gramps
directory and the file /usr/local/bin/gramps.

If you don’t know the list of all files that Gramps installed, you can
reinstall it with the --record option, and take a look at the list this
produces (so python setup.py install --record grampsfiles.txt

Gramps is a python application, so loading happens on reading the
files, meaning that files of a previous version that are no longer
present in the new version can still be loaded, making the new install
unstable!

There is more to read in this file, I hope this will help you a bit further.
Besides: https://www.gramps-project.org/wiki/index.php/Linux:Build_from_source

i am trying to make my script work regardless of which version and/or which way (dpkg or source). i might decide to have it compare versions between what is already installed and what is trying to be installed. if they are the same i could have it report that and ask if they really want to re-install all over again and skip asking if all the trees are backed up. re-installing the existing version in order to record existing files would not be possible if that version is no longer available for download.

yes, i am aware of the problems of leftover files. that’s why i want my script to be sure the old files are cleared out. there is also the risk of a file outside of a “gramps directory” that collides with some other package. are all files supposed to be in a “gramps” directory or named “gramps”?

I am not sure if the main Gramps program is installed in directories named ‘Gramps’ only. As stated above you should check by yourself:
“If you don’t know the list of all files that Gramps installed, you can
reinstall it with the --record option, and take a look at the list this
produces (so python setup.py install --record grampsfiles.txt”.
But not all files needed are installed automatically, see prerequisites list on https://github.com/gramps-project/gramps (for example: osmgpsmap, graphiz, networkx).

are you referring to files needed that are from different packages that Gramps needs?

what if i am installing a .deb file using “dpkg -i”? where does --record go then?

the github page you pointed me to says “The following three packages with GObject Introspection bindings (the gi packages)” then lists eight packages.

what is the oldest version of Gramps my script could ever encounter already installed by someone using it on a Linux system?

Linux is the native OS for Gramps. That’s why there are so many flavors of the OS with a Gramps version as a standard download.

Previous releases go back to 0.1.2 in Apr 2001

where can i download ALL of those previous releases so that i can record an installed file list for each one?

does github have downloadable source code for each version? usually, i run “svn export” to grab project repository source code from github, but that’s not working for gramps, not even for version 5.1.3.

or maybe i should just not bother having my script clean up for a fresh install and abort if it sees /usr{,/local}/bin/gramps.

Just my opinion but… I think that auto uninstall of any version with an incompatible database format is asking for trouble. The uninstall of those earlier versions should be refused with a warning to export/backup to the Gramps XML format (whether compressed or not).

People skipping that many versions need some pushback… particularly important is to make sure they have adequately tested their backups. I’ve seen too many horror stories from IT Pros who discovered (after their 1st disaster) that none of their daily backups were usable.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.