Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
#######
#
# E-scripts on dealing with a FreeBSD partition.
#
# 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/bsd.e>
#           or at <http://angg.twu.net/e/bsd.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/>.
#
#######





# «.bsd_partitions»	(to "bsd_partitions")
# «.bsd_kernel_options»	(to "bsd_kernel_options")
# «.fbsd-kernel-recomp»	(to "fbsd-kernel-recomp")
# «.fbsd-mouse»		(to "fbsd-mouse")
# «.fbsd-keymaps»	(to "fbsd-keymaps")
# «.edrx.tgz»		(to "edrx.tgz")
# «.fbsd-font-keymap»	(to "fbsd-font-keymap")
# «.lynx»		(to "lynx")
# «.freebsd41-adjusts0»	(to "freebsd41-adjusts0")
# «.ports»		(to "ports")
# «.empty_passwd»	(to "empty_passwd")
# «.ppp»		(to "ppp")

# (find-htetfile "mini/Linux+FreeBSD.txt.gz")
# (find-htetfile "mini/Linux+FreeBSD.txt.gz" "new kernel with ext2fs support")

# (find-es "man" "bsd_manpages")




#####
#
# FreeBSD 3.4 CD 1
# 2000may27
#
#####

# (find-fline "/cdrom/")
# (find-fline "/cdrom/INSTALL.TXT")
# (find-fline "/cdrom/INSTALL.TXT" "PLIP peer")
# (find-fline "/cdrom/floppies/")
# (find-fline "/cdrom/floppies/README.TXT")

mkdir ~/tmp/bsdpkgs/

cd /cdrom/packages/All/
for i in *.tgz; do
  if [[ ! -e ~/tmp/bsdpkgs/$i ]]; then
    echo $i
    tar -tvzf $i > ~/tmp/bsdpkgs/$i.lst
  fi
done

cd ~/tmp/bsdpkgs/
agrep -i xaw *

# (find-fline "~/tmp/bsdpkgs/")




#####
#
# Accessing the BSD partitions
# 2000jun02
#
#####

# «bsd_partitions»  (to ".bsd_partitions")

# (find-k22file "Documentation/")
# (find-k22file "Documentation/Configure.help" "UFS filesystem")
# (find-k22file "Documentation/Configure.help" "UFS filesystem write")
# (find-k22file "Documentation/Configure.help" "BSD disklabel")
# (find-k22file "Documentation/filesystems/ufs.txt")
# (find-fline "/boot/angg22/kconfig" "CONFIG_UFS")
# (find-fline "/boot/angg22/kconfig" "CONFIG_BSD_DISKLABEL")

# (find-fline "~/k22conf" "CONFIG_UFS")
# (find-fline "~/k22conf" "CONFIG_BSD_DISKLABEL")

#Partition check:
# hda: hda1 hda2 hda3 hda4 < hda5 hda6 >
# hdc: hdc1 hdc2 hdc3 hdc4 < hdc5 hdc6 >
# hdd: hdd1 hdd2 hdd3! hdd4 < hdd5 hdd6 hdd7 hdd8 > < hdd9 hdd10 hdd11 hdd12 >

# (find-k22file "drivers/block/genhd.c" "Partition check:")
# (find-k22file "drivers/block/genhd.c" "\"!\"")

cat /proc/filesystems
insmod ufs
cat /proc/filesystems

mount -t ufs -o ufstype=44bsd,ro /dev/hdd9 /netbsd
mount -t ufs -o ufstype=44bsd,ro /dev/hdd11 /netbsd/usr
mount -t ufs -o ufstype=44bsd,ro /dev/hdd10 /netbsd/var
mount -t ufs -o ufstype=44bsd,ro /dev/hdd12 /netbsd/var
# (find-fline "/etc/fstab" "BSD")

mount /hdd9
mount /hdd11
mount /hdd12

# (find-fline "/hdd9/")
# (find-fline "/hdd9/stand/")
# (find-fline "/hdd9/stand/help/")
# (find-fline "/hdd9/stand/help/UPGRADE.TXT.gz" "/dev/wd0s2b")
# (find-fline "/hdd9/etc/")
# (find-fline "/hdd9/etc/fstab")

# (find-fline "/hdd11/")
# (find-fline "/hdd11/db/pkg/")

# (find-fline "/hdd12/")

# (code-c-d "bsd8" "/hdd12/share/doc/en_US.ISO_8859-1/")
# (find-bsd8file "articles/")
# (find-bsd8file "articles/multi-os/")
# (find-bsd8file "articles/multi-os/article.txt")
# (find-bsd8file "articles/multi-os/article.txt" "LILO")
# (find-bsd8file "books/")
# (find-bsd8file "books/handbook/")
# (find-bsd8file "books/handbook/book.txt")
# (find-bsd8file "books/handbook/book.txt" "Unlike the GENERIC kernel")
# (find-bsd8file "books/handbook/book.txt" "Dosboot")
# (find-bsd8file "books/faq/")
# (find-bsd8file "books/faq/book.txt" "boot.flp")
# (find-bsd8file "articles/")

# (find-fline "/hdd12/share/misc/")
# (find-fline "/hdd12/share/doc/")
# (find-fline "/hdd12/")
# (find-fline "/hdd12/ports/")

floppies/boot.flp




#####
#
# BSD kernel options (for grub)
# 2000jul01
#
#####

# «bsd_kernel_options»  (to ".bsd_kernel_options")
# (find-es "hurd" "grub")

# (find-fline "/hdd12/src/sys/modules/vinum/.gdbinit.kernel")
# (find-fline "/hdd12/src/sys/")
# (find-fline "/hdd12/src/sys/boot/forth/")
# (find-fline "/hdd12/src/sys/i386/boot/")
# (find-fline "/hdd12/src/sys/i386/boot/biosboot/")
# (find-fline "/hdd12/src/sys/i386/boot/biosboot/README.386BSD" "you have several drives")
# (find-fline "/hdd9/boot/")
# (find-fline "/hdd9/boot/loader.help" "rootdev")
# (find-fline "/hdd12/src/sys/kern/")

cd /hdd9/boot/
agrep '(curr|root)dev' $(find *)


cd /
find hdd{9,11,12} | egrep -i '(boot|kernel)' | tee ~/tmp/obsdbopt
# (find-fline "~/tmp/obsdbopt")

cd /hdd12/src/sys/
agrep rootdev $(find *) |& tee ~/o
# (find-fline "~/o")

# (find-fline "/hdd12/src/sys/boot/common/help.common" "rootdev")
# (find-fline "/hdd12/src/sys/boot/forth/loader.conf" "rootdev")
# rootdev="disk1s1a"

# (find-bsd8w3 "books/handbook/kernelopts.html")
# (find-bsd8w3 "books/handbook/internals.html")




#####
#
# recompiling the freebsd kernel
# 2000oct15
#
#####

# «fbsd-kernel-recomp»  (to ".fbsd-kernel-recomp")
# (find-fline "/usr/src/sys/")
# (find-fline "/usr/src/sys/conf/")
# (find-fline "/usr/src/sys/Makefile")
# (find-fline "/usr/src/sys/om")
#*
cd /usr/src/sys/
\make clean
\make		|& tee om
#*

lynx /usr/share/doc/en_US.ISO_8859-1/books/handbook/kernelconfig-building.html

# (find-fline "/usr/src/sys/i386/conf/")
# (find-fline "/usr/src/sys/i386/conf/GENERIC")


cd /usr/src/sys/i386/conf/
cp GENERIC ANGG
#
# (find-fline "/usr/src/sys/i386/conf/ANGG")
#
cd /usr/src/sys/i386/conf/
/usr/sbin/config ANGG

# (find-fline "/usr/src/sys/compile/ANGG/")

