HTB

From HerzbubeWiki
Jump to navigation Jump to search

HTB is an acronym for "herzbube's toolbox". The HTB is a collection of useful programs, usually bash shell scripts, that I (herzbube) originally created in the 1990'ies for making my work-related tasks as an SCO Unix sysadmin a little bit more comfortable. Since then I have adapted the collection to run on Debian Linux and Mac OS X, and I have added a few more scripts that help me with administrating my private Linux server.

This page shows how I integrate the HTB into the shell environment of my Dedicated Server pelargir.


References


Setup on pelargir

Filesystem location

The HTB default is to install everything in /usr/local. Instead, I prefer an independent setup where the HTB is not intermingled with other stuff in /usr/local. The installation process thus becomes a simple git clone operation into

/usr/local/htb


Cloning the Git repo

This creates a read-only clone of the HTB repository:

cd /usr/local
git clone https://git.herzbube.ch/git/htb.git


Because I have direct access to the bare Git repo hosted on pelargir, it would have been nice to clone directly from that repo:

git clone /var/lib/gitolite3/repositories/htb.git

The idea was that this would let me push local changes back to the main repo without any undue indirectness. Unfortunately this does not work because the update hook (written in Perl) installed by gitolite barfs up an error message due to missing Perl dependencies. These dependencies probably are available only if the update hook is run while logged in as user gitolite3.


Shell integration

Because I like to have the HTB available for every user, I am setting up the HTB system-wide, i.e. I am manipulating files in /etc.


This is necessary for login shells:

root@pelargir:~# cat /etc/profile.d/pelargir_htb.sh 
. /usr/local/htb/etc/htb-profile.sh


For subshells the following must be added to /etc/bash.bashrc:

HTB_BASE_DIR=/usr/local/htb
. $HTB_BASE_DIR/etc/htb-bashrc.sh