Automatic installation documentation

Phil biondi at cartel-securite.fr
Wed Feb 27 18:09:29 CET 2002


On Wed, 27 Feb 2002, Chad C. Walstrom wrote:

> On Wed, Feb 27, 2002 at 01:28:05PM +0100, Phil wrote:
> > I've begun to write sth that output a LaTeX report giving details
> > about the hardware...[snipped for brevity]...
>
> Very cool.  Perl or Python?  Parsing the fai install logs?

It's bash for the moment (just a proof of concept :)).
Maybe perl is a good choice,.. but I like python too much :)

It just gathers informations on the machine. There is nothing related
directly to FAI, but it could.

Little ugly extract :

----------------------------------------------
cat << EOF
\appendix

\chapter{Liste des paquetages et de leur version}
\label{anx.packages}
%% Generated with
%% grep -E "^(Package:|Version:|Status:|$)" < /var/lib/dpkg/status | awk
'BEGIN{RS="\n\n";FS="( |\n)"} ; {if (\$6 == "installed") {print \$2,\$8}}'

\begin{twocolumn}
\small
\begin{verbatim}
EOF

grep -E "^(Package:|Version:|Status:|$)" < /var/lib/dpkg/status | \
 awk 'BEGIN{RS="\n\n";FS="( |\n)"} ; {if ($6 == "installed") {print $2,$8}}'

cat <<EOF
\end{verbatim}
\end{twocolumn}
----------------------------------------------

>     #!/bin/sh
>     dpkg=/bin/dpkg
>
>     # Set the column width
>     COLUMNS=132
>     export COLUMNS
>
>     # Run dpkg -l
>     $dpkg -l $@

Thanks for the COLUMNS trick!
The code above will become
COLUMNS=1000 dpkg -l | awk '/^ii/{print $2 $3}'


-- 
Philippe Biondi <biondi@ cartel-securite.fr> Cartel Sécurité
Security Consultant/R&D                      http://www.cartel-securite.fr
Phone: +33 1 44 06 97 94                     Fax: +33 1 44 06 97 99
PGP KeyID:3D9A43E2  FingerPrint:C40A772533730E39330DC0985EE8FF5F3D9A43E2




More information about the linux-fai mailing list