Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
#######
#
# E-scripts on initrds
#
# Note 1: use the eev command (defined in eev.el) and the
# ee alias (in my .zshrc) to execute parts of this file.
# Executing this file as a whole makes no sense.
# An introduction to eev can be found here:
#
#   (find-eev-quick-intro)
#   http://angg.twu.net/eev-intros/find-eev-quick-intro.html
#
# Note 2: be VERY careful and make sure you understand what
# you're doing.
#
# Note 3: If you use a shell other than zsh things like |&
# and the for loops may not work.
#
# Note 4: I always run as root.
#
# Note 5: some parts are too old and don't work anymore. Some
# never worked.
#
# Note 6: the definitions for the find-xxxfile commands are on my
# .emacs.
#
# Note 7: if you see a strange command check my .zshrc -- it may
# be defined there as a function or an alias.
#
# Note 8: the sections without dates are always older than the
# sections with dates.
#
# This file is at <http://angg.twu.net/e/init.e>
#           or at <http://angg.twu.net/e/init.e.html>.
#        See also <http://angg.twu.net/emacs.html>,
#                 <http://angg.twu.net/.emacs[.html]>,
#                 <http://angg.twu.net/.zshrc[.html]>,
#                 <http://angg.twu.net/escripts.html>,
#             and <http://angg.twu.net/>.
#
#######




# «.debian-busybox-initrd»  (to "debian-busybox-initrd")
# «.initrd-netcatish-telnetd»	(to "initrd-netcatish-telnetd")
# «.mkcramfs»		(to "mkcramfs")
# «.delay»		(to "delay")
# «.initrd-mkinitrd»	(to "initrd-mkinitrd")
# «.initrd-sh-job-control»  (to "initrd-sh-job-control")
# «.real-root-dev»	(to "real-root-dev")
# «.pivot_root»		(to "pivot_root")
# «.make-kpkg-initrd»	(to "make-kpkg-initrd")
# «.telnetd-minimal»	(to "telnetd-minimal")
# «.i.tgz»		(to "i.tgz")
# «.telnet-login-pam-src»	(to "telnet-login-pam-src")
# «.login-dbg»		(to "login-dbg")





#####
#
# General notes
# 2005jan24
#
#####

# (find-inkscape "~/IMAGES/initrd-ideas.svg")
# (find-eimage0  "~/IMAGES/initrd-ideas.jpg" 2 0)

apt-get install busybox





#####
#
# creating a initrd with busybox, starting from the standard Debian initrd
# 2005jan20
#
#####

# «debian-busybox-initrd»  (to ".debian-busybox-initrd")
#*
# Copy a standard initrd image from /boot/ to /tmp/initrd.img. 
# (find-sh "cd /var/lib/dpkg/info/; ls kernel-image-*.list")
# (find-fline "/boot/")
#
cp -v /boot/initrd.img-2.6.8-1-386 /tmp/initrd.img
cp -v /boot/vmlinuz-2.6.8-1-386    /tmp/vmlinuz;   # qemu will need a kernel

#*
# An alternative to just copying an initrd image (the block above).
# In Debian the initrd associated to a linux kernel image package is
# built dynamically when the kernel image package is installed.
# In this block we rebuilt an initrd using "the Debian way", but with
# some options different from the factory defaults:
#   DELAY=4
#   BUSYBOX=yes

# (find-man "8 mkinitrd")
# (find-man "5 mkinitrd.conf")
# (find-node "(bashref)Special Parameters" "`!'")
# (find-fline "/usr/share/initrd-tools/init" "DELAY")
# (find-fline "/etc/mkinitrd/mkinitrd.conf" "if you want to use busybox")
# (find-fline "/etc/mkinitrd/")

rm -Rv /tmp/etc_mkinitrd/
mkdir  /tmp/etc_mkinitrd/
mkdir  /tmp/etc_mkinitrd/scripts/
cd     /tmp/etc_mkinitrd/

cat > mkinitrd.conf <<'%%%'
MODULES=most
DELAY=4
ROOT=probe
UMASK=022
MKIMAGE='mkcramfs %s %s > /dev/null'
BUSYBOX=yes
PKGSCRIPTS=yes
INITRD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
%%%
cat > modules <<'%%%'
loop
ide-cd
isofs
ne2k-pci
%%%

cp -v /boot/vmlinuz-2.6.8-1-386 \
            /tmp/vmlinuz;	# qemu will need a linux kernel
mkinitrd -d /tmp/etc_mkinitrd/ \
         -o /tmp/initrd.img -r hda1 2.6.8-1-386

#*
# Create another initrd image, now using busybox-1.00.
# Does this work? (No!)
# (find-eevexfile "busybox.e")
PATH=$HOME/usrc/busybox-1.00:$PATH \
mkinitrd -d /tmp/etc_mkinitrd/ \
         -o /tmp/initrd-bb1.img -r hda1 2.6.8-1-386

#*
# This block needs to be run as root.
# Mount /tmp/initrd.img on /tmp/initrdfs/ to give us access to its
# contents.
#
mkdir /tmp/initrdfs
umount /tmp/initrdfiles/dev/pts
umount /tmp/initrdfiles/dev
umount /tmp/initrdfiles/proc
umount /tmp/initrdfs
mount -v -o loop,ro /tmp/initrd.img -t cramfs /tmp/initrdfs
# output of mount:
# /tmp/initrd.img on /tmp/initrdfs type cramfs (ro,loop=/dev/loop0)

# Copy the files from the cramfs image at /tmp/initrdfs/ to
# /tmp/initrdfiles/ - we can't change files in /tmp/initrdfs/ because
# cramfs images are read-only. Note: "cp -av" wouldn't work here
# because cramfs allows hard links between directories, most other
# filesystems do not, and cp tries to preserve them. So we use tar.
#
rm -Rf     /tmp/initrdfiles/
mkdir      /tmp/initrdfiles/
( cd       /tmp/initrdfs/  && tar -cf - * ) \
  | tar -C /tmp/initrdfiles/ -xf -
cd         /tmp/initrdfiles/

# Unmount /tmp/initrdfs/ - with /tmp/initrdfs/ unmounted we can change
# /tmp/initrd.img safely.
#
umount                                        /tmp/initrdfs

#*
# Add some extra devices (as root).
# (find-fline "/tmp/initrdfiles/")
# (find-fline "/tmp/initrdfiles/dev/")
# (find-fline "/dev/" "tty1")

# Btw: "mount -t devfs dev /dev" (in the initrd shell) could also work.

cd /tmp/initrdfiles/dev/
mknod tty     c 5 0
mknod tty1    c 4 1
mknod tty2    c 4 2
mknod tty3    c 4 3
mknod tty4    c 4 4
mknod tty5    c 4 5
mknod tty6    c 4 6
mknod tty7    c 4 7
mknod tty8    c 4 8

#*
# «add_binaries_and_libs»
# Add some extra binaries (and their libs) to the initrd image.
# Note that Debian's mkinitrd uses - for simplicity - the usual glibc
# and friends for initrds, not uclibc or other smallish things. So
# this block shouldn't overwrite the right libs with the wrong libs.
#
cd /
{ ldd /bin/bash
  ldd /bin/nc
  ldd /usr/bin/less
  ldd /usr/bin/strace
  ldd /usr/bin/tee
} | awk '{print $3}' | sort | uniq \
  | tee /tmp/.libs
for i in /bin/bash /bin/nc /usr/bin/less /usr/bin/strace /usr/bin/tee \
         $(cat /tmp/.libs); do
  cp -v --parents $i /tmp/initrdfiles/
done

cp -v --parents /etc/terminfo/l/linux /tmp/initrdfiles/

#*
# Pack the changed initrd into a new cramfs image.
#
mkcramfs /tmp/initrdfiles/ /tmp/initrd.img
ls -lF /tmp/initrd*.img

#*
# Create an empty HD image (a sparse 1G file) to make qemu happy.
#
python <(cat <<'%%%'
image = open("/tmp/hda.img", "w")
image.truncate(1024 * 1048576L)
image.close()
%%%
)

#*
# Try the initrd with qemu.
# (find-man "1 qemu")
cd /tmp/
qemu -hda /tmp/hda.img  \
     -kernel vmlinuz    \
     -initrd initrd.img

#    -user-net

#*
# The default initrd shell says:
#   sh: can't access tty; job control turned off
# The easiest way to get job control (^C, ^Z, etc) there is to run
# "exec busybox init" (by hand).

# (find-status   "busybox")
# (find-vldifile "busybox.list")
# (find-udfile   "busybox/")
# (find-man  "1 busybox")
# (find-udfile "busybox/BusyBox.txt.gz" "\n    init\n")
# (find-udfile "busybox/BusyBox.txt.gz" "\n    init\n" "controlling tty")





