Skip to content

Instantly share code, notes, and snippets.

@salewski
Last active February 17, 2018 20:06
Show Gist options
  • Save salewski/6ae376bfffb3b282f634aeba1c1b4515 to your computer and use it in GitHub Desktop.
Save salewski/6ae376bfffb3b282f634aeba1c1b4515 to your computer and use it in GitHub Desktop.
vagrantfile-keepalived-doc-build-centos7
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile for verifying CentOS 7-based documentation updates for
# keepalived issue #761:
#
# https://github.com/acassen/keepalived/issues/761
#
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "centos/7"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
config.vm.box_check_update = false
# AL.NOTE (2018-01-27): It's a minor annoyance that the CentOS 7 vagrant
# boxes are built with the yum 'nodocs' option to keep the image
# sizes small, but it is a MAJOR annoyance that the package
# management tools (rpm and yum) show all the correct packages being
# installed, yet most of the ../man/manN/ directories are empty. For
# example, check out the following nonsense from a pristine
# installation; the tools indicate that the 'yum' package is
# currently installed and that it installed the yum.conf(5) page,
# but the file just isn't there.
#
# [vagrant@localhost ~]$ rpm -ql yum | grep man
# /usr/share/man/man5/yum.conf.5
# /usr/share/man/man8/yum-shell.8
# /usr/share/man/man8/yum.8
# /usr/share/yum-cli/yumcommands.py
# /usr/share/yum-cli/yumcommands.pyc
#
# [vagrant@localhost ~]$ ls -al /usr/share/man/man5/
# total 0
# drwxr-xr-x. 2 root root 26 Jan 23 10:52 .
# drwxr-xr-x. 24 root root 282 Jan 23 10:51 ..
# lrwxrwxrwx. 1 root root 32 Jan 23 10:52 aliases.5.gz -> /etc/alternatives/mta-aliasesman
#
# To get the man pages, you need to reinstall the package that
# provides them. At the very least, the 'man-pages', 'rpm', 'yum',
# and 'bash' packages are essential, so we reinstall those here.
# There are tons of others you'll notice missing, too (e.g.,
# those for gnupg, grub2-tools, ...), but we are just dealing here
# with the absolute essentials. Note that we check to see if
# 'man man' results in finding a man page before doing the yum
# 'reinstall' operation; we don't want to do that every time we boot
# the box.
#
# Other packages:
#
# For building most things:
#
# git gcc automake autoconf
#
# Prereqs for building/running keepalived:
#
# openssl-devel libnl3-devel ipset-devel iptables-devel libnfnetlink-devel
# + For SNMP support: net-snmp-devel
# + For DBUS support: glib2-devel
# + For JSON support: json-c-devel
#
# + For building the documentation: python-sphinx epel-release
#
# Note: CentOS 7 uses python-sphinx version 1.1.3-11.el7
# If the keepalived 'configure' process does not
# find sphinx-build, then it will determine that you
# do not wish to build the documentation. That is,
# if you then do 'make html', the build process will
# not error out -- it will think there is nothing to
# do.
#
# Note: The 'epel-release' package has the effect of adding
# the "Extra Packages for Enterprise Linux" (EPEL)
# RPM repository to the list of package repos
# referenced by yum. We need this for the
# 'python-sphinx_rtd_theme' package, which is not
# available in the stock CentOS. The EPEL repository
# is managed by the EPEL Group (a Special Interest
# Group within the Fedora project); see:
#
# https://fedoraproject.org/wiki/About_EPEL
#
# The EPEL package are specifically tailored to be
# compatible with CentOS (and other RHEL compatible
# derivatives).
#
config.vm.provision "shell", inline: <<-SHELL
PAGER=/usr/bin/cat man man > /dev/null 2>/dev/null || yum -y reinstall man-pages rpm yum bash
yum -y install git gcc automake autoconf
yum -y install openssl-devel libnl3-devel ipset-devel iptables-devel libnfnetlink-devel
yum -y install python-sphinx epel-release
yum -y install python-sphinx_rtd_theme
SHELL
# Upon login (as the 'vagrant' user):
#
# $ mkdir src
#
# $ cd src
# $ git clone https://github.com/acassen/keepalived.git
#
# $ cd keepalived
#
# $ sed -i.bak \
# -e 's/^\(html_theme = '"'"'sphinx_rtd_theme'"'"'\)/import sphinx_rtd_theme\n\1/' \
# -e 's/^#\(html_theme_path = [[]sphinx_rtd_theme[.]get_html_theme_path[(][)][]]\)/\1/' doc/source/conf.py
#
# $ find . -exec touch -r configure {} +
#
# $ ./configure --prefix=/tmp/blah-keepalived-build
# $ make html
#
# CentOS provides the 'python-sphinx' package (version 1.1.3), but that
# is not enough to build the documentation without error:
#
# $ make html
# ...
# make[1]: Entering directory `/home/vagrant/src/keepalived/doc'
# sphinx-build -b html -d build/doctrees -D latex_paper_size=a4 source build/html
# Making output directory...
# Running Sphinx v1.1.3
# loading pickled environment... not yet created
#
# Theme error:
# no theme named 'sphinx_rtd_theme' found (missing theme.conf?)
# make[1]: *** [html] Error 1
# make[1]: Leaving directory `/home/vagrant/src/keepalived/doc'
# make: *** [html-recursive] Error 1
#
# "Extra Packages for Enterprise Linux" (EPEL) RPM repository, managed by
# the EPEL Group (a Special Interest Group within the Fedora project):
#
# https://fedoraproject.org/wiki/About_EPEL
#
# # yum repolist
# Loaded plugins: fastestmirror
# Loading mirror speeds from cached hostfile
# * base: repo1.ash.innoscale.net
# * extras: mirror.wdc1.us.leaseweb.net
# * updates: mirror.compevo.com
# repo id repo name status
# base/7/x86_64 CentOS-7 - Base 9,591
# extras/7/x86_64 CentOS-7 - Extras 329
# updates/7/x86_64 CentOS-7 - Updates 1,909
# repolist: 11,829
# [root@localhost vagrant]# rpm -qa | grep -i epel
# [root@localhost vagrant]# yum list available | grep -i epel
# epel-release.noarch 7-9 extras
#
#
# # yum install epel-release
#
# ...
#
# # yum -y install wget
# # wget -nd 'https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/26/Everything/x86_64/os/Packages/f/fontawesome-fonts-4.7.0-2.fc26.noarch.rpm'
# # wget -nd 'https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/26/Everything/x86_64/os/Packages/f/fontawesome-fonts-web-4.7.0-2.fc26.noarch.rpm'
# # rpm -i --nodeps --force ./fontawesome-fonts-4.7.0-2.fc26.noarch.rpm ./fontawesome-fonts-web-4.7.0-2.fc26.noarch.rpm
#
#
# To be able to build the LaTeX and/or PDF documenation, you additionally
# need to:
#
# # yum -y install latexmk texlive texlive-titlesec texlive-framed texlive-threeparttable texlive-wrapfig texlive-multirow
#
# I know... that looks broken to me, too. But once you do that, then you can:
#
# $ cd doc
# $ make latexpdf
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment