stow snippets

Installing git without getting screwed over when it's time to uninstall, upgrade or install package maintainer's version

Tagged git, xstow, stow  Languages bash

Although Git is one of the better source code managers it has a major drawback if you need to install it from the sources - it's makefile doesn't have an uninstall target as defined in the GNU coding standards. Therefore you might find your system screwed over when you want to uninstall or upgrade after installing from sources. This is a workaround that is sufficient enough to make me break my rule of not installing software outside of package management.

Also see the snippet for an alias for the make command first.


sudo apt-get install asciidoc xsltproc xmlto xstow bzip2 build-essential zlib1g-dev tcl8.4


cd /tmp
tar xjvf git-
sudo mv git- /usr/src
sudo ln -s /usr/src/git- /usr/src/git
cd /usr/src/git
./configure --prefix=/usr/local/stow/git
make all doc
sudo make install install-doc
cd /usr/local/stow
cat << EOF > /tmp/xstow.ini
# this is the xtow configuration file
# see xstow.ini(5) for details

# list of links that will be handled as normal directories
keep-targets = true      # add targets of the links to the keep-dirs section
link = /usr/local/tmp
link = /usr/local/var
link = /usr/local/man
link = /usr/local/share
link = /usr/local/share/man
link = /usr/local/doc
link = /usr/local/info
add-if-target = /*       # automatic add all absolute links

# directories that never should be removed
dir = /usr/local/bin
dir = /usr/local/sbin
dir = /usr/local/lib
dir = /usr/local/include
dir = /usr/local/share

ignore = *~      # emacs
ignore = core    # core file
ignore = core.*  # new style
ignore = CVS     # CVS directories
ignore-regex = [0]+README.*

# make other stow dirs public
dir = /usr/local/local/stow
dir = /usr/local/local/stow2

module = ALL
level  = 0

in-home = yes
in-stow-dir = yes
in-other-stow-dirs = yes
file = /etc/xstow.ini
file = /usr/local/local/etc/xstow.ini

absolute-paths = false
sudo mv -i /tmp/xstow.ini .
sudo xstow git


cd /usr/local/xstow
xstow -D git
sudo rm -rf /usr/local/stow/git

Kind of makes one appreciate the work done by package maintainers, doesn't it?