#!/bin/bash
# This script comes with absolutely no guarantee. USE AT OWN RISK.
#--------------------------------------------------------------------
# Gentoo 2005.1 INSTALLATION FROM CD SET
#--------------------------------------------------------------------
# Initial Instructions.
# 1). Partition the hard-disk, creating a small swap partition.
# 2). Format the partitions.
# 3). Copy the scripts walkthruX, where X=1,2 and 3, to a floppy disk.
# 4). Enter the BIOS and set the CD-drive as the first boot device.
# 5). Start your computer.
# 6). Mount the floppy drive with the commands:
# mkdir /a
# mount -t vfat /dev/fd0 /a
# 7). Check the scripts are executable and run the first by entering:
# chmod +x /a/walkthru*
# /a/walkthru1
#--------------------------------------------------------------------
# To start this script enter:
# /a/walkthru1
#--------------------------------------------------------------------
n=""
echo -en "\n\033[1;44;31mInstallation of Gentoo 2005.x from the CD set (without internet).\033[m\017
\033[1mNotes.\033[m\017
This script will guide you through the installation of the 2005.1
or 2005.0 editions of Gentoo. It is assumed that you have the
relevant CD sets, but no internet connection.
This script will use the pre-compiled binaries found on the packages
CD. It will get a Gentoo system up and running quickly, so that you
can experiment with a working Gentoo system (and, in particular, its
package manager, portage).
When the script pauses, you should enter the requested information,
or press return, to continue.
\033[1;42mWhat edition of Gentoo do you wish to install?\033[m\017
1 2005.1
0 2005.0
\033[34mEnter 1 or 0 (default is 1): \033[m\017"
read n
case "$n" in
1) edition="2005.1" ;;
0) edition="2005.0" ;;
*) edition="2005.1" ;;
esac
echo -en "\n\033[31mThe edition of Gentoo you wish to install is $edition.\033[m\017\n"
if [[ $edition = "2005.0" ]]
then
echo -e "\nA few small, but necessary files are missing from the 2005 edition.
Download these from a Gentoo mirror, eg, http://gentoo.osuosl.org
(see http://www.gentoo.org/main/en/mirrors.xml for a full list)
and copy them to a floppy.
http://gentoo.osuosl.org/distfiles/hotplug-2004_09_20.tar.gz -- 44 KB
http://gentoo.osuosl.org/distfiles/hotplug-2004_09_23.tar.gz -- 44 KB
http://gentoo.osuosl.org/distfiles/gpm-1.20.1.tar.bz2 -- 552 KB"
fi
echo -en "\n\033[1mSome things you have probably already done.\033[m\017 "
read m
echo -en "\n\033[1m1).\033[m\017 Copy the 3 scripts \033[31mwalkthru1\033[m\017, \033[31mwalkthru2\033[m\017 and \033[31mwalkthru3\033[m\017 to a
floppy disk (along with the missing files if installing 2005.0).
\033[1m2).\033[m\017 Enter the BIOS of your computer and set the CD-drive as the first
boot device. You enter the BIOS by pressing a particular key when the
memory is being checked (while the boot screen page is still visible).
This key is usually the Del key. If the Del key does not work, look
around the boot screen page to try and discover the correct key. It
is usually one of the following:
Del, F1, F2, F3, F10, Ctrl+Alt+Esc, Ctrl+Alt+A, Ctrl+Alt+S, or Esc.
\033[1m3).\033[m\017 Put the Gentoo installation disc into your CD drive. Start your
computer. The CD will take control and present you with a command
prompt, where you can enter commands. "
read m
echo -en "\n\033[1m4).\033[m\017 Once you can enter commands, make the mount point /a, and mount
the floppy drive on it, by entering the commands:
\033[1;46mmkdir /a \033[m\017 (make a directory to mount the floppy on)
\033[1;46mmount -t vfat /dev/fd0 /a \033[m\017 (mount the floppy)
\033[1m5).\033[m\017 Make sure the scripts are executable, and then run the
script \033[31mwalkthru1\033[m\017 by entering the commands:
\033[1;46mchmod +x /a/walkthru* \033[m\017 (make the 3 scripts executable)
\033[1;46m/a/walkthru1 \033[m\017 (start the first script)
Of course, if you are reading this, then you have probably already
done all the things listed above.
\033[31mCommands you must enter (cut & paste) have a\033[m\017 \033[1;46m cyan background \033[m\017
\033[31mCommands that are entered for you, have a\033[m\017 \033[1;45m purple background \033[m\017
\033[1mTake time to read the official documentation.\033[m\017 "
read m
if [[ $edition = "2005.0" ]] ; then official="/mnt/cdrom/docs/handbook/txt/install.txt" ; else official="/mnt/cdrom/docs/txt/install.txt" ; fi
echo -en "\nTo have the official documentation available, as you install, press
Alt+F2. This will take you to the second virtual terminal \033[31m(Alt+F1
gets you back).\033[m\017 At the command prompt enter the command:
\033[1;46mless $official \033[m\017
This will display the official documentation. Read it. Note that
Alt+F3 brings up a third virtual terminal, Alt+F4 a fourth, etc.
\033[31mThe official documentation contains instructions on how to partition
your hard-drive. The instructions use fdisk (cfdisk is better if you
are familiar with it). You need to run fdisk from one of the virtual
terminals (Alt+F3) or, you can exit this script by pressing Ctrl-C,
run fdisk, and then restart the script with /a/walkthru1.\033[m\017
You should create and format at least two partitions on your hard-disk.
One, a smaller partition (about double the size of your RAM), for use
as swap, and another to install Gentoo on. You may also wish to create
a boot partition, but we will not bother with one. If you have a lot of
RAM, then the swap partition is probably not necessary either. It is
recommended that you reboot after having formated your partitions.
I suggest that you format your partitions with the Reiser filesystem
(rather than ext2 or ext3). It is an excellent filesystem. XFS and
JFS may also be fine, but I have no experience with them.
The official documentation is (deliberately) wrong in a few places.
\033[1mThe script now needs to gather various bits of information.\033[m\017 "
read m
echo -en "\nThe installation discs only caters for the more common architectures.
If your architecture is not one of the following, then you can still
install Gentoo 2005.1, but you will need an internet connection.
\033[1;42mWhat type architecture is your system?\033[m\017
1 i686
2 athlon-xp
3 pentium3
4 pentium4
5 x86
\033[34mEnter the corresponding number (no default): \033[m\017"
read n
while [[ $n = "" ]] ; do read n ; done
case "$n" in
1) arch="i686" ;;
2) arch="athlon-xp" ;;
3) arch="pentium3" ;;
4) arch="pentium4" ;;
5) arch="x86" ;;
*) echo -e "\033[1;05;44;31mYou have made a mistake. Please start again.\033[m\017\n"; exit ;;
esac
echo -en "\n\033[31mYour system is $arch.\033[m\017\n
\033[1;42mWhat type is your hard-disk?\033[m\017
1 ide
2 scsi
\033[34mEnter 1 or 2 (no default): \033[m\017"
read n
while [[ $n = "" ]] ; do read n ; done
case "$n" in
1) type="IDE" ;;
2) type="SCSI" ;;
*) echo -e "\033[1;05;44;31mYou have made a mistake. Please start again.\033[m\017\n"; exit ;;
esac
echo -en "\n\033[31mYour hard-disk is $type\033[m\017\n
\033[1;42mIs your hard-disk on the first or second IDE/SCSI controller?\033[m\017
1 first
2 second
\033[34mEnter 1 or 2 (no default): \033[m\017"
read n
while [[ $n = "" ]] ; do read n ; done
case "$n" in
1) order="first" ;;
2) order="second" ;;
*) echo -e "\033[1;05;44;31mYou have made a mistake. Please start again.\033[m\017\n"; exit ;;
esac
echo -en "\n\033[31mYour hard-disk is on the $order $type controller.\033[m\017\n
\033[1;42mIs your hard-disk the master or slave?\033[m\017
1 master
2 slave
\033[34mEnter 1 or 2 (no default): \033[m\017"
read n
while [[ $n = "" ]] ; do read n ; done
case "$n" in
1) ms="master" ;;
2) ms="slave" ;;
*) echo -e "\033[1;05;44;31mYou have made a mistake. Please start again.\033[m\017\n"; exit ;;
esac
if [[ $type = IDE ]]
then
if [[ $order = first ]]
then
if [[ $ms = master ]]
then devname="/dev/hda"
else devname="/dev/hdb"
fi
else
if [[ $ms = master ]]
then devname="/dev/hdc"
else devname="/dev/hdd"
fi
fi
else
if [[ $order = first ]]
then
if [[ $ms = master ]]
then devname="/dev/sda"
else devname="/dev/sdb"
fi
else
if [[ $ms = master ]]
then devname="/dev/sdc"
else devname="/dev/sdd"
fi
fi
fi
echo -en "\n\033[31mYour hard-disk is $devname (the $ms disk on the $order $type controller).\033[m\017\n
\033[1;42mWhat is the number of your swap partition?\033[m\017\n
\033[34mEnter a number (no default): \033[m\017"
read n
while [[ $n = "" ]] ; do read n ; done
swap="$devname$n"
echo -en "\n\033[31mYour swap partition will be $swap.\033[m\017\n
\033[1;42mWhat is the number of your install partition?\033[m\017\n
\033[34mEnter a number (no default): \033[m\017"
read n
while [[ $n = "" ]] ; do read n ; done
install="$devname$n"
[[ $install = $swap ]] && echo -e "\033[1;05;44;31mYour swap and install partitions cannot be the same. Please start again.\033[m\017\n" && exit
echo -en "\n\033[31mYour install partition will be $install.\033[m\017\n
\033[1;42mWhat is the filesystem type of the install partition?\033[m\017
1 Reiser
2 Ext2
3 Ext3
4 JFS
5 XFS
\033[34mEnter the corresponding number (no default): \033[m\017"
read n
while [[ $n = "" ]] ; do read n ; done
case "$n" in
1) fsname="Reiser"; fstype="reiserfs" ;;
2) fsname="Ext2" ; fstype="ext2" ;;
3) fsname="Ext3" ; fstype="ext3" ;;
4) fsname="JFS" ; fstype="jfs" ;;
5) fsname="XFS" ; fstype="xfs" ;;
*) echo -e "\033[1;05;44;31mYou have made a mistake. Please start again.\033[m\017\n"; exit ;;
esac
echo -en "\n\033[31mYour install partition $install is formatted with the $fsname filesystem.\033[m\017\n
\033[34mThe script now has enough information to begin.\033[m\017
\033[31mYour system is $arch.
Your swap partition will be $swap.
You will be installing Gentoo $edition to $install and
$install has been formatted with the $fsname filesystem.\033[m\017
\033[34mSo that you can see what is happening each command will be
output to the terminal as it is executed.\033[m\017
\033[1mTo begin, press return:\033[m\017 "
read m
echo -e "\n\033[1;45mmount -t $fstype $install /mnt/gentoo \033[m\017"
#mount -t $fstype $install /mnt/gentoo
echo -e "\033[1;45mtar -xjpf /mnt/cdrom/stages/stage3-$arch-$edition.tar.bz2 -C /mnt/gentoo/ \033[m\017"
#tar -xjpf /mnt/cdrom/stages/stage3-i686-$edition.tar.bz2 -C /mnt/gentoo/
echo -e "\033[1;45mtar -xjpf /mnt/cdrom/snapshot*/portage*.tar.bz2 -C /mnt/gentoo/usr/ \033[m\017"
#tar -xjpf /mnt/cdrom/snapshot*/portage*.tar.bz2 -C /mnt/gentoo/usr/
echo -e "\033[1;45mmkdir /mnt/gentoo/usr/portage/distfiles \033[m\017"
#mkdir /mnt/gentoo/usr/portage/distfiles
echo -e "\033[1;45mcp -r /mnt/cdrom/distfiles/* /mnt/gentoo/usr/portage/distfiles/ \033[m\017"
#cp -r /mnt/cdrom/distfiles/* /mnt/gentoo/usr/portage/distfiles/
echo -e "\033[1;45mmount -t proc none /mnt/gentoo/proc \033[m\017"
#mount -t proc none /mnt/gentoo/proc
if [[ $edition = "2005.0" ]]
then
echo -e "\033[31m\nBefore continuing we must copy across missing files:\033[m\017\n"
echo -e "\033[1;45mcp /a/hotplug-2004_09_2*.tar.gz /mnt/gentoo/usr/portage/distfiles/ \033[m\017 (necessary)"
echo -e "\033[1;45mcp /a/gpm-1.20.1.tar.bz2 /mnt/gentoo/usr/portage/distfiles/\033[m\017 (recommended)"
#cp /a/gpm-1.20.1.tar.bz2 /mnt/gentoo/usr/portage/distfiles/
#cp /a/hotplug-2004_09_2*.tar.gz /mnt/gentoo/usr/portage/distfiles/
[[ ! $? ]] && echo -en "\n\033[1;44;31mYou should obtain these files before running the walkthru2.\033[m\017"
fi
echo -en "\n\033[1;42mGetting a kernel for your system. \033[m\017 "
read m
echo -en "\nWe will now copy the kernel from the CD. This is for safety. Later you
will have the option to roll your own kernel. If you roll your own, you
will then have two kernels from which to boot. If your experiment in
creating your own kernel does not work out so well, you will still be
able to boot with the CD-kernel.
\033[31mNote, that if you have formatted your partition with the JFS filesystem,
the CD-kernel (and genkernel) will not boot.\033[m\017
The CD-kernel is large and therefore a little slower, but will boot and
run your system, just fine. It also often loads many unnecessary modules
which slows it down a little further.
Your own kernel will be leaner and meaner, but it takes some knowlegde
of your system to choose all the drivers and features you desire.
You will often have to roll your own kernel if you wish to include non
standard features, eg, squash or cloop filesystem support.
It is not easy to configure a kernel (mainly because you will not be
familiar with all the configuration options) so you should try and
roll your own kernel while you have the safety of the CD-kernel.
\033[31mThe following commands will install the CD-kernel.\033[m\017 "
read n
echo -e "\n\033[1;45mmkdir /mnt/gentoo/lib/modules/ \033[m\017"
#mkdir /mnt/gentoo/lib/modules/
echo -e "\033[1;45mcp -r /mnt/livecd/lib/modules/`uname -r` /mnt/gentoo/lib/modules/ \033[m\017"
#cp -r /mnt/livecd/lib/modules/`uname -r` /mnt/gentoo/lib/modules/
echo -e "\033[1;45mcp /mnt/cdrom/isolinux/{gentoo,gentoo.igz} /mnt/gentoo/boot \033[m\017"
#cp /mnt/cdrom/isolinux/{gentoo,gentoo.igz} /mnt/gentoo/boot
echo -e "\nThe kernel modules loaded at boot are in the file gentoo.igz. Although
the command \033[31mcat gentoo.igz | gunzip | cpio -tv\033[m\017 should list the entire
archives contents, it only lists the main directories and some block
devices. So all the modules have been hidden (the boot message claims
the modules are loaded). This may have been acheived by rewriting the
archiving program cpio, so that choosen files can be hidden. Perhaps,
Gentoo is not really all about helping people learn Linux, after all.
At this point we will change the directory that /bin/bash considers the
root directory. Clearly this cannot be done from a script like this one
which is run by /bin/bash. So we will have to exit the script, and start
another after changing the root directory.
In order to change the root directory to what will be the root of your
Gentoo system, cut and paste the following command:
\033[1;46mchroot /mnt/gentoo /bin/bash \033[m\017
then start the next script by entering (again by cutting and pasting):
\033[1;46mmkdir /a \033[m\017
\033[1;46mmount -t vfat /dev/fd0 /a \033[m\017
\033[1;46m/a/walkthru2 swap=$swap install=$install filesystem=$fstype edition=$edition \033[m\017\n"
#!/bin/bash
# This script comes with absolutely no guarantee. USE AT OWN RISK.
#--------------------------------------------------------------------
# Gentoo 2005.1 INSTALLATION FROM CD SET
#--------------------------------------------------------------------
# Initial Instructions.
# 1). Partition the hard-drive, creating a small swap partition.
# 2). Format the partitions.
# 3). Copy the scripts walkthru1 and walkthru2 to a floppy disk.
# 4). Enter the BIOS and set the CD-drive as the first boot device.
# 5). Start your computer.
# 6). Mount the floppy drive with the commands:
# mkdir /a
# mount -t vfat /dev/fd0 /a
# 7). Check the scripts are executable and run the first by entering:
# chmod +x /a/walkthru*
# /a/walkthru1
#--------------------------------------------------------------------
# To start this script enter something like:
# /a/walkthru2 swap=/dev/hda1 install=/dev/hda2 filesystem=reiserfs edition=2005
#--------------------------------------------------------------------
#echo -e "\033[1;45m \033[m\017 ()"
k=0
l=0
n=""
i=${swap##*[a-z]}
j=${install##*[a-z]}
k=${install%%[0-9]*}
l=${#k}
a=$(($j-1))
b=${install:$(($l-1)):1}
case "$b" in
a) c="0" ;;
b) c="1" ;;
c) c="2" ;;
d) c="3" ;;
*) c="" ;;
esac
[[ $c = "" ]] && echo -e "\n\033[1;44;31mThe command entered is incorrect. Please start again.\033[m\017\n" && exit
case "$fstype" in
reiserfs) fstab=" notail 1 1" ;;
ext2|ext3) fstab=" defaults 1 1" ;;
xfs|jfs) fstab=" defaults 1 1" ;;
esac
echo -e "\n\033[1;44;31mInstallation of Gentoo $edition from the CD set (continued).\033[m\017\n"
echo -e "\033[1;45menv-update \033[m\017 (update environment)"
#env-update
echo -e "\033[1;45msource /etc/profile \033[m\017 (adopt new profile)"
#source /etc/profile
echo -en "\n\033[1;42mDo you wish to roll your own kernel? \033[m\017
y = yes
n = no
\033[34mEnter y or n (default is y): \033[m\017"
read n
aname=`uname -r | awk '{print gensub(/-.*/,"","g")}'`
bname="$aname-custom"
cname="$aname-gk"
if [[ $n != "n" ]]
then
ownkernel="\ntitle=MyCustomKernel-$aname Gentoo $edition
kernel (hd$c,$a)/boot/kernel-$bname root=$install"
echo -en "\nGo to another virtual terminal (Alt+F3) and enter the command
\033[1;46mlspci \033[m\017
The command lspci lists vendor and model information about each of your
PCI and AGP cards. You can refer to this information as you configure
your kernel. You should compile all the drivers that are vital to your
system, or you will use regularly, into your kernel (not as modules).
The drivers you complile as modules will have to be loaded by hand using
the command modprobe (when you need them). "
read m
echo -e "\n\033[1;45memerge gentoo-sources \033[m\017 (unpack kernel sources)"
#emerge gentoo-sources &> /dev/null
echo -e "\033[1;45mcd /usr/src/linux \033[m\017 (move to kernel sources)"
#cd /usr/src/linux
echo -e "\nWe now backup the main makefile and edit it to give the kernel a unique
'uname -r' tag (so the system knows when this kernel is running)."
echo -e "\n\033[1;45mcp Makefile OldMakefile \033[m\017 (backup the main makefile)"
#cp Makefile OldMakefile
echo -e "\033[1;45mawk '{print gensub(/^EXTRAVERSION.*/,\"EXTRAVERSION = -custom\",\"g\")}' OldMakefile > Makefile\033[m\017"
#awk '{print gensub(/^[[:space:]]*EXTRAVERSION[[:space:]]*=.*/,"EXTRAVERSION = -custom","g")}' OldMakefile > Makefile
echo -e "\nNow glance over the options for make (press q to quit the program less))"
echo -en "\n\033[1;45mmake help | less \033[m\017 "
read m
#make help | less
echo -e "\033[1;45mmake menuconfig \033[m\017 (configure the kernel)"
#make menuconfig
echo -e "\033[1;45mmake all \033[m\017 (compile the kernel and modules)"
#make all
echo -e "\033[1;45mmake modules_install \033[m\017 (install the modules)"
#make modules_install
echo -e "\033[1;45mcp arch/i386/boot/bzImage /boot/kernel-$bname \033[m\017 (install the kernel)"
#cp arch/i386/boot/bzImage /boot/kernel-$bname
echo -e "\033[1;45mcp .config /boot/config-$bname \033[m\017 (save your configuration)"
#cp .config /boot/config-$bname
echo -e "\033[1;45mcd / \033[m\017 (return to the root directory)"
fi
echo -e "\n\033[31mYou can also use the program genkernel to build a kernel. This seems
to just replicate the CD kernel. It is not clear what you gain from
genkernel (if anything). However, it cannot hurt. Be warned, it takes
a long time to compile all the modules.\033[m\017"
echo -en "\n\033[1;42mDo you wish to build a kernel using genkernel? \033[m\017
\n\033[34mEnter y or n (default is n): \033[m\017"
read n
if [[ $n == "y" ]]
then
if [[ $edition = "2005.0" ]] ; then genk="kernel-"; geni="initrd-" ; else genk="kernel-genkernel-x86-"; geni="initramfs-genkernel-x86-" ; fi
genkernel="\n\ntitle=GenKernel-$aname Gentoo $edition.
kernel (hd$c,$a)/boot/$genk$cname root=/dev/ram0 real_root=$install
initrd (hd$c,$a)/boot/$geni$cname"
echo -e "\n\033[1;45mawk '{print gensub(/^EXTRAVERSION.*/,\"EXTRAVERSION = -gk\",\"g\")}' OldMakefile > Makefile\033[m\017"
#awk '{print gensub(/^[[:space:]]*EXTRAVERSION[[:space:]]*=.*/,"EXTRAVERSION = -gk","g")}' OldMakefile > Makefile
echo -e "\033[1;45memerge genkernel \033[m\017 (unpack and compile genkernel)"
#emerge genkernel &> /dev/null
echo -e "\033[1;45mgenkernel --mrproper all \033[m\017 (use genkernel to compile and install kernel & modules)"
#genkernel --mrproper all
fi
echo -e "\n\033[31mWe now add some needed programs.\033[m\017"
case "$fstype" in
reiserfs) fsname="Reiser"; fsprogs="reiserfsprogs" ;;
jfs) fsname="JFS" ; fsprogs="jfsutils" ;;
xfs) fsname="XFS" ; fsprogs="xfsprogs" ;;
*) read m ;;
esac
if [[ $fstype != "ext2" ]] && [[ $fstype != "ext3" ]]
then
echo -e "\n\033[1;45memerge $fsprogs \033[m\017 (unpack and compile tools for $fsname filesystem)"
#emerge $fsprogs &> /dev/null
fi
echo -e "\033[1;45memerge coldplug \033[m\017 (unpack and compile coldplug which starts stuff at boot)"
#emerge coldplug &> /dev/null
echo -e "\033[1;45mrc-update add coldplug boot \033[m\017 (tell system to start this at early boot)"
#rc-update add coldplug boot
echo -e "\033[1;45memerge syslog-ng \033[m\017 (unpack and compile system logger)"
#emerge syslog-ng &> /dev/null
echo -e "\033[1;45mrc-update add syslog-ng default \033[m\017 (tell system to start this at boot)"
#rc-update add syslog-ng default
echo -e "\033[1;45memerge vixie-cron \033[m\017 (unpack and compile vixie-cron)"
#emerge vixie-cron &> /dev/null
echo -e "\033[1;45mrc-update add vixie-cron default \033[m\017 (tell system to start this at boot)"
#rc-update add vixie-cron default
echo -en "\n\033[31mWe will now adjust some configuration files:\033[m\017 "
read m
if [[ $edition = "2005.0" ]] ; then extra="/etc/profile" ; else extra="/etc/bash/bashrc" ; fi
echo -en "\n\033[1;45mcp $extra $extra.old \033[m\017 (save old ${extra##*/} file)"
#mv $extra $extra.old
#awk '{print gensub(/\\W/,"\\\\w","g")}' $extra.old > $extra
echo "
alias r='less'
alias m='more'
alias ls='ls --color'
alias ll='ls -l'
alias lsd='ls -d \`ls -aF|g /\`'
alias n='ls -stl|head -n 40'
alias reboot='shutdown -r now'
alias bye='shutdown -h now'
alias e='emacs'
alias ..='cd ..'
alias ...='cd ../../'
alias ....='cd ../../../'
alias rm='rm -i'
alias mv='mv -i'
alias cp='cp -i'
alias g='grep -E'
" | tee -a messages.txt #$extra
echo -en "\033[31mWe will now add the above handy aliases to the file $extra.\033[m\017 "
read m
echo -e "\n\033[1;45mcp /etc/fstab /etc/fstab.old \033[m\017 (save old filesystem table)"
#mv /etc/fstab /etc/fstab.old
cdrom=`awk '{if(/drive name/){print $NF}}' /proc/sys/dev/cdrom/info`
[[ $cdrom = "" ]] && cdrom="cdrom"
echo -n "
# filesystem mount-dir fs-type options dump fsck-order
$swap swap swap defaults 0 0
$install / $fstype$fstab
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
/dev/fd0 /a vfat user,noauto 0 0
/dev/$cdrom /cd iso9660 user,noauto,ro,exec 0 0
" | tee messages.txt #/etc/fstab
echo -en "\n\033[31mWe will now write the above filesystem table to /etc/fstab.\033[m\017 "
read m
echo -en "\n\033[34mEnter a host name for your system (default is myhostname):\033[m\017 "
read n
[[ -z $n ]] && n="myhostname"
hostname="$n"
echo -e "\n\033[31mYour system is called $n.\033[m\017"
if [[ $edition = "2005.0" ]] ; then hostfile="/etc/hostname" hinfo="$n" ; else hostfile="/etc/conf.d/hostname" hinfo="HOSTNAME=$n" ; fi
echo -e "\n\033[1;45mmv $hostfile $hostfile.old \033[m\017 (save old configuration)"
#mv $hostfile $hostfile.old
echo -e "
$hinfo
" | tee messages.txt #$hostfile
echo -en "\033[31mWe will now write the above hostname configuration:\033[m\017 "
read m
echo -en "\n\033[34mEnter a domain name for your system (default is mydomainname): \033[m\017"
read n
[[ -z $n ]] && n="mydomainname"
domainname="$n"
echo -e "\n\033[31mYour domain is called $n.\033[m\017\n"
if [[ $edition = "2005.0" ]] ; then domainfile="/etc/dnsdomainname" dinfo="$n" ; else domainfile="/etc/conf.d/domainname" dinfo="DNSDOMAIN=$n\n#NISDOMAIN=mynisdomainname" ; fi
echo -e "\033[1;45mcp $domainfile $domainfile.old \033[m\017 (save old configuration)"
#mv $domainfile $domainfile.old 2> /dev/null
echo -e "
$dinfo
" | tee messages.txt #$domainfile
echo -en "\033[31mWe will now write the above domain name configuration:\033[m\017 "
read m
echo -e "\n\033[1;45mcp /etc/hosts /etc/hosts.old \033[m\017 (save old configuration)"
#mv /etc/hosts /etc/hosts.old
echo "
127.0.0.1 $hostname.$domainname $hostname localhost
# IPV6 versions of localhost and co
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
" | tee messages.txt #/etc/hosts
echo -en "\033[31mWe will now write the above local dns configuration:\033[m\017 "
read m
echo -e "\n\033[31mChoose a timezone from the following list. Some selections
will require a further choice (the default timezone is UTC):\033[m\017"
ls -F /usr/share/zoneinfo/
echo -en "\033[34mEnter your timezone: \033[m\017"
read n
[[ -z $n ]] && n="UTC"
[[ -d /usr/share/zoneinfo/$n ]] && echo -e "\n\033[31mChoose a refinement\033[m\017" && ls /usr/share/zoneinfo/$n && echo -en "\033[34mEnter your choosen refinement: \033[m\017" && n=${n%\/}"/" && read o
echo -e "\n\033[31mYour timezone is $n$o:\033[m\017"
echo -e "\n\033[1;45mln -sf /usr/share/zoneinfo/$n$o /etc/localtime \033[m\017"
echo -en "\n\033[31mWe will now configure your timezone as shown above.\033[m\017 "
#ln -sf /usr/share/zoneinfo/$n$o /etc/localtime
read m
echo -e "\n\033[31mAfter rebooting you need the console mouse, so we configure it.\033[m\017"
echo -e "\n\033[1;45mcp /etc/conf.d/gpm /etc/conf.d/gpm.old \033[m\017 (save old mouse config)"
#mv /etc/conf.d/gpm /etc/conf.d/gpm.old
echo -e "\n\033[31mChoose the protocol your console mouse uses (default is imps2):\033[m\017
imps2 ps2 genitizer gunze logi logim mm ms3 ms+ ms+lr msc mtouch ncr
netmouse pnp sun summa syn synps2 twid vsxxxaa wacom wp"
echo -en "\033[34mEnter your console mouse driver protocol: \033[m\017"
read n
[[ -z $n ]] && n="imps2"
echo -e "\n\033[31mEnter the device name for your mouse (default is /dev/input/mice).\033[m\017"
ls /dev/*/*mouse* /dev/*/mice* /dev/*psaux* /dev/*mice* /dev/*mous* 2> /dev/null
echo -en "\033[34mEnter the device name of your mouse: \033[m\017"
read o
[[ -z $o ]] && o="/dev/input/mice"
echo "
MOUSE=$n
MOUSEDEV=$o
" | tee messages.txt #/etc/conf.d/gpm
echo -en "\033[31mWe will now write the above mouse configuration:\033[m\017 "
read m
echo -e "\n\033[1;45mrc-update add gpm default \033[m\017 (tell system to start console mouse at boot)"
#rc-update add gpm default
echo -e "\033[1;45memerge grub \033[m\017 (unpack and compile the boot manager grub)"
#emerge grub &> /dev/null
if [[ -f /boot/grub/grub.conf ]]
then
echo -e "\033[1;45mcp /boot/grub/grub.conf /boot/grub/grub.conf.old \033[m\017 (save old grub config)"
#mv /boot/grub/grub.conf /boot/grub/grub.conf.old
fi
if [[ $edition = "2005.0" ]] ; then cdroot="root" ; else cdroot="root=/dev/ram0 real_root" ; fi
echo -e "
default 0
timeout 10
splashimage=(hd$c,$a)/boot/grub/splash.xpm.gz
title=InstallationCDKernel Gentoo $edition
kernel (hd$c,$a)/boot/gentoo $cdroot=$install
initrd (hd$c,$a)/boot/gentoo.igz
$ownkernel$genkernel
" | tee messages.txt #/boot/grub/grub.conf
echo -en "\033[31mWe will now write the above grub boot configuration:\033[m\017 "
read m
echo -e "\n\033[31mDo you want to load the boot manager to the Master Boot Record?\033[m\017"
echo -en "\033[34mEnter y or n (the default is y): \033[m\017"
read n
if [[ $n != "n" ]]
then
echo -e "\n\033[31mTo do this you need to enter the following at the grub prompt:
(write them down as they will dissappear when you need them).\033[m\017\n"
echo -e "grub>\033[1;46m root (hd$c,$a) \033[m\017(specify your /boot partition, (hd0,1)=/dev/hda2, etc)
grub>\033[1;46m setup (hd$c) \033[m\017 (install GRUB to the MBR, (hd0)=/dev/hda, etc)
grub>\033[1;46m quit \033[m\017 (exit the GRUB shell)\n"
echo -en "\033[1;45mgrub \033[m\017 "
read m
#grub
fi
echo -e "\n\033[31mWe will now set the root password (if you do not do this, you will
not be able to log in, after rebooting):\033[m\017\n"
echo -en "\033[1;45mpasswd \033[m\017 "
read m
#passwd
echo -e "\n\033[31mFor regular use, it is best to create a less privileged user than root.
You do this by choosing a regular username and adding an account.\033[m\017"
echo -en "\033[34mEnter a username (the default is myusername): \033[m\017"
read n
[[ -z $n ]] && n="myusername"
echo -e "\n\033[1;45museradd -G users,wheel,audio -m $n \033[m\017"
#useradd -G users,wheel,audio -m $n
echo -en "\n\033[31mWe enter the above command to create the users account.\033[m\017 "
read m
echo -e "\nThe -m creates a full home directory /home/$n for $n.
The -G wheel entry allows $n to use the su command.
\n\033[31mWe now set $n's password:\033[m\017\n"
echo -en "\033[1;45mpasswd $n \033[m\017 "
read m
#passwd $n
echo -e "\n\033[31mAfter the script finishes, you must exit the chroot environment and
reboot. Don't forget to remove the install-CD. You must remove it
after the system has shutdown and before it reboots. If you forget,
the CD will be booted again instead of your new Gentoo system.
On rebooting, you will have the choice of 1,2 or 3 different kernels
to boot from. Choose one, and see how things worked out. After the
system has rebooted put the Gentoo Packages CD in the CD drive, mount
the floppy on /a, as usual, and run /a/walkthru3.\033[m\017"
echo -e "\n\033[1;46mexit \033[m\017 (exit the chroot environment)"
echo -e "\033[1;46mreboot \033[m\017\n"
#!/bin/bash
# This script comes with absolutely no guarantee. USE AT OWN RISK.
#--------------------------------------------------------------------
# Gentoo 2005.1 INSTALLATION FROM CD SET
#--------------------------------------------------------------------
# Initial Instructions.
# 1). Partition the hard-drive, creating a small swap partition.
# 2). Format the partitions.
# 3). Copy the scripts walkthru1 and walkthru2 to a floppy disk.
# 4). Enter the BIOS and set the CD-drive as the first boot device.
# 5). Start your computer.
# 6). Mount the floppy drive with the commands:
# mkdir /a
# mount -t vfat /dev/fd0 /a
# 7). Check the scripts are executable and run the first by entering:
# chmod +x /a/walkthru*
# /a/walkthru1
#--------------------------------------------------------------------
# To start this script enter:
# /a/walkthru3
#--------------------------------------------------------------------
echo -en "\n\033[1;44;31mInstallation of Gentoo 2005.x from the CD set (continued).\033[m\017
Initially, after \033[31memerge --usepkg kde\033[m\017 led to all sorts of problems,
I thought that Gentoo 2005.1 did not support KDE. It does. It seems
the new command is \033[31memerge --usepkg kde-meta.\033[m\017 Who would guess that!?!?
Gentoo didn't bother to tell anyone about the change until it was made
public on their forums (after which they added the command to their
KDE page, but not to their installation instructions (as yet)).
The forum admins deleted this information by moving it to some hidden
corner of their site (with the excuse that it had been dealt with in
some other deliberately hidden away post). The forum still has this
information \"safely\" hidden from public view.
\033[1;42mWhat edition of Gentoo do you wish to install?\033[m\017
1 2005.1
0 2005.0
\033[34mEnter 1 or 0 (default is 1): \033[m\017"
read n
case "$n" in
1) edition="2005.1" ;;
0) edition="2005.0" ;;
*) edition="2005.1" ;;
esac
echo -en "\n\033[1;42mHave you put the Gentoo package CD in the CD-drive? \033[m\017 "
read m
echo -e "\n\n\033[1;45mmkdir /cd \033[m\017"
#mkdir /cd
echo -e "\033[1;45mmount /cd \033[m\017"
#mount /cd
echo -e "\033[1;45mexport PKGDIR=/cd/ \033[m\017"
#export PKGDIR=/cd/
if [[ $edition = "2005.0" ]] ; then kde="kde" ; else kde="kde-meta" ; fi
echo -e "\033[1;45memerge --usepkg $kde \033[m\017"
#emerge --usepkg $kde
echo -e "\033[1;45memerge --usepkg gnome \033[m\017"
#emerge --usepkg gnome
echo -e "\033[1;45memerge --usepkg xfce4 \033[m\017"
#emerge --usepkg xfce4
echo -e "\n\033[1;46memerge --usepkg openoffice-bin \033[m\017"
echo -e "\033[1;46memerge --usepkg emacs \033[m\017"
echo -e "\033[1;46memerge --usepkg vim \033[m\017"
echo -en "\nIf you want any of the above programs (open office, emacs or vi) go to a
virtual terminal (Alt+F2), log in, and enter the command(s) corresponding
to your choice. "
read m
echo -en "\n\033[31mNow you have to setup your graphics card.\033[m\017 If you have a working xorg.conf
file from another linux installation (on the same physical hardware), you
should be able to copy it to /etc/X11/xorg.conf and it should work. You
may have to tweak it a little. Whatever you do, do it with care, as it is
possible to total your graphics card, and/or monitor.
If you do not have a working xorg.conf file, you can find out what sort
of graphics card/chipset you have by entering
\033[1;46mlspci \033[m\017
and looking for the VGA entry. The command lspci lists vendor and
model information about all your PCI and AGP cards. "
read m
echo -en "\nFor more on setting up graphics, see;
http://www.gentoo.org/doc/en/xorg-config.xml
There are various tools to help you setup your graphics configuration,
for example, \033[31mXorg -configure\033[m\017 or \033[31mxorgconfig\033[m\017 or \033[31mxorgcfg\033[m\017. Since I have
little experience with these, I will leave you to read the docs.
Once you have your xorg.conf file configured, you can start xfce4 with
\033[34mstartxfce4 \033[m\017
Starting gnome is a bit harder. For Gentoo 2005.0 you need to add the line
\033[34mexec gnome-system\033[m\017
to the file ~/.xinitrc (in your home directory (I believe you need to
create this file)) and then enter the command
\033[34mstartx\033[m\017
However, this does not work for Gentoo 2005.1. Thanks a lot, Gentoo.
To start KDE, comment out/remove the line \033[34mexec gnome-system,\033[m\017 and write
\033[34mexec startkde\033[m\017 for Gentoo 2005.0 or
\033[34mexec /usr/kde/3.4/bin/startkde\033[m\017 for Gentoo 2005.1,
to the ~/.xinitrc file and then enter the command
\033[34mstartx\033[m\017.
However, you can forget about editing these files if you use
the Gnome display manager. "
read m
echo -e "\nThe Gnome display manager will start a graphical desktop for you at boot.
It has already been installed and only needs to be configured. There will
be a menu from which you can choose among the already installed desktops
The Gnome display manager could have been simply set as the default.
However, a totally non-functional display manager will be started
unless you make the following change (if you ever get stuck with this
display manager) press Ctrl+Alt+F2 to get to a virtual terminal.\n"
echo -e "\033[1;45mmv /etc/rc.conf /etc/rc.conf.old \033[m\017"
#mv /etc/rc.conf /etc/rc.conf.old
echo -e "\033[1;45mawk '{print gensub(/[# ]*DISPLAYMANAGER=.*$/,\"DISPLAYMANAGER=gdm\",\"g\")}' /etc/rc.conf.old > /etc/rc.conf \033[m\017"
#awk '{print gensub(/[# ]*DISPLAYMANAGER=.*$/,"DISPLAYMANAGER=gdm","g")}' /etc/rc.conf.old > /etc/rc.conf
echo -e "\n\033[31mDo not configure the Gnome display manager to start at boot until you
have a working xorg.conf file.\033[m\017"
echo -en "\n\033[1;42mDo you wish to start the Gnome display manager at boot? \033[m\017
y = yes
n = no
\033[34mEnter y or n (default is n): \033[m\017"
read n
if [[ $n = "y" ]]
then
echo -e "\n\033[1;45mrc-update add xdm default \033[m\017"
#rc-update add xdm default
else
echo -e "\nWhen you have a working xorg.conf file you can configure the Gnome
display manager to start at boot with the command:"
echo -e "\n\033[1;46mrc-update add xdm default \033[m\017"
fi
echo -e "\n\033[1;44;31mAnd that's it. I hope it all went well.\033[m\017\n"