Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
#######
#
# E-scripts on installing Potato from some messy CDs
#
# 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/potato.e>
#           or at <http://angg.twu.net/e/potato.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/>.
#
#######




# «.testing_.debs»	(to "testing_.debs")
# «.swap»		(to "swap")
# «.pot1cd_0»		(to "pot1cd_0")
# «.pot1cd_0a»		(to "pot1cd_0a")
# «.pot1cd_0b»		(to "pot1cd_0b")
# «.stop-restart-services»	(to "stop-restart-services")
# «.pot1cd_0c»		(to "pot1cd_0c")
# «.pot1cd_0d»		(to "pot1cd_0d")
# «.cheapbytes_potato»	(to "cheapbytes_potato")
# «.rescue_other_kernel»	(to "rescue_other_kernel")




#####
#
# Testing the .debs
#
#####

# «testing_.debs»  (to ".testing_.debs")

cd /big/potato/
for f in $(find * -type f -and -name '*.deb'); do
  echo $f:
  ar p $f data.tar.gz | gzip -t
done |& tee ~/tmp/potato-testdebs

# (find-fline "~/tmp/potato-testdebs")


cd /big/slinkb1/
for f in $(find * -type f -and -name '*.deb'); do
  echo $f:
  ar p $f data.tar.gz | gzip -t
done |& tee ~/tmp/slink-testdebs

# (find-fline "~/tmp/slink-testdebs")





#####
#
# Swap files
#
#####

# «swap»  (to ".swap")

SWAP=/hdc6/tmp/swap1
#SWAP=/swap1

dd if=/dev/zero of=$SWAP bs=1024 count=65536
chmod 600 $SWAP
mkswap $SWAP


SWAP=/hdc6/tmp/swap1
#SWAP=/swap1

cat /proc/swaps
swapon $SWAP
cat /proc/swaps





#####
#
# Running a chrooted potato dselect and straceing it
#
#####

umount /dev/hdc2
rmdir /big
rm /big
ln -s hdd1/big /big
# mount /dev/hdc2 /hdd1/big -o ro
  mount /dev/hdc2 /hdd1/big
mount

chroot /hdd1 /bin/sh


# (find-fline "/hdd1/etc/apt/sources.list")
#
# deb file:/big/potato dists/potato/main/binary-i386/ 
# deb file:/big/potato dists/potato/contrib/binary-i386/ 
# deb file:/big/potato dists/potato/non-free/binary-i386/ 


umount /dev/hdc2
rm /big
mkdir /big
mount /big



# Delete old links from "binary-386/*/*.deb" to binary-all

rm -v $(
find /big/potato/dists/potato/{main,contrib,non-free}/binary-i386/ \
  -type l
)


# Copy (with ln -s) every .deb in binary-all to binary-i386.
# Note: almost all of the binary-all .debs apply to i386.

for i in main contrib non-free; do
  cd /big/potato/dists/potato/$i/binary-all/
  for j in */*.deb; do
    ln -s ../../binary-all/$j /big/potato/dists/potato/$i/binary-i386/$j
  done
done


# (find-fline "$SDEBIAN/ls-lR.i")
# (find-fline "$SDEBIAN/ls-lR.i" "binary-i386/base/netbase")


# There are still some files missing:

dists/frozen/main/binary-i386/base/tar_1.13.17-2.deb
dists/frozen/main/binary-i386/mail/exim_3.12-7.deb
dists/frozen/main/binary-i386/doc/man-db_2.3.15.deb
dists/frozen/main/binary-i386/base/libreadline4_4.1-1.deb
dists/frozen/main/binary-i386/net/dnsutils_8.2.2p5-9.deb
dists/frozen/main/binary-i386/doc/doc-debian_2.2.deb
dists/frozen/main/binary-i386/doc/doc-linux-text_2000.03-1.deb
dists/frozen/main/binary-i386/net/finger_0.10-3.deb
dists/frozen/main/binary-i386/net/fingerd_0.10-3.deb
dists/frozen/main/binary-i386/misc/gpm_1.17.8-16.deb
dists/frozen/main/binary-i386/mail/mpack_1.5-5.deb
dists/frozen/main/binary-i386/base/netbase_3.18-1.deb
dists/frozen/main/binary-i386/admin/base-config_0.24.deb
dists/frozen/main/binary-i386/base/libnewt0_0.50-6.deb
dists/frozen/main/binary-i386/base/whiptail_0.50-6.deb

# Two alternatives: rebuild the "Packages" file or download the new
# versions.




#####
#
# Other things
#
#####

dselect needed many "[I]nstall" runs
kbdrate
netscape depends on some slink libs
exim has lost my mail
zsh-3.1.6 has a bindkey/tab bug
emacs19 doesn't search /usr/share/info
xmame-svga is unable to open scramble.zip
expect5.24 expects one character too much
mouseconfig froze on port detection

# (find-vldifile "fvwm.list")
# (find-fline "/usr/doc/fvwm/")

# (find-fline "/usr/doc/fvwm/README.Debian_upgrading.gz" "better\nmethod")


cd ~/.fvwm2/
cp -v *hook ~/tmp/


# (find-fline "/usr/X11R6/bin/fvwmrc_convert")
fvwmrc_convert


apache
info2www

# (find-vldifile "gnapster.list")
# (find-fline "/usr/doc/gnapster/")





#####
#
# mini-potato on one CD: first steps, again
# 2000may08
#
#####

# «pot1cd_0»  (to ".pot1cd_0")
# «pot1cd_0a»  (to ".pot1cd_0a")

# I got a small scratch partition in /dev/hdd3; now the trick is to
# use a loop device to simulate a root floppy and to use it to install
# a base system at /dev/hdd3, taking the base files from a dir
# somewhere at /big that fakes the installation CD; then I pack the
# contents of /dev/hdd3 in a file to avoid having to run the boot
# floppies again, and then I try to make the base system install a
# full system from the fake CD.

# Run dbootstrap on a loopdev-mounted root floppy.

zcat /big/potato/dists/potato/main/disks-i386/current/images-1.44/root.bin \
  > /tmp/root.img
mkdir -p /L
mountloop0L /tmp/root.img

mount -t proc proc2 /L/proc
umount /big
umount /hdd3

strace-to ~/s chroot /L /sbin/dbootstrap

# (find-fline "/etc/fstab" "/big")
# Use:
#   install medium - harddisk
#   partition: /dev/hda2
#   path: /instmnt/potato
#
# (find-fline "~/s")

# dbootstrap tries to reboot the system when finished. Kill it
# instead, and logoff/logon again on that terminal to reset it to a
# usable state.

kill -9 $(pidof dbootstrap)
cat /proc/mounts

umount /L/proc
umount -n /dev/hdd3
mount /hdd3

cd /hdd3/
tar -cvzf ~/tmp/base_hdd3.tgz *



# «pot1cd_0b»  (to ".pot1cd_0b")
# «stop-restart-services»  (to ".stop-restart-services")
# (find-es "xxx-server" "first_doc")
# (find-angg ".zshrc" "stop-restart-services")

# Next: the elegant solution is to keep the old system running, and do
# the installation by chrooting to hdd3... to do so we turn off most
# daemons of the main partition to free their ports, but without
# falling outside of runlevel 2; then we guess what the init in the
# child partition does and try to simulate it.

# (find-fline "/etc/init.d/")
# (find-fline "/etc/inittab")
# (find-fline "/etc/rc2.d/")

print -l /etc/rc2.d/* | tee ~/o
# (find-fline "~/o")
for i in $(tac ~/o); do
  echo $i; $i stop
done

# (find-fline "/hdd3/")
# (find-fline "/hdd3/etc/inittab" "dpkg-reconfigure")
# (find-fline "/hdd3/etc/init.d/")
# (find-fline "/hdd3/etc/init.d/rcS")
# (find-fline "/hdd3/etc/rc2.d/")
# (find-fline "/hdd3/etc/inittab" "dpkg-reconfigure")

umount /big
mount -t proc proc2 /hdd3/proc
chroot /hdd3 /etc/init.d/rc S
chroot /hdd3 /etc/init.d/rc 2

# We mount /big because we'll ask apt to use the "filesystem" method
mkdir /hdd3/big
chroot /hdd3 mount -o ro /dev/hda2 /big

# (find-fline "/hdd3/usr/sbin/dpkg-reconfigure")
chroot /hdd3 /usr/sbin/dpkg-reconfigure base-config

# No non-us, no non-free; repository at /big/potato. Advanced method;
# add zsh30, zsh30-doc (which is missing), wget, gnuserv, emacs20,
# expect5.24, tk8.0-dev and friends.

# Oops, no space left on device (I can try not to install emacs20-el),
# and the old bug on the first installations of man-db, but the rest
# seems ok.

chroot /hdd3 umount /big



# «pot1cd_0c»  (to ".pot1cd_0c")

# Unmount /hdd3/big and /hdd3/proc and turn off all /hdd3 daemons.

chroot /hdd3 umount /big
cat /proc/mounts

cd /hdd3/; print -l etc/rcS.d/* etc/rc2.d/* | tee ~/o
for i in $(tac ~/o); do
  echo $i; chroot /hdd3 /$i stop
done

umount /hdd3/proc




# «pot1cd_0d»  (to ".pot1cd_0d")

# If something went wrong with dselect we erase everything in /hdd3
# (considering that nothing else is mounted there!) and return to the
# situation that we had just after the installation of the base system
# by the root floppy; then we may repeat some of the steps above.

cat /proc/mounts
rm -Rv /hdd3/*
cd /hdd3/
mklost+found

umount /dev/hdd3

# My /dev/hdd is an old HD that sometimes has problems; sometimes
# Linux gives up dealing with it and I need to repair it someway.
# (find-fline "/etc/init.d/checkfs.sh")
# (eeman "fsck")
# (eeman "mke2fs" "-c  ")
#mycat /proc/ide/ide1/hdd/* |& l
#umount /dev/hdd3; fsck -C -f -y /dev/hdd3




# This block is for when something has gone wrong and we want to erase
# the new installation and start again from just after the install of
# the base system.




for i in $(<~/o); do
  echo $i; $i start
done
# You don't need to understand this:
(unset DISPLAY; /etc/init.d/gpm start)




#####
#
# cheapbytes potato CDs
# 2000oct07
#
#####

# «cheapbytes_potato»  (to ".cheapbytes_potato")

cd; mount /cdrom; cd /cdrom/
'ls' -lR | ~/ICON/lslR2find2 32 42 56 | tee ~/tmp/potato1
cd; mount /cdrom; cd /cdrom/
'ls' -lR | ~/ICON/lslR2find2 32 42 56 | tee ~/tmp/potato2
cd; mount /cdrom; cd /cdrom/
'ls' -lR | ~/ICON/lslR2find2 32 42 56 | tee ~/tmp/potato3
cd; mount /cdrom; cd /cdrom/
'ls' -lR | ~/ICON/lslR2find2 32 42 56 | tee ~/tmp/potsrc1
cd; mount /cdrom; cd /cdrom/
'ls' -lR | ~/ICON/lslR2find2 32 42 56 | tee ~/tmp/potsrc2
cd; mount /cdrom; cd /cdrom/
'ls' -lR | ~/ICON/lslR2find2 32 42 56 | tee ~/tmp/potsrc3
cd; mount /cdrom; cd /cdrom/
'ls' -lR | ~/ICON/lslR2find2 32 42 56 | tee ~/tmp/freebsd41
cd; mount /cdrom; cd /cdrom/
'ls' -lR | ~/ICON/lslR2find2 32 42 56 | tee ~/tmp/stampede

# (find-fline "~/tmp/potato1")
# (find-fline "~/tmp/potato2")
# (find-fline "~/tmp/potato3")
# (find-fline "~/tmp/potsrc1")
# (find-fline "~/tmp/potsrc2")
# (find-fline "~/tmp/potsrc3")
# (find-fline "~/tmp/freebsd41")
# (find-fline "~/tmp/stampede")

#*
cat ~/tmp/potato[123] | cut -b12- \
  | grep -v '/$' | grep -v 'TRANS.TBL' | sort \
  | perl -nle 's:^.*/([^/]+)$:\1: && print' | sort | uniq | grep '\.deb$' \
  > ~/tmp/potatocddebs
#*

cd /debian/
find * | perl -nle 's:^.*/([^/]+)$:\1: && print' | grep '\.deb$' \
  | sort | uniq \
  > ~/tmp/hddebs

#*

# (find-node "(textutils)comm invocation")
#comm -1 ~/tmp/potatocddebs ~/tmp/hddebs
#1: cds only
#	2: hd only
#		3: both
comm ~/tmp/potatocddebs ~/tmp/hddebs

#*

comm ~/tmp/potatocddebs ~/tmp/hddebs \
  | perl -nle 'm:^		(.*)$: && print "/$1"' \
  > /tmp/of
cd /
find /debian /potato | fgrep -f /tmp/of | tee /tmp/otodel \
  | perl -nle 'print "rm -v $_"' \
  | tee /tmp/otorm

#*

mkdir /hdd6/potatobin{1,2,3}

cd; mount /cdrom; cd /cdrom
cd /cdrom; cp -diPpvR .* * /hdd6/potatobin1

cd; mount /cdrom && cd /cdrom && cp -diPpvR .* * /hdd6/potatobin2

cd; mount /cdrom && cd /cdrom && cp -diPpvR .* * /hdd6/potatobin3






#####
#
# rescue floppy with another kernel
# 2000nov14
#
#####

# «rescue_other_kernel»  (to ".rescue_other_kernel")
# (find-angg ".zshrc" "loop_device")

# (find-fline "$SDEBIAN/")
# (find-fline "$SDEBIAN/dists/potato/main/disks-i386/2.2.15-2000-06-07/images-1.44/")
# (find-fline "$SDEBIAN/dists/potato/main/disks-i386/current/images-1.44/")

#*
cd $SDEBIAN/dists/potato/main/disks-i386/current/images-1.44/
cp -v rescue.bin /tmp/
insmod loop
mkdir /L
mount -o loop /tmp/rescue.bin /L
cd /L
ls -lAF
rm linux
cp -v /boot/vmlinuz-2.2.17-edrx linux
ls -lAF
cd
umount /L

cd /tmp/
#cat rescue.bin > /dev/fd0
#*










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