Once it hits the fan, the only rational choice is to sweep it up, package it, and sell it as fertilizer. | |
anonymous |
src/ is for source code, i.e. text files written and maintained by humans.
tmp/i386-redhat8.0-linux/ is the only place to hold binaries, i.e. executables and .o files.
Table 1. Variables prefixed with TEVWH_
Variable name | Value on this platform |
---|---|
ASM_FLAVOR | set disassembly-flavor intel |
CFLAGS | -Wall -O1 -I . -I out/i386-redhat8.0-linux -D NDEBUG |
OS_NAME | Red Hat Linux release 8.0 (Psyche) |
OUT_XML | out/i386-redhat8.0-linux/xml |
Variable name | Value on this platform | Variable name | Value on this platform |
---|---|---|---|
AFLAGS | -I . -D _ASM | ARCH | i386 |
ASM | i386_Linux_intel | ASM_COMMENT | ; |
ASM_OBJDUMP | -Mintel | ASM_RETURN | (ret|hlt) |
ASM_STYLE | intel | BYTE_ORDER | L |
ELF_ADDR | Elf32_Addr | ELF_ADDR_SIZE | 32 |
ELF_ALIGN | 1000 | ELF_BASE | 8048000 |
ELF_EHDR | Elf32_Ehdr | ELF_MAGIC | 8048001 |
ELF_OFF | Elf32_Off | ELF_PAGE_SIZE | 1000 |
ELF_PHDR | Elf32_Phdr | ELF_SHDR | Elf32_Shdr |
HOSTTYPE | Linux/i386 | OS_CODE | i386-redhat8.0-linux |
OS_PKG_SYS | rpm | OS_VENDOR | redhat |
OS_VERSION | 8.0 | OUT | out/i386-redhat8.0-linux |
PRE | pre/i386-redhat8.0-linux | PROC_EXE | /proc/self/exe |
PROC_MEM | /proc/self/mem | TMP | tmp/i386-redhat8.0-linux |
UNAME | Linux |
Table 2. Variables prefixed with TEVWH_PATH_
Variable name | Value on this platform | Variable name | Value on this platform |
---|---|---|---|
BASH | /bin/bash | BC | /usr/bin/bc |
CAT | /bin/cat | CC | /usr/bin/gcc |
CHMOD | /bin/chmod | CSH | /bin/tcsh |
CUT | /bin/cut | DD | /bin/dd |
DISTID | /etc/redhat-release | DU | /usr/bin/du |
ECHO | /bin/echo | EXPAND | /usr/bin/expand |
FILE | /usr/bin/file | FIND | /usr/bin/find |
FMT | /usr/bin/fmt | GDB | /usr/bin/gdb |
GREP | /bin/grep | HEXDUMP | /usr/bin/hexdump |
KILL | /usr/bin/kill | LD | /usr/bin/ld |
LDD | /usr/bin/ldd | LS | /bin/ls |
MAKE | /usr/bin/make | MAN | /usr/bin/man |
NASM | /usr/bin/nasm | NDISASM | /usr/bin/ndisasm |
NICE | /bin/nice | NM | /usr/bin/nm |
OBJDUMP | /usr/bin/objdump | OD | /usr/bin/od |
PERL | /usr/bin/perl | READELF | /usr/bin/readelf |
RPM | /bin/rpm | SED | /bin/sed |
SH | /bin/bash | SORT | /bin/sort |
STRACE | /usr/bin/strace | STRINGS | /usr/bin/strings |
STRIP | /usr/bin/strip | TAIL | /usr/bin/tail |
TEE | /usr/bin/tee | TR | /usr/bin/tr |
UNIQ | /usr/bin/uniq | WC | /usr/bin/wc |
XARGS | /usr/bin/xargs | XXD | /usr/bin/xxd |
Command: src/packages/uname.sh
#!/bin/sh
uname -mprs
echo "[${HOSTTYPE}]"
echo "[${VENDOR}]"
echo "[${OSTYPE}]"
echo "[${MACHTYPE}]"
echo "[${LANG}]" |
The value of LANG is not directly related. But some tools create strange output for en_US.UTF-8.
Output: out/i386-redhat8.0-linux/packages/uname
Linux 2.4.19 i586 i586
[i386-linux]
[intel]
[linux]
[i386]
[en_US] |
Command: pre/i386-redhat8.0-linux/packages/distid.sh
#!/bin/bash
# We need this script to copy the id-file into directory out/.
# I use many machines to test examples, but only one to render the document.
/bin/cat /etc/redhat-release |
Output: out/i386-redhat8.0-linux/packages/distid
Red Hat Linux release 8.0 (Psyche) |
Source: pre/i386-redhat8.0-linux/packages/rpm/du.sh
#!/bin/bash
/usr/bin/file /var/lib/rpm/*
/usr/bin/du -s /var/lib/rpm |
Output: out/i386-redhat8.0-linux/packages/du
/var/lib/rpm/Basenames: Berkeley DB (Hash, version 7, native byte-order)
/var/lib/rpm/Conflictname: Berkeley DB (Hash, version 7, native byte-order)
/var/lib/rpm/__db.001: data
/var/lib/rpm/__db.002: X11 SNF font data, LSB first
/var/lib/rpm/__db.003: X11 SNF font data, LSB first
/var/lib/rpm/Dirnames: Berkeley DB (Btree, version 8, native byte-order)
/var/lib/rpm/Filemd5s: Berkeley DB (Hash, version 7, native byte-order)
/var/lib/rpm/Group: Berkeley DB (Hash, version 7, native byte-order)
/var/lib/rpm/Installtid: Berkeley DB (Btree, version 8, native byte-order)
/var/lib/rpm/Name: Berkeley DB (Hash, version 7, native byte-order)
/var/lib/rpm/Packages: Berkeley DB (Hash, version 7, native byte-order)
/var/lib/rpm/Providename: Berkeley DB (Hash, version 7, native byte-order)
/var/lib/rpm/Provideversion: Berkeley DB (Btree, version 8, native byte-order)
/var/lib/rpm/Pubkeys: Berkeley DB (Hash, version 7, native byte-order)
/var/lib/rpm/Requirename: Berkeley DB (Hash, version 7, native byte-order)
/var/lib/rpm/Requireversion: Berkeley DB (Btree, version 8, native byte-order)
/var/lib/rpm/Sha1header: Berkeley DB (Hash, version 7, native byte-order)
/var/lib/rpm/Sigmd5: Berkeley DB (Hash, version 7, native byte-order)
/var/lib/rpm/Triggername: Berkeley DB (Hash, version 7, native byte-order)
26244 /var/lib/rpm |
Source: pre/i386-redhat8.0-linux/packages/rpm/simple.sh
#!/bin/bash
/bin/rpm -qf $( which perl ) |
Output: out/i386-redhat8.0-linux/packages/simple
perl-5.8.0-55 |
Output format is customizable. A list of available tag names is output by rpm --querytags.
Source: pre/i386-redhat8.0-linux/packages/rpm/custom.sh
#!/bin/bash
/bin/rpm -q -f $( which perl ) \
--qf 'name=%{name}\nversion=%{version}\nrelease=%{release}\n' |
Output: out/i386-redhat8.0-linux/packages/rpm/custom
name=perl
version=5.8.0
release=55 |
Command: pre/i386-redhat8.0-linux/packages/man-all/Linux.sh
#!/bin/bash
/usr/bin/man -a -w kill |
Output: out/i386-redhat8.0-linux/packages/man-all
/usr/share/man/man1/kill.1.gz
/usr/share/man/man2/kill.2.gz |
Command: pre/i386-redhat8.0-linux/packages/man-section/Linux.sh
#!/bin/bash
/usr/bin/man -w 2 kill |
Output: out/i386-redhat8.0-linux/packages/man-section
/usr/share/man/man2/kill.2.gz |
This chapter is not about checking the integrity of package files. See Intrusion detection systems (i) for a general introduction.
rpm(1) lets you verify everything or complete packages. A package can be specified indirectly through a file owned by it, though.
Command: pre/i386-redhat8.0-linux/packages/rpm/verify.sh
#!/bin/bash
/bin/rpm -qf /etc/profile
/bin/rpm --verify bash
/bin/echo status=$?
/bin/rpm --verify -f /etc/profile
/bin/echo status=$? |
Output: out/i386-redhat8.0-linux/packages/verify
setup-2.5.20-1
status=0
S.5....T c /etc/csh.cshrc
missing c /etc/csh.login
S.5....T c /etc/printcap
..?..... c /etc/securetty
status=1 |
A quick fix to lower the noise is to ignore all files flagged as " c ". Take the following as inspiration for a cron-based script.
Command: pre/i386-redhat8.0-linux/packages/rpm/verify-all.sh
#!/bin/bash
/bin/nice -n 19 /bin/rpm --verify --all \
| /bin/grep -v '........ c' |
With option -p package_file you can verify against the checksums included in a package file, e.g. on the installation CD.