Map of CentOS 5.5 x86_64 Minimal Install

I worked out a bash script today to generate a GraphViz dot file for visualizing CentOS/RHEL/Fedora yum dependencies.  (See below.. script is after the break) -joshua

Here is my barebones install of CentOS 5.5 x86_64 on a Fedora14-based VirtualBox.

Here is what the output of my script looks like.

[root@server gdeps]# ./gdeps.bash openssh openssl glibc bash | tee test.dot
 digraph centos5 {
 size="64,64";
 node [color=lightblue2, style=filled];
 "audit-libs" -> "openssh";
 "e2fsprogs-libs" -> "openssh";
 "fipscheck-lib" -> "openssh";
 "glibc" -> "openssh";
 "initscripts" -> "openssh";
 "krb5-libs" -> "openssh";
 "libselinux" -> "openssh";
 "nspr" -> "openssh";
 "nss" -> "openssh";
 "openssl" -> "openssh";
 "util-linux" -> "openssh";
 "zlib" -> "openssh";
 "bash" -> "openssl";
 "e2fsprogs-libs" -> "openssl";
 "glibc" -> "openssl";
 "krb5-libs" -> "openssl";
 "mktemp" -> "openssl";
 "zlib" -> "openssl";
 "basesystem" -> "glibc";
 "glibc-common" -> "glibc";
 "libgcc" -> "glibc";
 "glibc" -> "bash";
 "libtermcap" -> "bash";
 "mktemp" -> "bash";
 }

 [root@server gdeps]# dot -Tpng test.dot > test.png

^ creates a graph based on the text data

(script after break)

[root@server gdeps]# cat gdeps.bash

#!/bin/bash
# gdeps.bash

# INITIALIZE
#set -x            # uncomment to debug
set -e             # exit on ANY error (leave this on, unless debugging)
shopt -s -o nounset   # turn off shell aliases and variables
shopt -s -o noclobber # trun off redirection file overwrites

# DECLARE BASE VARIABLES
declare -r \
 GDEPS_NAME="${0##*/}" \
 GDEPS_TITLE=gdeps \
 GDEPS_VER=0.0.1

# CHECK ARGUMENTS
#if [[ ${#} -ne 0 ]] ; then
#    printf "FAIL: No arguments needed.\n"
#    exit 1
#fi

# GET PKGS INSTALLED LIST
declare -r PKGS_INSTALLED=${*}
#declare -r PKGS_INSTALLED=$(\
#    yum list installed \
#        | grep -v '^ \|^Adding\|^Loaded\|^Installed' \
#        | awk '{ print $1 }' \
#        | awk -F. '{ print $1 }' \
#        | sort -u \
#        | tr '\n' ' ')

# PRINT DOT HEADER
printf "digraph f14 {\n"
printf "    size=\"12,12\";\n"
printf "    node [color=lightblue2, style=filled];\n"

# GET DEPS!
for PKG_INSTALLED in ${PKGS_INSTALLED} ; do
 declare PKG_DEPS=$(\
 yum deplist ${PKG_INSTALLED} \
 | grep '   provider: ' \
 | awk '{ print $2 }' \
 | awk -F. '{print $1 }' \
 | sort -u \
 | tr '\n' ' ')
 if [[ ${PKG_DEPS} == '' ]] ; then
 printf '        '
 printf '"NoDeps" -> '
 printf "\"${PKG_INSTALLED}\";\n"
 fi
 for PKG_DEP in ${PKG_DEPS} ; do
 if [[ ${PKG_DEP} != "${PKG_INSTALLED}" ]] ; then
 printf '        '
 printf "\"${PKG_DEP}\" -> "
 printf "\"${PKG_INSTALLED}\";\n"
 fi
 done
done

# PRINT FOOTER
printf "}\n"

# TERMINATE
exit
Advertisements
Tagged , , , , , , , ,

One thought on “Map of CentOS 5.5 x86_64 Minimal Install

  1. This is great! This graphing function has potential for all sorts of things, I think.

    Please send me a copy of your bare-bones Kickstart file.

    Z

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: