144 lines
5.0 KiB
Bash
144 lines
5.0 KiB
Bash
#!/bin/sh
|
|
|
|
yes () { \
|
|
while [ 0 ];do \
|
|
echo -n "Yes (y) or no (n): "; \
|
|
read answer; \
|
|
if [ -z $answer ];then answer="x";fi; \
|
|
if [ $answer = "y" -o $answer = "Y" -o $answer = "yes" ]; \
|
|
then return 0; \
|
|
else if [ $answer = "n" -o $answer = "N" -o $answer = "no" ]; \
|
|
then return 1;fi;fi; \
|
|
done }
|
|
|
|
fixdirs () { \
|
|
owner=$1;group=$2;perms=$3;shift 3; \
|
|
for i in $*;do \
|
|
if [ ! -d ${i} ];then /mnt/bin/rm -rf ${i};/mnt/bin/mkdir ${i};fi; \
|
|
/mnt/bin/chown ${owner} ${i}; \
|
|
/mnt/bin/chgrp ${group} ${i}; \
|
|
/mnt/bin/chmod ${perms} ${i}; \
|
|
done }
|
|
|
|
makeold () { \
|
|
for i in $*;do \
|
|
if [ -f ${i} ]; \
|
|
then /mnt/bin/mv ${i} ${i}.old; \
|
|
else /mnt/bin/rm -rf ${i}; \
|
|
fi; \
|
|
done }
|
|
|
|
/mnt/bin/cat <<EOT1
|
|
|
|
Before you run this script, you should:
|
|
Use fdisk to create a partition to contain the root file system.
|
|
Use mkfs to set up a file system on that partition.
|
|
Mount that partition on /root.
|
|
(Remember that mkfs and mount will not work correctly unless
|
|
you reboot after using fdisk to change the partition table.)
|
|
|
|
If you are updating an existing Linux, mount the root partition
|
|
of the file system on /root.
|
|
If you have other partitions, you should mount them on
|
|
subdirectories of /root; e.g., /root/usr or /root/home.
|
|
|
|
If you have created a swap partition and rebooted, and if you have
|
|
initialised the swap partition with mkswap, you may use the
|
|
swapon command to enable swapping.
|
|
Do you wish to install Linux now? Type 'no' to stop.
|
|
EOT1
|
|
if ! yes;then exit 1;fi
|
|
|
|
/mnt/bin/cat <<EOT3
|
|
|
|
This is your last chance to stop before installing Linux.
|
|
If you continue, you will lose many files currently in the
|
|
following directories under the /root directory:
|
|
bin dev etc home mnt tmp usr
|
|
Do you want to continue installing? Type 'no' to stop.
|
|
EOT3
|
|
if ! yes;then exit 1;fi
|
|
|
|
cd /root
|
|
/mnt/bin/rm -f lib/lib*.so.2 lib/lib*.so.2.2
|
|
echo "I'm working. Please be patient."
|
|
fixdirs bin bin 555 /root bin dev etc etc/lilo home lib mnt usr usr/bin usr/include \
|
|
usr/lib usr/man usr/man/man1 usr/man/man2 usr/man/man3 usr/man/man4 \
|
|
usr/man/man5 usr/man/man6 usr/man/man7 usr/man/man8 usr/man/man9
|
|
fixdirs bin daemon 575 usr/man/cat1 usr/man/cat2 usr/man/cat3 usr/man/cat4 \
|
|
usr/man/cat5 usr/man/cat6 usr/man/cat7 usr/man/cat8 usr/man/cat9
|
|
|
|
/mnt/bin/cat <<EOT3a
|
|
|
|
Do you have a 486 or a maths coprocessor? Answer 'no' if your
|
|
machine is unable to execute floating point instructions.
|
|
EOT3a
|
|
if yes;then /usr/bin/tar xvzfp /mnt/tar.Z.files/hard.tar.Z; \
|
|
else /usr/bin/tar xvzfp /mnt/tar.Z.files/soft.tar.Z; \
|
|
fi
|
|
|
|
fixdirs bin bin 1777 tmp
|
|
fixdirs bin bin 111 mnt
|
|
fixdirs root bin 751 root
|
|
fixdirs user other 711 home/user
|
|
/mnt/bin/sync
|
|
echo "I'm working. Please be patient."
|
|
(cd etc;makeold fdprm fstab group inittab issue magic motd mtools passwd \
|
|
profile rc securetty shells lilo/disktab lilo/install)
|
|
for i in root home/user;do (cd $i;makeold .bashrc .kermrc .mcwd .profile);done
|
|
/mnt/bin/rm -rf lib/libc2.2.2 lib/libm2.2.2
|
|
(cd /etc;/usr/bin/tar cf - group passwd termcap update)|(cd /root/etc;/usr/bin/tar xvfp -)
|
|
(cd /lib;/usr/bin/tar cf - *)|(cd /root/lib;/usr/bin/tar xvfp -)
|
|
(cd /root/dev;/mnt/bin/rm -rf `(cd /dev;/mnt/bin/ls)`)
|
|
(cd /dev;/usr/bin/tar cf - *)|(cd /root/dev;/usr/bin/tar xvfp -)
|
|
/mnt/bin/sync
|
|
(cd /bin;/usr/bin/tar cf - bash doshell mount sh umount)|(cd /root/bin;/usr/bin/tar xvfp -)
|
|
(cd /mnt/bin;/usr/bin/tar cf - *)|(cd /root/bin;/usr/bin/tar xvfp -)
|
|
/root/bin/rm -f /root/bin/install_root
|
|
(cd /usr/bin;/usr/bin/tar cf - *)|(cd /root/usr/bin;/usr/bin/tar xvfp -)
|
|
/root/bin/sync
|
|
for i in bin etc man texts usr
|
|
do /root/usr/bin/tar xvzfp /mnt/tar.Z.files/$i.tar.Z;sync
|
|
done
|
|
echo "I'm working. Please be patient."
|
|
(cd /root/usr/man; \
|
|
/root/bin/ls cat*/*[^Z]|/root/usr/bin/sed -e 's/$/.Z/'|/root/usr/bin/xargs \
|
|
/root/bin/rm -f *1/mtools.1*; compress cat*/*[^Z];/root/bin/chown bin cat*/*; \
|
|
/root/bin/chgrp daemon cat*/*;/root/bin/chmod 664 cat*/*; \
|
|
/root/bin/ln -f cat8/mount.8.Z cat8/umount.8.Z; \
|
|
cd cat1;/root/bin/ln -f [.1.Z test.1.Z;/root/bin/ln -f sh.1.Z bash.1.Z; \
|
|
/root/bin/ln -f zcat.1.Z compress.1.Z;/root/bin/ln -f zcat.1.Z uncompress.1.Z; \
|
|
/root/bin/ln -f decode.1.Z encode.1.Z;/root/bin/ln -f ls.1.Z dir.1.Z; \
|
|
/root/bin/ln -f ls.1.Z vdir.1.Z;/root/bin/ln -f ls.1.Z ll.1.Z; \
|
|
/root/bin/ln -f ls.1.Z lsf.1.Z;/root/bin/ln -f grep.1.Z egrep.1.Z; \
|
|
/root/bin/ln -f vi.1.Z ex.1.Z; /root/bin/ln -f vi.1.Z elvis.1.Z; \
|
|
/root/bin/ln -f virec.1.Z elvrec.1.Z)
|
|
sync
|
|
/root/bin/rm -rf /tmp
|
|
/root/bin/ln -s /root/tmp /tmp
|
|
sync
|
|
|
|
/root/bin/cat <<EOT4
|
|
|
|
|
|
Linux has now been installed. Please type
|
|
|
|
umount /mnt
|
|
hash -r
|
|
|
|
immediately, and then remove the utilities disk.
|
|
|
|
You can now set up a boot disk for your new hard disk root partition.
|
|
Put a formatted high density floppy in drive 0 (A), and:
|
|
|
|
cd /root/etc
|
|
rdev Image /dev/hda3
|
|
replacing ^ with your root device
|
|
cp Image /dev/fd0
|
|
sync
|
|
|
|
Then you can reboot from the floppy. BEFORE YOU REBOOT, please edit
|
|
your configurable files: /etc/fstab must be correct before rebooting.
|
|
The editors joe and vi should now work.
|
|
EOT4
|