cd /usr/src/sys/i386/conf/
cd ../../compile/ANGG
\make depend		|& tee omd
\make			|& tee om
ls -lAF kernel
\make install		|& tee omi


lynx /usr/share/doc/en_US.ISO_8859-1/books/faq/kernelconfig.html
lynx /usr/share/doc/en_US.ISO_8859-1/books/handbook/kernelconfig-config.html
lynx /usr/share/doc/en_US.ISO_8859-1/books/handbook/kernelconfig-nodes.html
lynx /usr/share/doc/en_US.ISO_8859-1/books/handbook/kernelconfig-trouble.html
lynx /usr/share/doc/en_US.ISO_8859-1/books/handbook/kernelconfig.html
lynx /usr/share/doc/en_US.ISO_8859-1/books/handbook/kerneldebug.html
lynx /usr/share/doc/en_US.ISO_8859-1/books/handbook/kernelopts.html




#####
#
# mouse
# 2000oct15
#
#####

# «fbsd-mouse»  (to ".fbsd-mouse")
# (find-angg ".zshrc.local.bsd")
# (eeman "moused")
# (eeman "mse")
# (eeman "psm")
# (eeman "sysmouse")
moused -i all -p /dev/mouse
moused -i all -p /dev/psm0




#####
#
# freebsd keymaps / kbdcontrol
# 2001may07
#
#####

# «fbsd-keymaps»  (to ".fbsd-keymaps")
# (find-fline "/freebsd/usr/share/syscons/keymaps/")
# (find-fline "/freebsd/usr/share/syscons/keymaps/us.emacs.kbd")
# (find-fline "/freebsd/usr/src/usr.sbin/kbdcontrol/")
# (find-fline "/freebsd/usr/src/usr.sbin/")
# (eeman "kbdmap")
# (eeman "kbdcontrol")
#*
kbdcontrol -l /freebsd/usr/share/syscons/keymaps/us.emacs.kbd
# (eeman "kbdcontrol" "rc.conf")
# (eeman "5 rc.conf" "keymap")
# (find-fline "/etc/defaults/rc.conf" "keymap=")
# (find-fline "/etc/rc.conf")
#*
cd /etc/; grep keymap $(find *)
#*

kbdmap
# (find-angg ".emacs.local.bsd" "set-input-mode")

#*
cp -iv /freebsd/usr/share/syscons/keymaps/us.emacs.kbd ~/tmp/us.emacs.edrx.kbd
# (find-fline "~/tmp/us.emacs.edrx.kbd")
kbdcontrol -l ~/tmp/us.emacs.edrx.kbd
#*




#####
#
# openbsd
# 2000aug09
#
#####

inscd
mount /cdrom
# (find-fline "/cdrom/")
# (find-fline "/cdrom/2.6/i386/INSTALL.linux")
# (find-fline "/cdrom/2.6/i386/INSTALL.linux" "ufstype=")

#Partition check:
# hda: hda1 hda2 hda3! hda4 < hda5 hda6 > < hda7 hda8 hda9 hda10 >
# hdc: hdc1 hdc2 hdc3 hdc4 < hdc5 hdc6 >
# hdd: hdd1 hdd2 hdd3! hdd4 < hdd5 hdd6 hdd7 hdd8 > < hdd9 hdd10 hdd11 hdd12 >

insmod ufs
mkdir /bsd{a,b,c,d}
mount /dev/hda7 /bsda -t ufs -o ufstype=44bsd

/dev/hda5               /bsd                    ufs     ufstype=44bsd   1 2




#####
#
# Moving my home stuff between BSD and Linux using the tourism tricks
# 2000sep02
#
#####

# «edrx.tgz»  (to ".edrx.tgz")
# (find-fline "/freebsd/usr/home/root/")
# (find-fline "/freebsd/usr/home/root/edrx.tgz")
# (find-fline "/freebsd/usr/home/root/edrx.tgz" "bsd.e")
# (find-fline "~/TH/L/edrx.tgz")
# (find-fline "~/TH/L/edrx.tgz" "bsd.e")
# (find-fline "~/edrx.tgz")
# (find-fline "~/edrx.tgz" "bsd.e")

mount -o rw,remount /freebsd/usr
rm -Rv /freebsd/usr/home/root
mkdir  /freebsd/usr/home/root

#*
# Linux -> BSD
mount -o rw,remount /freebsd/usr
makeLedrxtgz
cp -v ~/TH/L/edrx.tgz /freebsd/usr/home/root/
cd /freebsd/usr/home/root/ && tar -xvzf edrx.tgz

#*
# BSD -> Linux
# In BSD:
makeLedrxtgz
#*
# In Linux:
cp -iv /freebsd/usr/home/root/TH/L/edrx.tgz ~/edrx.tgz
cd
tar -xvzf ~/edrx.tgz
#*

# (find-fline "/freebsd/etc/")
# (find-fline "/freebsd/etc/group")
# (find-fline "/freebsd/etc/master.passwd")
# (find-fline "/freebsd/etc/passwd")





#####
#
# On adjusting the font and keymap on FreeBSD
# 2000sep02
#
#####

# «fbsd-font-keymap»  (to ".fbsd-font-keymap")
# (eeman "4 keyboard")
# (eeman "1 kbdcontrol")
# (eeman "4 syscons")
# (find-fline "/etc/defaults/rc.conf" "keymap")
# (find-fline "~/eev850.el" "defun eeman")

# (find-fline "/usr/share/syscons/scrnmaps/")
# (find-fline "/usr/share/syscons/fonts/")
font8x14="NO"		# font 8x14 from /usr/share/syscons/fonts/* (or NO).
font8x8="NO"		# font 8x8 from /usr/share/syscons/fonts/* (or NO).

cp850-8x8.fnt

# (eeman "vidcontrol")
# (find-angg ".zshrc.local.bsd" "80x50")
#*
vidcontrol 80x50
#*

# (eeman "locate" "FILES")
# (find-fline "/usr/libexec/locate.updatedb")

/usr/libexec/locate.updatedb




#####
#
# Configuring lynx
# 2001may06
#
#####

# «lynx»  (to ".lynx")
# (find-es "lynx" "lynx_colors")
# (find-fline "/usr/local/etc/lynx.cfg" "http://lynx.browser.org/")
# (find-angg ".zshrc" "makeL")
STARTFILE:file://localhost/home/root/TH/L/index.html

# (find-es "lynx" "lynx_colors")
# (find-fline "/usr/local/etc/lynx.cfg" "#COLOR:7:magenta:cyan")
COLOR:0:lightgray:black
COLOR:1:brown:black
COLOR:2:yellow:blue
COLOR:3:green:black
COLOR:4:magenta:black
COLOR:5:brown:black
COLOR:6:brown:green
COLOR:7:magenta:cyan




#####
#
# FreeBSD 4.1 - first adjusts after installation
# 2000dec07
#
#####

# «freebsd41-adjusts0»  (to ".freebsd41-adjusts0")
cd /freebsd
laf
mount -o remount,rw /freebsd

# I want these symlinks to be relative:
rm home;	ln -s usr/home home
rm compat;	ln -s usr/compat compat

# Note: aaargh, it seems that linux-2.2 has bugs in creating symlinks
# in UFS slices; BSD sees the new symlinks as pointing to weird places...

makeLedrxtgz

mount -o remount,rw /freebsd/usr
cd /freebsd/home
mkdir root
cd /freebsd/home/root/
edrxpage THR

cd /freebsd/home/edrx/
edrxpage THR
chown -Rv 1001:1001 /freebsd/home/edrx

# (find-fline "/freebsd/")
# (find-fline "/freebsd/home/root/")
# (find-fline "/freebsd/etc/")
# (find-fline "/hda1/boot/grub/")



  This is what dmesg said:

ad0: 7907MB <WDC AC28200R> [16067/16/63] at ata0-master using UDMA33
ad2: 3079MB <QUANTUM FIREBALL ST3.2A> [6256/16/63] at ata1-master using UDMA33
ad3: 19536MB <ST320423A> [39693/16/63] at ata1-slave using UDMA33
acd0: CD-RW <4X4X32> at ata0-slave using PIO4
Mounting root from ufs:wd2s1a

  These are the last messages before falling into single-user mode:

mount: /dev/ad2s1a on /: specified device does not match mounted device
Mounting /etc/fstab filesystems failed, startup aborted
Enter full pathname of shell or RETURN for /bin/sh:

  /etc/fstab:

# Device     Mountpoint        FStype  Options    Dump Pass#
/dev/ad2s1a  /                 ufs     rw         1    1
/dev/ad2s1b  none              swap    sw         0    0
/dev/ad2s1f  /usr              ufs     rw         2    2
/dev/ad2s1e  /var              ufs     rw         2    2
/dev/acd0c   /cdrom            cd9660  ro,noauto  0    0
proc         /proc             procfs  rw         0    0

  I forgot to save the output of "mount", but IIRC it said that proc
  was right and:

 wd2s1a      was mounted R/O in /
 /dev/ad2s1f was mounted R/W in /usr
 /dev/ad2s1e was mounted R/W in /var


# options EXT2FS
# LINT

# (find-fline "/freebsd/usr/home/root/")
# (find-fline "/freebsd/stand/")
# (find-fline "~/tmp/ofindbsd")

/stand/sysinstall
disklabel



#####
#
# ports
# 2001jul17
#
#####

# «ports»  (to ".ports")
# (find-fline "~/tmp/ofindbsd")
# (find-fline "/freebsd/usr/ports/README" "distfiles")
# (find-fline "/freebsd/usr/ports/lang/")
# (find-fline "/freebsd/usr/ports/lang/expect/Makefile")
# (find-fline "/freebsd/usr/ports/lang/tcl82/")
# (find-fline "/freebsd/usr/ports/lang/tcl82/Makefile" ".include")
# (find-fline "/freebsd/usr/ports/Mk/")

locate bsd.port
# But where is it specified the ".include <xxx>" in a makefile will search 
# /usr/ports/Mk, /usr/share/mk, or whatever?
# (find-node "(gcc)Directory Options" "`-I-'")

# (find-fline "/freebsd/usr/ports/Mk/")
# (find-fline "/freebsd/usr/ports/Mk/bsd.sites.mk")
# (find-fline "/freebsd/usr/share/mk/")
# (find-fline "/freebsd/usr/share/mk/bsd.README")
# (find-fline "/freebsd/usr/src/share/mk/")
# (find-fline "/freebsd/usr/src/share/mk/bsd.README")
# (find-fline "/freebsd/usr/share/doc/psd/12.make/paper.ascii.gz")
zless /freebsd/usr/share/doc/psd/12.make/paper.ascii.gz

# (find-fline "/freebsd/usr/ports/x11-toolkits/tk82/")

cp -iv $S/http/www.clinet.fi/~walker/minicom-1.83.1.src.tar.gz /freebsd/usr/ports/distfiles/
cp -iv $S/http/www.ohse.de/uwe/releases/lrzsz-0.12.20.tar.gz   /freebsd/usr/ports/distfiles/
cp -iv $S/ftp/ftp.scriptics.com/pub/tcl/tcl8_2/tcl8.2.3.tar.gz /freebsd/usr/ports/distfiles/







#####
#
# more freebsd notes
# 2000jan11
#
#####

# (find-fline "/freebsd/home/root/")
# (find-fline "/freebsd/home/root/notes")
# (load-library "~/.emacs")
# (find-fline "/etc/passwd")
# (find-fline "/etc/")

#*
# (find-fline "/root/.bashrc")
cat >> /home/.bashrc <<'---'
alias log_zsh='HOME=/home/root zsh'
---
#*

# Paste this to vipw:
broot::0:0::0:0:broot:/home/root:/usr/local/bin/bash
zroot::0:0::0:0:broot:/home/root:/usr/local/bin/zsh




#####
#
# Adding login entries without password
# 2000jan11
#
#####

# «empty_passwd»  (to ".empty_passwd")
#*
# (eeman "8 vipw")
# (eeman "8 pwd_mkdb")
(export EDITOR=touch; truss -o ~/s vipw)
# (find-fline "~/s")

#*
# (find-fline "/etc/passwd")
# (find-fline "/etc/master.passwd")
cat >> /etc/master.passwd <<'---'
broot::0:0::0:0:broot:/home/root:/usr/local/bin/bash
zroot::0:0::0:0:broot:/home/root:/usr/local/bin/zsh
---
#*
pwd_mkdb -p /etc/master.passwd

#*





#####
#
# ppp
#
#####

# «ppp»  (to ".ppp")
# (code-c-d "bsdbooks" "/freebsd/usr/share/doc/en_US.ISO_8859-1/books/")
# (find-bsdbooksfile "faq/ppp.html")
# (find-bsdbooksfile "handbook/ppp-and-slip.html")
# (find-bsdbooksfile "handbook/ppp.html")
# (find-bsdbooksfile "handbook/pppoe.html")
# (find-bsdbooksfile "handbook/userppp.html")
# (find-bsdbooksfile "ppp-primer/")
# (find-fline "/freebsd/usr/share/examples/ppp/")
#*
# (eeman-freebsd "8 ppp" "AUTOMATIC DIALING")
#*

# Tirloni's ppp.conf:

default:
 ident user-ppp VERSION (built COMPILATIONDATE)
 set device /dev/cuaa1

 set log Phase Chat tun command
 set speed 115200
 set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \
           \"\" AT OK-AT-OK ATE1Q0 OK ATM0L0 OK \\dATDT\\T TIMEOUT 40 CONNECT"
 set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0
 set timeout 120
 add default HISADDR

nome_do_provedor:
 set phone 2210700 
 set authname joaozinho 
 set authkey abcdef123

# Then ppp -b ispname






# (eeman "1 locate")
# (eeman "8 locate.updatedb")
# (find-fline "/usr/libexec/locate.updatedb")
#*
/usr/libexec/locate.updatedb
#*

# (eeman "8 pwd_mkdb")
# (eeman 
# (find-fline "/cdrom/")




Hi all, the hints from one hour ago worked wonderfully, but I still
have many many questions... Of course I'll be glad to accept RTFM
answers if they come with pointers to where to find the relevant docs.

First set of questions, related to tracing and gdb'ing vipw: 

What is the BSD correspondent of Linux's "strace"? In what package
does it come? And the package with vipw? Is there a file in the
installation CD that lists the contents (i.e., the files) of all
packages? If not, how do I build one? Where is the source code for a
certain package? How does one rebuild a binary package from its
sources?

Second set of questions, related to the keyboard, in console mode...

I would like to have my left "Alt" key working as a "Meta" key (it is
just being ignored now), and I would like to have the backspace key
send a "del" (char 127) and the "del" keys send the usual vt102 "del"
string, which is ESC .. .. .. . Is there a keymap that already does
that? In case I will have to create my own version of
/usr/share/syscons/keymaps/us.emacs.kbd, how do I make it the default
keymap? And, for the testing stage, how do I load it on all consoles?
Is there a way to make a single console use it?


truss
ktrace
kdump

find /usr/src/usr.sbin -name vipw*
cd /usr/src/usr.sbin/vipw
make


https://www.youtube.com/c/RoboNuggie




#  Local Variables:
#  coding:               utf-8-unix
#  End: