Skip to content

Instantly share code, notes, and snippets.

@gadenbuie
Created November 13, 2015 16:56
Show Gist options
  • Save gadenbuie/048ecead41bec86dbd7a to your computer and use it in GitHub Desktop.
Save gadenbuie/048ecead41bec86dbd7a to your computer and use it in GitHub Desktop.
Install lnav from GitHub source
#! /bin/bash
clone-lnav() {
echo "Downloading lnav..."
cd ~/Downloads
hash git &> /dev/null
if [ $? -eq 1 ]; then
sudo apt-get install git
fi
if [ $? -eq 0 ]; then
git clone https://github.com/tstack/lnav.git
else
echo 'Please install git'
exit 1
fi
}
install-dependencies() {
echo "Installing lnav dependencies..."
NEEDS='autoconf libpcre3-dev sqlite3 libsqlite3-dev libncurses5-dev libreadline-dev zlib1g-dev'
sudo apt-get install --yes --force-yes $NEEDS
}
make-lnav() {
echo "Compiling lnav..."
cd ~/Downloads/lnav
./autogen.sh || { echo >&2 "Autogen failed."; exit 1; }
./configure || { echo >&2 "Configure failed."; exit 1; }
cd ~/Downloads/lnav
make || { echo >&2 "make failed."; exit 1; }
sudo make install
}
config-lnav() {
echo "Installing zreader.log config file for lnav."
cd ~/zgateway
lnav -i zreader_lnav_config.json
cd ~/
}
clone-lnav
install-dependencies
make-lnav
config-lnav
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment