Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Installing Gentoo - Scripts
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Gotterdammerung
l33t
l33t


Joined: 11 Feb 2004
Posts: 627
Location: Rio de Janeiro, Brazil

PostPosted: Wed Jun 21, 2006 3:19 pm    Post subject: Installing Gentoo - Scripts Reply with quote

Hi, there. I know that with Gentoo LiveCD installing Gentoo is a lot easier, but I prefer the old way. So, I have created a "little" installation process so one can have a working system with little trouble. It is divided in 3 parts: Mounting, Installing and Aditional software.

The first part only mounts the disks where you wish to install Gentoo. The second one installs a base system with X and openbox. The third part completes the install process emerging Gnome and other useful applications. The third part can be executed right after the second one.

This process is not all interactive, that's why I'm printing it down so you can comment and help me improve it.

Regards!

Mounting
Code:

#---------------------------------------------------
# PRE-INSTALL
#---------------------------------------------------

cfdisk /dev/hda

mount -o rw /dev/hda2 /mnt/hda2

cd /mnt/hda2
wget -c -t 100 http://distro.ibiblio.org/pub/linux/distributions/gentoo/releases/x86/2006.0/stages/stage3-i686-2006.0.tar.bz2
tar -xjf stage3-i686-2006.0.tar.bz2

cd /

mount -o rw /dev/hda3 /mnt/hda2/home
mount -o bind /dev /mnt/hda2/dev
mount -o bind /proc /mnt/hda2/proc
chroot /mnt/hda2 /bin/bash


Installing
Code:

#---------------------------------------------------
# INITIAL SETUP
#---------------------------------------------------

echo 'USE="3dnow a52 aac asf bash-completion dbus directfb dv dvb dvd dvdr fbcon ffmpeg firefox flac gstreamer hal javascript jikes kdeenablefinal kdexdeltas mmx mpeg mozsvg nsplugin ogg oggvorbis opengl png quickreal rtc speex sse svg symlink theora userlocales v4l vcd vim-with-x vorbis win32codecs wma X xine xprint xv xvid xvmc -arts -esd -eds -fortran -ipv6 -kde -nowebdav -xmms"' >> /etc/make.conf

echo "Adding FEATURES and CCACHE constants to make.conf."
echo 'FEATURES="parallel-fetch ccache"' >> /etc/make.conf
echo 'CCACHE_DIR="/var/tmp/ccache/"' >> /etc/make.conf
echo 'CCACHE_SIZE="2G"' >> /etc/make.conf
echo 'LANG="pt_BR"' >> /etc/make.conf
echo 'LC_ALL="pt_BR"' >> /etc/make.conf
echo 'LINGUAS="pt_BR"' >> /etc/make.conf

rm -f /etc/localtime
ln -sf /usr/share/zoneinfo/Brazil/East /etc/localtime
nano -w /etc/locales.build
grep '^[^#].*' /etc/locales.build | sed 's:/: :' > /etc/locales.gen

nano -w /etc/rc.conf
nano -w /etc/conf.d/rc
nano -w /etc/conf.d/keymaps
nano -w /etc/conf.d/clock

#---------------------------------------------------
# NETWORK
#---------------------------------------------------

echo 'modules=( "ifconfig" "dhcp" )' >> /etc/conf.d/net
echo 'config_eth0=( "192.168.254.1 netmask 255.255.255.0" )' >> /etc/conf.d/net
echo 'routes_eth0=( "default gw 192.168.254.254" )' >> /etc/conf.d/net
echo 8139too >> /etc/modules.autoload.d/kernel-2.6
mkdir -p /etc/hotplug.d
echo 8139cp >> /etc/hotplug.d/blacklist
echo nameserver 192.168.254.254 > /etc/resolv.conf
modprobe -r 8139cp
modprobe 8139too
ifconfig eth0 up
/etc/init.d/net.eth0 restart

#---------------------------------------------------
# PORTAGE & PORTAGE SNAPSHOT
#---------------------------------------------------

cd /usr
wget -t 100 -c http://distro.ibiblio.org/pub/linux/distributions/gentoo/snapshots/portage-latest.tar.bz2
tar -xjf portage-latest.tar.bz2

rm /etc/make.profile
ln -s ../usr/portage/profiles/default-linux/x86/2006.0 /etc/make.profile

mkdir -p /etc/portage
echo "dev-java/sun-jdk" >> /etc/portage/package.unmask
echo "dev-java/sun-jre-bin" >> /etc/portage/package.unmask
echo "dev-java/sun-jdk ~x86" >> /etc/portage/package.keywords
echo "dev-java/sun-jre-bin ~x86" >> /etc/portage/package.keywords
echo "net-p2p/azureus-bin ~x86" >> /etc/portage/package.keywords
echo "sys-kernel/ck-sources ~x86" >> /etc/portage/package.keywords
echo "app-portage/deltup ~x86" >> /etc/portage/package.keywords
echo "dev-util/bdelta ~x86" >> /etc/portage/package.keywords
echo "app-portage/getdelta ~x86" >> /etc/portage/package.keywords

#---------------------------------------------------
# MIRRORSELECT
#---------------------------------------------------

emerge mirrorselect
mirrorselect -i -o >> /etc/make.conf
mirrorselect -i -r -o >> /etc/make.conf
echo 'MAKEOPTS="-j2"' >> /etc/make.conf

#---------------------------------------------------
# CCACHE
#---------------------------------------------------

emerge ccache
echo 'PATH="/usr/lib/ccache/bin:/opt/bin"' >> /etc/env.d/00basic
nano -w /etc/env.d/00basic

#---------------------------------------------------
# UPDATING CURRENT SYSTEM
#---------------------------------------------------

env-update && source /etc/profile

emerge -uDNf world
emerge -uDNq world
revdep-rebuild && env-update && source /etc/profile && etc-update

#---------------------------------------------------
# INSTALLING BASE SYSTEM WITH X
#---------------------------------------------------

emerge -f libtool syslog-ng vixie-cron dbus hal xfsprogs reiserfsprogs grub genkernel ck-sources genlop esearch gentoolkit coldplug hotplug bash-completion app-admin/sudo links openbox vim
emerge -q libtool syslog-ng vixie-cron dbus hal xfsprogs reiserfsprogs grub genkernel ck-sources genlop esearch gentoolkit coldplug hotplug bash-completion app-admin/sudo links openbox vim

#---------------------------------------------------
# RUNLEVELS
#---------------------------------------------------

rc-update add net.eth0 default
rc-update add syslog-ng default
rc-update add vixie-cron default
rc-update add coldplug boot
rc-update add hotplug default

#---------------------------------------------------
# SETTING USER PREFERENCES
#---------------------------------------------------

echo "Enter a new root password."
passwd

echo "Adding default user account."
adduser -g users -G lp,wheel,audio,cdrom,portage,cron -m tleilaxu

echo Enter a new default user account password."
passwd tleilaxu

#---------------------------------------------------
# INSTALLING BOOT LOADER
#---------------------------------------------------

echo "Installing grub [root(hd0,1) setup(hd0)]. Press <ENTER> to continue."
read
grub

#---------------------------------------------------
# COMPILING KERNEL
#---------------------------------------------------

genkernel --kernel-cc=/usr/lib/ccache/bin/gcc --menuconfig all

cp /boot/grub/grub.conf.example /boot/grub/grub.conf
nano -w /boot/grub/grub.conf

reboot


Aditional software
Code:

#---------------------------------------------------
# CONFIGURING XORG-X11
#---------------------------------------------------

X -configure
mv /root/xorg.conf.new /root/xorg.default.conf
cp /root/xorg.default.conf /etc/X11/xorg.conf

# Example of Configuration with Special Drivers
# echo "media-video/nvidia-kernel ~x86" >> /etc/portage/package.keywords
# echo "media-video/nvidia-glx ~x86" >> /etc/portage/package.keywords
# emerge nvidia-kernel nvidia-glx nvidia-settings; eselect opengl set nvidia
# modprobe nvidia
# X -configure
# mv /root/xorg.conf.new /root/xorg.nvidia.conf
# cp /root/xorg.nvidia.conf /etc/X11/xorg.conf

X -config /etc/X11/xorg.conf
nano -w /etc/X11/xorg.conf

#---------------------------------------------------
# UPDATING PORTAGE
#---------------------------------------------------

eupdatedb && esync

#---------------------------------------------------
# UPDATING SYSTEM
#---------------------------------------------------

emerge -uDNf world
emerge -uDNq world
pearl-cleaner reallyall
python-updater
revdep-rebuild
env-update && source /etc/profile

#---------------------------------------------------
# RECOMPILING SYSTEM
#---------------------------------------------------

emerge -e system

#---------------------------------------------------
# INSTALLING ADITIONAL SOFTWARE
#---------------------------------------------------

emerge -f sun-jdk sun-jre-bin gnome gimp openoffice-bin ooqstart-gnome indeview realplayer mplayer xine-ui mozilla-firefox azureus-bin
emerge -q sun-jdk sun-jre-bin gnome gimp openoffice-bin ooqstart-gnome indeview realplayer mplayer xine-ui mozilla-firefox azureus-bin

#---------------------------------------------------
# SETTING UP BASH COMPLETION
#---------------------------------------------------

echo "[[ -f /etc/profile.d/bash-completion ]] && source /etc/profile.d/bash-completion" >> /etc/bashrc
eselect bashcomp disable --global gentoo
eselect bashcomp enable gentoo
for i in `ls /usr/share/bash-completion/`; do ln -s /usr/share/bash-completion/$i /etc/bash_completion.d/$i; done

#---------------------------------------------------
# SETTING UP GETDELTA
#---------------------------------------------------

emerge getdelta && echo 'FETCHCOMMAND="/usr/bin/getdelta.sh \${URI}"' >> /etc/make.conf

_________________
A mind that is stretched by a new experience can never go back to its old dimensions. - Oliver Wendell Holmes


Last edited by Gotterdammerung on Thu Jun 22, 2006 4:03 pm; edited 1 time in total
Back to top
View user's profile Send private message
forgotten1
Guru
Guru


Joined: 11 Jan 2005
Posts: 477
Location: East Coast, USA

PostPosted: Wed Jun 21, 2006 4:07 pm    Post subject: Reply with quote

Bash Scripting - What a great learning experience. I'm also writing a similar script, because automation is golden. One of the sources I've used for ideas is:

GLIS: Gentoo Linux Install Script (v0.1 Final, PLZ Test)

I don't have any suggestions for you at this time except:

You may want to consider adding a warning at the beginning of the script that communicates the danger of running the script. I.e. it will make irrevocable changes to the hard drive. This doesn't mean you won't be able to recover data if you accidentally run it on the wrong drive, but you will most likely have to reinstall the OS (assuming you overwrote a WinXP installation).

I added a menu that allows the user to escape the script at that point. This wasn't really necessary, because a Ctrl-C will kill it, but it looks nice.

Good luck!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum