#!/bin/sh
#
# $Id: INSTALL,v 4.2 1993/03/23 16:44:06 mike Exp $
# Grab the init.d library functions.
. ./init.d/LIB
function get_return()
{
echo
echo $use_escapes "Press return to continue: (type 'shell' for shell) \c"
read i
if [ "$i" = "shell" ]; then
echo
echo "Type 'exit' or control-D to resume installation"
/bin/sh < /dev/tty > /dev/tty 2>&1
echo
echo "(continuing...)"
echo
fi
echo
}
cat << !!MSG1!!
This script installs a complete system boot management package comprising
a System V like version of init, a number of scripts and a set of run
level definitions. These give you complete control over the configuration
of your system. e.g. what ports are enabled, whether or not TCP/IP is
running, whether or not NFS is running, whether or not you go straight
into xdm on boot up etc.
*BEFORE* you continue you should have carefully checked the inittab
in this directory to make sure it does what you want. In particular
you should make sure the getty entries have the correct arguments
for your system. Some gettys use different arguments. You can find
out what yours wants by looking at your existing /etc/inittab file.
Edit the inittab here if necessary.
!!MSG1!!
echo $use_escapes "Are you sure you want to do this? (y/n or shell) \c"
read i
while [ "$i" = "shell" ]
do
echo
echo "Type 'exit' or control-D to resume installation"
/bin/sh < /dev/tty > /dev/tty 2>&1
echo
echo "(continuing...)"
echo
echo $use_escapes "Are you sure you want to do this? (y/n or shell) \c"
read i
done
if [ "$i" != "y" -a "$i" != "Y" ]; then
exit
fi
echo
echo $use_escapes "Have you got some way of booting from floppy? (y/n or shell) \c"
read i
while [ "$i" = "shell" ]
do
echo
echo "Type 'exit' or control-D to resume installation"
/bin/sh < /dev/tty > /dev/tty 2>&1
echo
echo "(continuing...)"
echo
echo $use_escapes "Have you got some way of booting from floppy? (y/n or shell) \c"
read i
done
if [ "$i" != "y" -a "$i" != "Y" ]; then
echo
echo "Get a bootable disk. If there are any problems with this installation"
echo "you are going to need it!"
exit
fi
cat << !!MSG2!!
Ok, I'm trusting you...
First I'll install a few scripts and configure the basics...
!!MSG2!!
echo
echo "Setting up boot scripts /etc/bcheckrc and /etc/brc"
if [ -f /etc/bcheckrc ]; then
echo " Backing up /etc/bcheckrc to /etc/bcheckrc.old"
cp /etc/bcheckrc /etc/bcheckrc.old
fi
if [ -f /etc/brc ]; then
echo " Backing up /etc/brc to /etc/brc.old"
cp /etc/brc /etc/brc.old
fi
cp bcheckrc brc /etc/.
chmod 744 /etc/bcheckrc /etc/brc
get_return
echo
echo "Installing the init scripts in /etc/init.d"
mkdir /etc/init.d > /dev/null 2>&1
chmod 755 /etc/init.d
for i in LIB cron filesys news nfs nfs-fs rpc swap tcp
do
if [ -f /etc/init.d/$i ]; then
echo " Backing up /etc/init.d/$i to /etc/init.d/$i.old"
mv /etc/init.d/$i /etc/init.d/$i.old
fi
cp init.d/$i /etc/init.d/$i
chmod 755 /etc/init.d/$i
done
get_return
echo
echo "Setting scripts for each run level."
echo "I'll do this by wiping out anything in the /etc/rc?.d directories and"
echo "then installing things as I see fit. If you already had a SYSV style"
echo "init running and had created local scripts which you linked in to the"
echo "rc?.d directories you will need to remake the links later. If you"
echo "put scripts in an rc?.d directory without linking them to init.d they"
echo "will be *lost*! In this case you had better shell out now and do"
echo "something about them."
get_return
mkdir /etc/rc0.d /etc/rc1.d /etc/rc2.d /etc/rc3.d /etc/rc4.d /etc/rc5.d > /dev/null 2>&1
chmod 755 /etc/rc0.d /etc/rc1.d /etc/rc2.d /etc/rc3.d /etc/rc4.d /etc/rc5.d
rm -f /etc/rc0.d/* /etc/rc1.d/* /etc/rc2.d/* /etc/rc3.d/* /etc/rc4.d/* /etc/rc5.d/*
ln -fs /etc/init.d/news /etc/rc0.d/K20news
ln -fs /etc/init.d/cron /etc/rc0.d/K30cron
ln -fs /etc/init.d/nfs /etc/rc0.d/K50nfs
ln -fs /etc/init.d/rpc /etc/rc0.d/K55rpc
ln -fs /etc/init.d/nfs-fs /etc/rc0.d/K58nfs-fs
ln -fs /etc/init.d/tcp /etc/rc0.d/K60tcp
ln -fs /etc/init.d/swap /etc/rc0.d/K69swap
ln -fs /etc/init.d/filesys /etc/rc0.d/K70filesys
ln -fs /etc/init.d/news /etc/rc1.d/K20news
ln -fs /etc/init.d/cron /etc/rc1.d/K30cron
ln -fs /etc/init.d/nfs /etc/rc1.d/K50nfs
ln -fs /etc/init.d/rpc /etc/rc1.d/K55rpc
ln -fs /etc/init.d/nfs-fs /etc/rc1.d/K58nfs-fs
ln -fs /etc/init.d/tcp /etc/rc1.d/K60tcp
ln -fs /etc/init.d/swap /etc/rc1.d/K69swap
ln -fs /etc/init.d/filesys /etc/rc1.d/K70filesys
ln -fs /etc/init.d/nfs /etc/rc2.d/K50nfs
ln -fs /etc/init.d/rpc /etc/rc2.d/K55rpc
ln -fs /etc/init.d/nfs-fs /etc/rc2.d/K58nfs-fs
ln -fs /etc/init.d/tcp /etc/rc2.d/K60tcp
ln -fs /etc/init.d/filesys /etc/rc2.d/S20filesys
ln -fs /etc/init.d/swap /etc/rc2.d/S21swap
ln -fs /etc/init.d/cron /etc/rc2.d/S50cron
ln -fs /etc/init.d/news /etc/rc2.d/S60news
ln -fs /etc/init.d/nfs /etc/rc3.d/K50nfs
ln -fs /etc/init.d/rpc /etc/rc3.d/K55rpc
ln -fs /etc/init.d/filesys /etc/rc3.d/S20filesys
ln -fs /etc/init.d/swap /etc/rc3.d/S21swap
ln -fs /etc/init.d/tcp /etc/rc3.d/S30tcp
ln -fs /etc/init.d/nfs-fs /etc/rc3.d/S35nfs-fs
ln -fs /etc/init.d/cron /etc/rc3.d/S50cron
ln -fs /etc/init.d/news /etc/rc3.d/S60news
ln -fs /etc/init.d/filesys /etc/rc4.d/S20filesys
ln -fs /etc/init.d/swap /etc/rc4.d/S21swap
ln -fs /etc/init.d/tcp /etc/rc4.d/S30tcp
ln -fs /etc/init.d/nfs-fs /etc/rc4.d/S35nfs-fs
ln -fs /etc/init.d/rpc /etc/rc4.d/S35rpc
ln -fs /etc/init.d/nfs /etc/rc4.d/S40nfs
ln -fs /etc/init.d/cron /etc/rc4.d/S50cron
ln -fs /etc/init.d/news /etc/rc4.d/S60news
ln -fs /etc/init.d/filesys /etc/rc5.d/S20filesys
ln -fs /etc/init.d/swap /etc/rc5.d/S21swap
ln -fs /etc/init.d/tcp /etc/rc5.d/S30tcp
ln -fs /etc/init.d/nfs-fs /etc/rc5.d/S35nfs-fs
ln -fs /etc/init.d/rpc /etc/rc5.d/S35rpc
ln -fs /etc/init.d/nfs /etc/rc5.d/S40nfs
ln -fs /etc/init.d/cron /etc/rc5.d/S50cron
ln -fs /etc/init.d/news /etc/rc5.d/S60news
get_return
echo
echo "Creating system default files."
mkdir /etc/default > /dev/null 2>&1
chmod 755 /etc/default
echo
echo " Your system appears to be called `hostname`. If this is incorrect you"
echo " must edit the file /etc/default/hostname and reboot for the change to"
echo " take effect."
hostname > /etc/default/hostname
chmod 644 /etc/default/hostname
get_return
echo
echo " I will install a dummy /etc/default/swap file. This file lists"
echo " swap partitions/files and block sizes. Swap partitions (or files"
echo " or files in /dev) are mkswapped and attached at boot time. Swap"
echo " files other than those in /dev are mkswapped and attached after"
echo " the filesystems have been mounted. If you *need* swap it must"
echo " be in /dev regardless of whether it is a file or partition."
echo " Note: you still need the swap partition(s) listed in /etc/fstab"
echo " in order for swapon -a to work."
if [ -f /etc/default/swap ]; then
echo
echo " Oh. You seem to have an /etc/default/swap file. I'll leave"
echo " it alone and put mine in as /etc/default/swap.new just in"
echo " case you want to check that what you have makes sense with"
echo " this file's structure."
cp default/swap /etc/default/swap.new
chmod 644 /etc/default/swap
else
cp default/swap /etc/default/swap
chmod 644 /etc/default/swap
fi
get_return
echo
echo " I will install a dummy /etc/default/tcp. If you are running tcp"
echo " you *will* need to edit this file. Note that the IPADDR line is"
echo " commented out. An IPADDR defined here overrides the address given"
echo " in your hosts file. With IPADDR defined here you probably don't"
echo " need a hosts file if you use named?"
if [ -f /etc/default/tcp ]; then
echo
echo " Oh. You seem to have an /etc/default/tcp file. I'll back"
echo " it up to tcp.old and install the new one. You *will* need"
echo " to edit this again to set your address and net addresses"
mv /etc/default/tcp /etc/default/tcp.old
fi
cp default/tcp /etc/default/tcp
chmod 644 /etc/default/tcp
get_return
echo
echo
echo "THE FOLLOWING CHANGES COULD MAKE SYSTEM UNBOOTABLE!"
echo
echo "Have you checked inittab and edited the getty entries as appropriate"
echo $use_escapes "to your system? (y/n or shell) \c"
read i
while [ "$i" = "shell" ]
do
echo
echo "Type 'exit' or control-D to resume installation"
/bin/sh < /dev/tty > /dev/tty 2>&1
echo
echo "(continuing...)"
echo
echo "Have you checked inittab and edited the getty entries as appropriate"
echo $use_escapes "to your system? (y/n or shell) \c"
read i
done
if [ "$i" != "y" -a "$i" != "Y" ]; then
echo
echo "DO IT NOW!!!!"
echo
echo "When you have done type exit (or control-D) to return to this script"
/bin/sh
fi
echo
echo $use_escapes "Are you sure you could boot from floppy if necessary? (y/n or shell) \c"
read i
while [ "$i" = "shell" ]
do
echo
echo "Type 'exit' or control-D to resume installation"
/bin/sh < /dev/tty > /dev/tty 2>&1
echo
echo "(continuing...)"
echo
echo $use_escapes "Are you sure you could boot from floppy if necessary? (y/n or shell) \c"
read i
done
if [ "$i" != "y" -a "$i" != "Y" ]; then
echo
echo "If anything goes wrong you could be well stuffed..."
fi
echo
echo $use_escapes "Are you absolutely sure you want to do this? (y/n or shell) \c"
read i
while [ "$i" = "shell" ]
do
echo
echo "Type 'exit' or control-D to resume installation"
/bin/sh < /dev/tty > /dev/tty 2>&1
echo
echo "(continuing...)"
echo
echo $use_escapes "Are you absolutely sure you want to do this? (y/n or shell) \c"
read i
done
if [ "$i" != "y" -a "$i" != "Y" ]; then
echo
echo "Installation aborted. Coward :-)"
exit
fi
echo
echo "Installing new version of init"
if [ ! -f /lib/libc.so.4.3.2 ]; then
echo " WHOA!!!! This init needs /lib/libc.so.4.3.2 which you don't appear"
echo " to have. You need to get it before I do the final install!"
echo
echo "Installation stopped. Missing shared library."
exit
fi
if [ -f /bin/init ]; then
echo " Backing up /bin/init to /bin/init.old"
rm -f /bin/init.old
mv /bin/init /bin/init.old
fi
if [ -f /etc/init ]; then
echo " Backing up /etc/init to /etc/init.old"
rm -f /etc/init.old
mv /etc/init /etc/init.old
fi
cp init/init /etc/init
chmod 700 /etc/init
echo
echo "Setting up the master run level control script"
if [ -f /etc/rc ]; then
echo " Backing up /etc/rc to /etc/rc.old"
cp /etc/rc /etc/rc.old
else
echo " Huh?!? You don't seem to have an /etc/rc script."
echo " How did this system ever work???"
echo " Oh, never mind..."
fi
cp rc /etc/rc
chmod 744 /etc/rc
get_return
if [ -d /sbin ]; then
echo
echo "Ah! You have an /sbin! I'll assume you keep your super user only"
echo "programs there (or intend to) and put mine there."
spath=/sbin
else
echo
echo "Hmmm... You don't have an /sbin directory for super user only programs."
echo "I'll put mine in /bin..."
spath=/bin
fi
get_return
echo
echo "You should be using a shutdown from poe's admutils. This attempts to"
echo "do a umount -a before shutting the system down. This is a Good Idea"
echo "especially if you have NFS filesystems mounted."
echo "To be on the safe side I have one here that I'll install for you."
if [ -x /sbin/shutdown ]; then
echo
echo " You have a shutdown in /sbin. I'll back it up to"
echo " /sbin/shutdown.old."
rm -f /sbin/shutdown.old
mv /sbin/shutdown /sbin/shutdown.old
rm -f /sbin/reboot /sbin/halt /sbin/fastboot /sbin/fasthalt
fi
if [ -x /bin/shutdown ]; then
echo
echo " You have a shutdown in /bin. I'll back it up to"
echo " /bin/shutdown.old."
rm -f /bin/shutdown.old
mv /bin/shutdown /bin/shutdown.old
rm -f /bin/reboot /bin/halt /bin/fastboot /bin/fasthalt
fi
if [ -x /usr/bin/shutdown ]; then
echo
echo " You have a shutdown in /usr/bin. I'll back it up to"
echo " /usr/bin/shutdown.old."
rm -f /usr/bin/shutdown.old
mv /usr/bin/shutdown /usr/bin/shutdown.old
rm -f /usr/bin/reboot /usr/bin/halt /usr/bin/fastboot /usr/bin/fasthalt
fi
cp extra/shutdown $spath/shutdown
chmod 755 $spath/shutdown
ln -fs $spath/shutdown $spath/reboot
ln -fs $spath/shutdown $spath/halt
ln -fs $spath/shutdown $spath/fastboot
ln -fs $spath/shutdown $spath/fasthalt
get_return
echo
echo "You also want an up to date mount/umount on your system. I have one"
echo "here which consists of hlu's 98.5 release of mount with the NFS patches"
echo "folded in. I'll install it in /etc and rename any other mounts or"
echo "umounts I can find to mount.old and umount.old respectively."
echo
for i in /etc /sbin /bin /usr/bin
do
if [ -x $i/mount ]; then
echo " Renamed $i/mount to $i/mount.old"
rm -f $i/mount.old
mv $i/mount $i/mount.old
fi
if [ -x $i/umount ]; then
echo " Renamed $i/umount to $i/umount.old"
rm -f $i/umount.old
mv $i/umount $i/umount.old
fi
done
cp extra/mount extra/umount /etc
chmod 755 /etc/mount /etc/umount
get_return
if [ -x /etc/telinit ]; then
rm -f /etc/telinit
fi
if [ -x /bin/telinit ]; then
rm -f /bin/telinit
fi
if [ -x /sbin/telinit ]; then
rm -f /sbin/telinit
fi
if [ "$spath" = "/sbin" ]; then
echo "I'll put telinit in your /sbin directory..."
ln -s /etc/init /sbin/telinit
else
echo "I'll put telinit in your /etc directory..."
ln -s /etc/init /etc/telinit
fi
get_return
if [ -z "`pathof ctrlaltdel`" ]; then
echo "If you want init to catch ctrl-alt-del and do a graceful shutdown"
echo "and reboot you need the ctrlaltdel program from poe's admutils so"
echo "the kernel can be told what we want to do when the system is booted."
echo "I have one here :-). I'll install it for you in $spath."
cp extra/ctrlaltdel $spath/ctrlaltdel
chmod 700 extra/ctrlaltdel
fi
get_return
echo
echo "Installing the System V-a-like inittab from this directory"
echo "- which you have modified to match your system!"
echo "(If you haven't, shell out now and edit /etc/inittab!)"
if [ -f /etc/inittab ]; then
cp /etc/inittab /etc/inittab.old
cp inittab /etc/inittab
chmod 644 /etc/inittab
fi
get_return
cat << !!MSG3!!
Run level 2 is multiuser but without TCP/IP running.
Run level 3 is mutiluser with TCP/IP running.
Run level 4 is multiuser with TCP/IP and NFS running.
Run level 5 is multiuser with TCP/IP and NFS running and xdm on the console.
No further documentation exists for this. If you are reasonably familiar
with the System V approach to init and run levels then you shouldn't
have any trouble. If you aren't at all familiar then you have three
choices - ask someone local to you who is, email someone who is (or may
be), or post to the comp.os.linux newsgroup. These are listed in order
of preference!
Note that the filesystem checks may be bypassed by using shutdown -f,
fastboot or fasthalt. These create a file called /fastboot before
shutting the system down. If this exists on booting the system comes
up as quickly as possible.
Note also that the default behaviour is to clean /usr/tmp and /tmp and
to delete existing lock files when the system first goes multiuser.
!!MSG3!!
get_return
cat < < !!MSG4!!
SHUTDOWN AND REBOOT YOUR SYSTEM NOW!
It should come up at run level 3 which is a full multiuser system
with all filesystems checked and mounted and TCP/IP up and running.
!!MSG4!!