#####
#
# sending commands to the initrd using netcat (it doesn't have a telnetd yet)
# 2005jan28
#
#####

# «initrd-netcatish-telnetd»  (to ".initrd-netcatish-telnetd")

# How to run this: run the block below (it adds a /etc/profile to the
# initrd), rebuild the initrd, run qemu on it. Then, inside qemu:
#   . /etc/profile
#   eth0up
#   tmptmp
#   exec busybox init
#     mybash
#     ...
#*
cd /tmp/initrdfiles/
cat > etc/profile <<'%%%'
export HOST=172.20.0.1
export HERE=172.20.0.2
export EE=/tmp/ee.sh
eth0up   () { ifconfig eth0 172.20.0.2; route add 172.20.0.0 eth0; }
fromhost () { nc -l -p 1234; }
tohost   () { nc -q 0 $HOST 1234; }
tmptmp   () { mount -t tmpfs _tmp /tmp; }
mybash   () { HOME=/tmp bash --login; }
getee    () { fromhost > $EE; }
ee       () { set -v; . $EE; set +v; }
eee      () { getee; ee; }
showpwd  () { echo "$PWD#"; }
eeeloop  () { FLAG=1; while [ $FLAG -gt 0 ]; do showpwd; eee; done; }
%%%

#*

(defun eeguest (s &optional e)
  (interactive "r")
  (ee-write-with-nl s e "" "" "/tmp/ee.sh")
  (find-sh0 "cat /tmp/ee.sh | nc -q 0 172.20.0.2 1234"))

(eeb-define 'eeb-guest 'eeguest  "\n#*\n" nil t t)








#####
#
# things to do inside the initd shell
# 2005jan28
#
#####

# (find-node "(bashref)Printing a Prompt" "current working directory")
exec busybox init
exec bash
export PS1='\w# '
ifconfig eth0 172.20.0.2
route add 172.20.0.0 eth0

# (find-man "8 route")

# (find-udw3m  "qemu/qemu-doc.html")

mount -t tmpfs tmp /tmp

HOME=/tmp bash
function fromhost ()




#####
#
# more about job control
# 2005jan28
#
#####

# http://www.uclibc.org/FAQ.html#job_control
# (find-k26file "drivers/char/tty_io.c" "noctty =")
# (find-node "(bashref)Job Control")
# (find-node "(libc)Job Control")
# (find-node "(libc)Implementing a Shell")




#####
#
# Job control in the initrd shell
# 2005jan24
#
#####

# «initrd-sh-job-control»  (to ".initrd-sh-job-control")

# A problem with the shell in initrd (started from DELAY):
# It says:
#   sh: can't access tty; job control turned off
# which means that I don't have ^C, ^D or ^Z.
# The initrd doesn't have /dev/tty, but the problem is not that -
# running
mount -t devfs dev /dev
# creates a /dev/tty, but running
sh -i
# after that gives the same message.




#####
#
# dash in initrd says "can't access tty; job control turned off"
# 2005jan26
#
#####

# /bin/sh in the debian initrd is probably dash:
# (find-status   "initrd-tools" "dash")
# (find-vldifile "initrd-tools.list")
# (find-udfile   "initrd-tools/")
# (find-fline "/usr/sbin/mkinitrd" "dash")
#*
rm -Rv ~/usrc/dash/
mkdir  ~/usrc/dash/
cd     ~/usrc/dash/
cp -v $S/http/ftp.debian.org/debian/pool/main/d/dash/dash_0.5.1-3.diff.gz   .
cp -v $S/http/ftp.debian.org/debian/pool/main/d/dash/dash_0.5.1-3.dsc       .
cp -v $S/http/ftp.debian.org/debian/pool/main/d/dash/dash_0.5.1.orig.tar.gz .
dpkg-source -x dash_0.5.1-3.dsc
cd ~/usrc/dash/dash-0.5.1/

#*
# (code-c-d "dash" "~/usrc/dash/dash-0.5.1/")
# (find-dashfile "")
# (find-dashfile "src/")
# (find-dashfile "src/jobs.c" "can't access tty; job control turned off")
# (find-node "(libc)Terminal Access Functions" "tcgetpgrp")

#*
cd ~/usrc/dash/dash-0.5.1/
fakeroot debian/rules binary   |& tee odrb

#*
# (find-dashfile "debian/dash/bin/")





#####
#
# mkcramfs (old)
# 2004nov28
#
#####

# «mkcramfs»  (to ".mkcramfs")
# (find-man "8 mkcramfs")
#
sudo rm -Rv /tmp/initrd2/
     mkdir  /tmp/initrd2/
     cd     /tmp/initrd/
sudo cp -av --parents * /tmp/initrd2/

mkcramfs /tmp/initrd2/ /tmp/initrd2.img
laf /tmp/initrd2.img 
laf /boot/initrd.img-2.4.26-1-386 

#*




#####
#
# adding a delay into initrd (old)
# 2004oct21
#
#####

# «delay»  (to ".delay")
# (find-status   "kernel-image-2.6.8-1-386")
# (find-vldifile "kernel-image-2.6.8-1-386.postinst" "mkinitrd")
# (find-man "8 mkinitrd")
# (find-man "5 mkinitrd.conf" "DELAY")
# (find-fline "/etc/mkinitrd/mkinitrd.conf" "DELAY")
# (find-sh0 "sudo chown aleph:aleph /etc/mkinitrd/mkinitrd.conf")
# (find-sh0 "sudo chown root:root   /etc/mkinitrd/mkinitrd.conf")
#*
sudo \
/var/lib/dpkg/info/kernel-image-2.4.26-1-386.postinst configure \
  2.4.26-6
#*




#####
#
# making initrds with mkinitrd (old)
# 2004sep13
#
#####

# «initrd-mkinitrd»  (to ".initrd-mkinitrd")
# (find-status   "kernel-image-2.4.26-1-386")
# (find-vldifile "kernel-image-2.4.26-1-386.list")
# (find-vldifile "kernel-image-2.4.26-1-386.postinst")
# (find-vldifile "kernel-image-2.4.26-1-386.postinst" "initrd.img-$version")
# (find-status   "kernel-image-2.6.8-1-386")
# (find-vldifile "kernel-image-2.6.8-1-386.list")
# (find-vldifile "kernel-image-2.6.8-1-386.postinst")
# (find-vldifile "kernel-image-2.6.8-1-386.postinst" "initrd.img-$version")
# (find-man "8 mkinitrd")
# (find-man "8 mkcramfs")
# (find-fline "/usr/sbin/mkinitrd")
# (find-fline "/etc/mkinitrd/mkinitrd.conf" "DELAY")
#*
fakeroot mkinitrd -o /tmp/initrd.img-2.4.26-1-386 /lib/modules/2.4.26-1-386
#*
fakeroot mkinitrd -o /tmp/initrd.img-2.6.8-1-386  /lib/modules/2.6.8-1-386
#*
# (find-status   "initrd-tools")
# (find-vldifile "initrd-tools.list")
# (find-udfile   "initrd-tools/")
# (find-fline "/usr/sbin/mkinitrd")
# (find-fline "/usr/sbin/mkinitrd" "SHARE=/usr/share/initrd-tools")
# (find-fline "/usr/sbin/mkinitrd" "$SHARE/probe.d/")
# (find-fline "/usr/sbin/mkinitrd" "\ndefaults\n")
# (find-fline "/usr/share/initrd-tools/")
# (find-fline "/etc/mkinitrd/")




#####
#
# real-root-dev and pivot_root (old)
# 2004oct11
#
#####

# «real-root-dev»  (to ".real-root-dev")
# «pivot_root»     (to ".pivot_root")
# (to "initrd")

# (find-fline "/tmp/initrd/linuxrc" "echo 256 > proc/sys/kernel/real-root-dev")
# (find-k24file "Documentation/initrd.txt" "real-root-dev")
# (find-k24file "kernel/sysctl.c" "real-root-dev")

# (find-man "8 pivot_root")
# (find-man "2 pivot_root")





#####
#
# make-kpkg and initrds (old)
# 2004dec21
#
#####

# «make-kpkg-initrd»  (to ".make-kpkg-initrd")

# (find-man "1 make-kpkg")
# (find-man "1 make-kpkg" "--mkimage")
# (find-fline "/usr/share/kernel-package/")
# (find-fline "/usr/share/kernel-package/rules" "stamp-configure:")
# (find-fline "/usr/share/kernel-package/rules" "stamp-build:")

# (find-fline "/usr/share/kernel-package/README" "make-kpkg --initrd")
# (find-fline "/usr/share/kernel-package/image.postinst" "initrd")

# (find-man "1 make-kpkg")
# (find-man "1 make-kpkg" "--config target")
# (find-man "1 make-kpkg" "--targets")
# (find-man "1 make-kpkg" "\nTARGETS\n")
# (find-man "1 make-kpkg" "\nTARGETS\n" "\n       configure\n")
# (find-man "1 make-kpkg" "\nTARGETS\n" "\n       build ")

# (find-sh "make-kpkg --targets")
# (find-fline "/usr/share/kernel-package/rules")
# (find-fline "/usr/bin/make-kpkg")

(find-vldifile "kernel-image-2.6.8-1-386.postinst" "initrd")

kernel-image-2.6.8-1-386

#*
/var/lib/dpkg/info/
diff -b kernel-image-2.6.8-1-386.postinst \
        kernel-image-2.6.8-persephone1.postinst

#*





#####
#
# adding a telnetd to the minimal system
# 2005feb06
#
#####

# «telnetd-minimal»  (to ".telnetd-minimal")
# http://201008141085.user.veloxzone.com.br/L/e/initrd.e.html#telnetd-minimal
#*
# Create the directory that we will chroot to (/tmp/initrdfiles/),
# create some subdirs, mount proc and devfs and devpts

umount /tmp/initrdfiles/dev/pts
umount /tmp/initrdfiles/dev
umount /tmp/initrdfiles/proc

rm -Rv /tmp/initrdfiles/
mkdir  /tmp/initrdfiles/

mkdir  /tmp/initrdfiles/dev/
mkdir  /tmp/initrdfiles/proc/
mount -t devfs  tidev     /tmp/initrdfiles/dev
mount -t proc   tiproc    /tmp/initrdfiles/proc
mount -t devpts tiddevpts /tmp/initrdfiles/dev/pts

# Functions to copy files to /tmp/initrdfiles/ - iaddfiles copies
# individual files, iaddbinaries copies an ELF file and the libs that
# ldd says that it uses
#
igetlibs () {
  { for i in $*; do ldd $i; done; } | awk '{print $3}' | sort | uniq;
}
iaddfiles () { cp --parents -v $* /tmp/initrdfiles/; }
iaddbinaries () { iaddfiles $* $(igetlibs $*); }

cd /
iaddbinaries /bin/login /usr/sbin/in.telnetd /usr/lib/telnetlogin
iaddbinaries /bin/bash  /bin/su /bin/busybox

#   *
# Create some files on (/tmp/initrdfiles)/etc/: passwd and issue.net
#
mkdir /tmp/initrdfiles/etc/

cat > /tmp/initrdfiles/etc/issue.net <<'%%%'
Debian GNU/Linux 3.1 initrd %t
%%%

cat > /tmp/initrdfiles/etc/passwd <<'%%%'
root:$1$iNoPuw.c$hcdKc.rOAaXJ/6TGaGOGo0:0:0:root:/:/bin/bash
edrx:$1$uTh4JVZJ$MK5FyVCC3unb.EzMuTIBq0:1000:1000:edrx,,,:/:/bin/bash
aleph:$1$ulSHqf1v$YX/K9IPHs6EH3yV.4sD0i/:1001:1001:aleph,,,:/:/bin/bash
beth:$1$RSXXvlfG$Vc31nH63tOsdpAwp4k.ne1:1002:1002:beth,,,:/:/bin/bash
r::0:0:root:/:/bin/bash
e::1000:1000:edrx,,,:/:/bin/bash
%%%

#   *
# Copy more files to try to make pam and login happy

mkdir    /tmp/initrdfiles/lib/security/
mkdir -p /tmp/initrdfiles/var/log/
iaddfiles /lib/security/*

mkdir /tmp/initrdfiles/etc/pam.d/
cat > /tmp/initrdfiles/etc/pam.d/login <<'%%%'
auth	required	pam_unix.so nullok_secure
%%%

iaddfiles /etc/login.defs

#*
# Pack /tmp/initrdfiles/ into /var/www/tmp/i.tgz
# Target url: http://201008141085.user.veloxzone.com.br/tmp/i.tgz
# (find-node "(tar)All Options")
# (find-node "(tar)Option Summary")
# (find-node "(tar)Option Summary" "`--exclude=PATTERN'")

cd /tmp/initrdfiles/
tar --exclude=dev --exclude=proc \
  -cvzf /var/www/tmp/i.tgz *

ls -lAF /var/www/tmp/i.tgz

#*
# «i.tgz»  (to ".i.tgz")
# http://201008141085.user.veloxzone.com.br/L/e/initrd.e.html#i.tgz
# Download and unpack:

umount /tmp/initrdfiles/dev/pts
umount /tmp/initrdfiles/dev
umount /tmp/initrdfiles/proc

rm -Rv /tmp/initrdfiles/
mkdir  /tmp/initrdfiles/

mkdir  /tmp/initrdfiles/dev/
mkdir  /tmp/initrdfiles/proc/
mount -t devfs  tidev     /tmp/initrdfiles/dev
mount -t proc   tiproc    /tmp/initrdfiles/proc
mount -t devpts tiddevpts /tmp/initrdfiles/dev/pts

cd /tmp/
wget http://201008141085.user.veloxzone.com.br/tmp/i.tgz
tar -C /tmp/initrdfiles/ -xvzf /tmp/i.tgz

cd     /tmp/initrdfiles/
# (find-fline "/tmp/initrdfiles/")

#*



strace -f -o /tmp/s \
  chroot /tmp/initrdfiles/ \
    /bin/login

#*
chroot /tmp/initrdfiles/ \
  /bin/bash  

#*
strace -f -o /tmp/s \
  /bin/login

#*

# (find-fline "/tmp/initrdfiles/var/log/")
# (find-fline "/tmp/s")
# (find-fline "/tmp/s" "/etc/pam.conf")
# (find-fline "/etc/pam.d/login")
# (find-fline "/etc/pam.d/login" "passwordless")
# (find-fline "/etc/pam.d/common-auth")

# (find-udfile "libpam-doc/txt/pam.txt.gz")
# (find-udfile "libpam-doc/txt/pam.txt.gz" "4.1.  Configuration file syntax")
# (find-udfile "libpam-doc/txt/pam.txt.gz" "  sufficient; the succ")
# (find-udfile "libpam-doc/txt/pam_appl.txt.gz")

# (find-man "1 login")
syslogd

 l messages auth.log syslog

#*
strace -f -o /tmp/s \
  chroot /tmp/initrdfiles/ \
  in.telnetd -L /bin/login -debug 2000

#*
getlibs /bin/sh /usr/bin/emacs


# http://www.falkotimme.com/howtos/debian_bind_chroot/index.php
# (find-man "8 sysklogd" "-a socket")

/etc/syslog.conf
/dev/log
/var/run/syslogd.pid
syslog.conf(5), klogd(8), logger(1), syslog(2), syslog(3), services(5), savelog(8)




# (find-status   "bind")
# (find-vldifile "bind.list")
# (find-udfile   "bind/")

cp -av /dev/log /tmp/initrdfiles/dev/

telnet 127.0.0.1 2000

mkdir 

pam.d
pam.conf

# (find-udfile "libpam0g/Debian-PAM-MiniPolicy.gz")

# (find-man "8 pam_getenv")
# (find-man "7 pam")








#####
#
# telnet / login / pam: sources and debugging
# 2005feb01
#
#####

# «telnet-login-pam-src»  (to ".telnet-login-pam-src")
# http://ftp.debian.org/debian/pool/main/n/netkit-telnet/
# http://ftp.debian.org/debian/pool/main/s/shadow/
# http://ftp.debian.org/debian/pool/main/p/pam/
#*
rm -Rv ~/usrc/netkit-telnet/
mkdir  ~/usrc/netkit-telnet/
cd     ~/usrc/netkit-telnet/
dpkg-source -x $S/http/ftp.debian.org/debian/pool/main/n/netkit-telnet/netkit-telnet_0.17-26.dsc
cd     ~/usrc/netkit-telnet/netkit-telnet-0.17/

#*



#####
#
# shadow and login: recompile with debugging info
# 2005feb14
#
#####

# «login-dbg»  (to ".login-dbg")
#*
rm -Rfv ~/usrc/shadow/
mkdir   ~/usrc/shadow/
cd      ~/usrc/shadow/
dpkg-source -x $S/http/ftp.debian.org/debian/pool/main/s/shadow/shadow_4.0.3-30.8.dsc
cd      ~/usrc/shadow/shadow-4.0.3/

#  *
cd      ~/usrc/shadow/shadow-4.0.3/
patch -p0 debian/changelog <<'%%%'
0a1,6
> shadow (1:4.0.3-30.8.1) unstable; urgency=low
> 
>   * Local build with -g and no stripping (Edrx)
> 
>  -- Eduardo Ochs <edrx@persephone.birdland>  Mon, 14 Feb 2005 17:50:16 -0200
> 
%%%

#  *
cd      ~/usrc/shadow/shadow-4.0.3/
DEB_BUILD_OPTIONS=nostrip,noopt,debug \
  CFLAGS="-g -Wall" \
  LDFLAGS=" " \
  dpkg-buildpackage -rfakeroot   |& tee odbfr

#*
# (code-c-d "shadow" "~/usrc/shadow/shadow-4.0.3/")
# (find-shadowfile "")
# (find-shadowfile "odbfr")
# (find-shadowfile "config.log" "CFLAGS='-O2 -Wall'")
# (find-shadowfile "config.log" "LDFLAGS='-s'")

# (find-shadowfile "src/login.c")
# (find-shadowfile "src/" "login.c")

# (find-maintgfile "maint-guide.en.txt.gz" "DEB_BUILD_OPTIONS parameters")
# (find-debreffile "reference.en.txt.gz" "DEB_BUILD_OPTIONS=nostrip,noopt")
# (find-fline "/usr/share/debhelper/dh_make/debiank/rules" "DEB_BUILD_OPTIONS")
# (find-fline "/usr/share/debhelper/dh_make/debianl/rules" "DEB_BUILD_OPTIONS")
# (find-fline "/usr/share/debhelper/dh_make/debianm/rules" "DEB_BUILD_OPTIONS")
# (find-fline "/usr/share/debhelper/dh_make/debians/rules" "DEB_BUILD_OPTIONS")
# But shadow's debian/rules is non-standard and CFLAGS += -g doesn't work (?)
# (find-shadowfile "debian/rules")
# (find-shadowfile "Makefile" "CFLAGS = -O2 -Wall")

# A workaround: set CFLAGS (and LDFLAGS) from the outside.
# (find-shadowfile "configure" "influential environment variables" "CFLAGS")

# (find-node "(gcc)Link Options" "`-s'" "Remove all symbol table")

# (find-fline "/usr/bin/dh_strip")
# (find-fline "/usr/bin/dh_strip" "DEB_BUILD_OPTIONS")

# (find-node "(make)Appending")

# (find-fline "/usr/share/debhelper/dh_make/debianl/rules" "DEB_BUILD_OPTIONS")

# (find-status   "dh-make")
# (find-vldifile "dh-make.list")
# (find-udfile   "dh-make/")

# (find-fline "/usr/bin/dpkg-buildpackage")







cd      ~/usrc/shadow/shadow-4.0.3/
patch -p0 debian/rules <<'%%%'
87c87
< 	dh_strip
---
> 	#dh_strip
%%%
dpkg-buildpackage -rfakeroot   |& tee odbfr

#*
# (find-man "1 dh_strip")
# (find-man "1 dh_strip" "--dbg-package=package")
# (find-fline "/usr/bin/dh_strip")

# (find-status   "debian-el")
# (find-vldifile "debian-el.list")
# (find-udfile   "debian-el/")
# (find-status   "dlocate")
# (find-vldifile "dlocate.list")
# (find-udfile   "dlocate/")

deb-view





#*
rm -Rfv ~/usrc/pam/
mkdir   ~/usrc/pam/
cd      ~/usrc/pam/
dpkg-source -x $S/http/ftp.debian.org/debian/pool/main/p/pam/pam_0.76-22.dsc
cd      ~/usrc/pam/pam-0.76/



# (code-c-d "telnetd" "~/usrc/netkit-telnet/netkit-telnet-0.17/")
# (find-telnetdfile "")
# (find-telnetdfile "telnetd/")
# (find-telnetdfile "telnetlogin/")
# (find-telnetdfile "telnetlogin/telnetlogin.c" "stdout and stdin not same tty")

# (code-c-d "pam" "~/usrc/pam/pam-0.76/Linux-PAM/")
# (find-pamfile "")


DEB_BUILD_OPTIONS=nostrip










# (find-htetfile "From-PowerUp-To-Bash-Prompt-HOWTO.gz")
# (find-htetfile "")

# (find-fline "/usr/share/initrd-tools/init" "DELAY")




#  Local Variables:
#  coding:               utf-8-unix
#  modes:                (fundamental-mode sh-mode)
#  End: