#############################################################
# How to make single boot floppy for Network install
#############################################################
# ${DIFFD} <- set to the directory of the diff includes
# hosts network.server network.client .rhosts rc rc.local
# lilo.conf passwd
# ${ROOT} <- work file for the root file system
# ${WORK} <- mount point (directory) for the work file
# ${OLD} <- directory with NON-ELF (a.out) binaries includes
# in.rexecd in.rshd inetd rpc.portmap in.rlogind in.telnetd
# rpc.pcnfsd tcpd
# sleep rcp rlogin rsh ps df rpc services inetd.conf
# /dev/loop0 <- loop-back device for mounting files as filesystems
# /dev/fdo <- device of Boot Floppy
##############################################################
# 1. Creating the root file system
##############################################################
zcat /cdrom/slackware-3.1/rootdisks/pcmcia.gz > ${ROOT}
/sbin/losetup /dev/loop0 ${ROOT}
mount /dev/loop0 ${WORK}
##############################################################
# 2. Delete unnecessary files to free up disk space
##############################################################
for f in pkgtool pkgtool.tty setup setup.tty swapon
do
rm ${WORK}/bin/$f
done
for f in fdisk mke2fs mkswap swapon
do
rm ${WORK}/sbin/$f
done
for f in issue
do
rm ${WORK}/etc/$f
done
##############################################################
# 3. Add missing files
##############################################################
for f in in.rexecd in.rshd inetd rpc.portmap in.rlogind in.telnetd \
rpc.pcnfsd tcpd
do
cp ${OLD}/$f ${WORK}/usr/sbin/
done
for f in rcp rlogin rsh sleep
do
cp ${OLD}/$f ${WORK}/usr/bin
done
for f in ps df
do
cp ${OLD}/$f ${WORK}/bin
done
for f in rpc services inetd.conf
do
cp ${OLD}/$f ${WORK}/etc
done
##################################################################
# 4. Setup to make a working installation disk
##################################################################
# Setup network:
cat ${DIFFD}/hosts >> ${WORK}/etc/hosts
# Add working user pcnfs
cat ${DIFFD}/passwd >> ${WORK}/etc/passwd
# Network file for server:
# cp ${DIFFD}/network.server ${WORK}/etc/pcmcia
# Or for client:
cp ${DIFFD}/network.client ${WORK}/etc/pcmcia
# Register the machines used in installation:
cp ${DIFFD}/.rhosts ${WORK}/
chown pcnfs.users ${WORK}/.rhosts
# Have to fix /etc/rc:
cat ${DIFFD}/rc >> ${WORK}/etc/rc
# For client, need the rc.local too:
cp ${DIFFD}/rc.local ${WORK}/etc/rc.d/
##################################################################
# 5. Creating a boot floppy
##################################################################
#
fdformat /dev/fd0u1440
mkfs -t ext2 /dev/fd0
mount /dev/fd0 /mnt
rmdir /mnt/lost+found
mkdir /mnt/boot
# Copy the device:
(cd /; tar cvf - dev/fd0* dev/ram* | tar xvCf /mnt -)
# Copy boot:
cp /boot/map /mnt/boot
cp /boot/boot.* /mnt/boot/
# Copy the kernel:
cp /cdrom/slackware-3.1/kernels/net.i/bzImage /mnt/
# Compress root:
umount ${WORK}
/sbin/losetup -d /dev/loop0
gzip ${ROOT}
# Copy root:
cp ${ROOT}.gz /mnt/root.gz
# Make lilo.conf:
mkdir /mnt/etc
cp ${DIFFD}/lilo.conf /mnt/etc/
# execute lilo.conf:
umount /mnt
mount /dev/fd0 /mnt
lilo -r /mnt
#
umount /mnt
####################################################################
# Our prepared sources
############## ${DIFFD}/rc #####################
NET="/usr/sbin"
echo -n "Starting daemons:"
if [ -f ${NET}/rpc.portmap ]; then
echo -n " rpc.portmap"
${NET}/rpc.portmap
fi
if [ -f ${NET}/inetd ]; then
echo -n " inetd"
${NET}/inetd
else
echo "no INETD found. INET cancelled!"
exit 1
fi
if [ -f ${NET}/rpc.pcnfsd ]; then
echo -n " rpc.pcnfsd"
${NET}/rpc.pcnfsd
fi
mount -t msdos /dev/hda1 /mnt -o rw,umask=000,user
if [ -x /etc/pcmcia/network ] ; then
/sbin/route | fgrep eth0 || /etc/pcmcia/network start eth0
fi
if [ -x /etc/rc.d/rc.local ] ; then
echo
/etc/rc.d/rc.local
fi
############# ${DIFFD}/rc.local ##################
#!/bin/sh
RHOST=server.foo.bar.com
sleep 5
echo
echo
echo
echo
echo 'Installing FUJITEC monitor system.'
echo 'It takes 10 minutes. Press "Enter" key to start.'
read ans
if [ -f /mnt/autoexec.bat ]
then
if [ -f /mnt/original.bat ]
then
echo
echo "C:AUTOEXEC.BAT and C:ORIGINAL.BAT exist"
echo -n "I will remove C:AUTOEXEC.BAT, OK(Y/n)? ==>"
read ans
if [ "$ans" = "n" -o "$ans" = "N" ]
then
echo "aborting installation"
exit
fi
else
mv /mnt/autoexec.bat /mnt/original.bat
fi
fi
if [ -d /mnt/linux ] ; then
echo
echo "I found C:LINUX, and remove it"
rm -rf /mnt/linux
fi
echo
echo "Copying System Files........."
su pcnfs -c "rcp -r ${RHOST}:/mnt/linux /mnt/linux"
echo
echo
echo
if [ -d /mnt/linux/etc -a -d /mnt/linux/bin ]
then
cp /mnt/linux/linux.bat /mnt/autoexec.bat
if [ -f /mnt/config.sys ] ; then
mv /mnt/config.sys /mnt/original.sys
fi
echo "System installation has been completed!!"
echo
echo "Remove the floppy and restart the computer."
echo " (turn OFF then ON the power switch)"
echo "The FUJITEC Monitor System will start up automatically."
else
echo "System installation has been not completed!!"
echo ""
echo "Check your network and try again!!"
fi
echo
echo
/bin/sync
############ ${DIFFD}/lilo.conf ###################
# LILO configuration file
# Start LILO global section
boot = /dev/fd0u1440
delay = 0
vga = normal # force sane state
ramdisk = 1440 # paranoia setting
# End LILO global section
image = /bzImage
root = /dev/ram0
initrd = root.gz
label = linux
read-only # Non-UMSDOS filesystems should be mounted read-only for checking
############ ${DIFFD}/passwd ###################
pcnfs:*:65534:100:pc-nfs:/:/bin/csh
############ ${DIFFD}/.rhost ###################
server.foo.bar.com
client.foo.bar.com
############ ${DIFFD}/hosts ####################
192.168.0.1 server.foo.bar.com
192.168.0.2 client.foo.bar.com
############ ${DIFFD}/network.client ###########
#! /bin/sh
action=$1
device=$2
# ${DIFFD}/network.server is IPADDR="192.168.0.1"
IPADDR="192.168.0.2"
NETMASK="255.255.255.0"
NETWORK="192.168.200.0"
BROADCAST="192.168.200.255"
case "${action:?}" in
'start')
/sbin/ifconfig ${device:?} up ${IPADDR} broadcast ${BROADCAST} \
netmask ${NETMASK}
/sbin/route add -net ${NETWORK} netmask ${NETMASK}
# /sbin/route add default gw ${GATEWAY} metric 1
;;
'stop')
/sbin/route del default
/sbin/route del ${NETWORK}
/sbin/ifconfig ${device:?} down
;;
'restart')
/sbin/ifconfig ${device:?} down up
;;
esac
Copyright © 1994 - 2019 Linux Journal. All rights reserved.