Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
YAGLIS (Yet Another Gentoo Linux Install Script)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
Gotterdammerung
l33t
l33t


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

PostPosted: Thu Mar 08, 2007 3:52 am    Post subject: YAGLIS (Yet Another Gentoo Linux Install Script) Reply with quote

This script was used to install Gentoo in a AMD X2, nVidia 7900GS, 1 HD IDE, 1 HD SATA, and two network interfaces.

I am sure you have seen pieces of this code here and there, but, what can I say? This is another YAGLIS, and it served me well. I hope it helps you installing Gentoo, or, at least, doing some other task.

Enjoy!

Code:
CHROOT_DIR=/mnt/gentoo

mkdir -p ${CHROOT_DIR}
mount -t reiserfs /dev/sda1 ${CHROOT_DIR}
cd ${CHROOT_DIR}

wget -t 100 -c http://gentoo.mirrors.tds.net/gentoo/releases/amd64/current/stages/stage3-amd64-2006.1.tar.bz2
tar -xvjpf stage3-amd64-2006.1.tar.bz2 -C ${CHROOT_DIR}

if [ -e ${CHROOT_DIR}/etc/init.d/functions.sh ] ; then
   source ${CHROOT_DIR}/etc/init.d/functions.sh
   esyslog() { echo &> /dev/null; }
else
   eerror() { echo "!!! $*"; }
   einfo() { echo "* $*"; }
fi

einfo "Stage 3 and Snapshot Setup"
wget -t 100 -c http://gentoo.mirrors.tds.net/gentoo/snapshots/portage-latest.tar.bz2
tar xvjf portage-latest.tar.bz2 -C ${CHROOT_DIR}/usr

einfo "Config Files Setup"
mv ${CHROOT_DIR}/etc/make.conf ${CHROOT_DIR}/etc/make.conf.bkp

cat > ${CHROOT_DIR}/etc/make.conf << "EOF"
# These settings were set by the catalyst build script that automatically built this stage
# Please consult /etc/make.conf.example for a more detailed example
CFLAGS="-march=athlon64 -mtune=athlon64 -pipe -O2"
CHOST="x86_64-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j3"
CCACHE_SIZE="2G"
CCACHE_DIR="/var/tmp/ccache/"
LINGUAS="en pt_BR"
FEATURES="ccache parallel-fetch userfetch"
INPUT_DEVICES="keyboard mouse"
VIDEO_CARDS="nvidia"
#ALSA_CARDS=
AUTOCLEAN="yes"
PORTAGE_TMPFS="/dev/shm"
USE="X -kde gtk gnome branding hal avahi midi alsa 3dnow 3dnowext sse \
     sse2 mmx mmxext a52 aac aalib avi cdparanoia cdr divx4linux dv \
     dvd dvdr dvdread encode faac faad2 ffmpeg flac jpeg lame \
     libcddb libcdio libdvbpsi libdvdcss libdvdread libdvdnav libogg \
     libmad libmatroska live mad mjpeg mp3 ogg png quicktime real \
     vcd vidix vorbis xmms xv tk nptl threads dbus mpeg theora tcl \
     rar usb gif"
EOF

vi ${CHROOT_DIR}/etc/make.conf

cat >> ${CHROOT_DIR}/etc/locale.gen << "EOF"
en_US ISO-8859-1
en_US.UTF-8 UTF-8
pt_BR ISO-8859-1
pt_BR.UTF-8 UTF-8
EOF

vi ${CHROOT_DIR}/etc/locale.gen

cp -L /etc/resolv.conf ${CHROOT_DIR}/etc/resolv.conf
cp /etc/hosts ${CHROOT_DIR}/etc/hosts

mv ${CHROOT_DIR}/etc/fstab ${CHROOT_DIR}/etc/fstab.bkp

cat > ${CHROOT_DIR}/etc/fstab << "EOF"
/dev/hda2            /mnt/hda2            reiserfs   acl,user_xattr        1 2
/dev/sda1            /                    reiserfs   acl,user_xattr        1 1
/dev/hda3            /mnt/hda3            reiserfs   defaults              1 2
/dev/sda3            /mnt/sda3            reiserfs   defaults              1 2
/dev/hda1            swap                 swap       defaults              0 0
/dev/sda2            swap                 swap       defaults              0 0
proc                 /proc                proc       defaults              0 0
sysfs                /sys                 sysfs      noauto                0 0
debugfs              /sys/kernel/debug    debugfs    noauto                0 0
usbfs                /proc/bus/usb        usbfs      noauto                0 0
devpts               /dev/pts             devpts     mode=0620,gid=5       0 0
tmpfs                /dev/shm             tmpfs      nodev,nosuid,noexec   0 0
EOF

vi ${CHROOT_DIR}/etc/fstab

echo "hda_args=\"-d1 -A1 -m16 -u1 -a64\"" >> /etc/conf.d/hdparm

echo HOSTNAME="linux-desktop" >> ${CHROOT_DIR}/etc/conf.d/hostname
vi ${CHROOT_DIR}/etc/conf.d/hostname

cat >> ${CHROOT_DIR}/etc/portage/package.unmask << "EOF"
gnome-base/gnome-session branding
sys-devel/libperl ithreads
dev-lang/perl ithreads
www-client/links directfb fbcon javascript
app-portage/eix sqlite
dev-java/sun-jdk nsplugin
dev-java/sun-jre-bin nsplugin
app-text/acroread nsplugin
EOF

cat >> ${CHROOT_DIR}/etc/portage/package.keywords << "EOF"
x11-drivers/nvidia-drivers
x11-wm/beryl
x11-wm/emerald
x11-wm/beryl-core
x11-plugins/beryl-plugins
x11-plugins/beryl-dbus
x11-themes/emerald-themes
x11-misc/beryl-manager
x11-apps/xlsclients
x11-misc/beryl-settings
x11-wm/heliodor
app-portage/deltup
dev-util/bdelta
app-portage/getdelta
net-www/nspluginwrapper
EOF

mount -t proc none ${CHROOT_DIR}/proc
mount -o bind /dev ${CHROOT_DIR}/dev


einfo "Press anything to keep on going"
read


cat > ${CHROOT_DIR}/myGentooSetupPt2.sh << "EOF"

if [ -e /etc/init.d/functions.sh ] ; then
   source /etc/init.d/functions.sh
   esyslog() { echo &> /dev/null; }
else
   eerror() { echo "!!! $*"; }
   einfo() { echo "* $*"; }
fi

source /etc/profile
env-update

einfo "Users setup"
einfo "Enter root password"
passwd root

einfo "Enter username"
read USERNAME
useradd -m -g users -G wheel,audio,tty,cdrom,usb,video -s /bin/bash ${USERNAME}
passwd ${USERNAME}

rm /etc/make.profile
ln -s /usr/portage/profiles/default-linux/amd64/2006.1 /etc/make.profile

einfo "Updating system"
emerge --sync

einfo "Installing some useful tools"
emerge -u mirrorselect gentoolkit genkernel ccache pciutils eselect deltup getdelta eix

if [ $? == 0 ] ; then
   update-eix
   echo "FETCHCOMMAND=\"/usr/bin/getdelta.sh \\\${URI}\"" >> /etc/make.conf
   einfo "Choose fastest mirrors"
   mirrorselect -s4 -D -o >> /etc/make.conf
else
   eerror "Installing useful tools gone wrong"
   exit 1
fi

einfo "Upgrading system"
emerge --update --deep --newuse world
emerge linux-headers glibc binutils-config binutils gcc-config gcc
emerge glibc binutils gcc

einfo "Installing mandatory software"
emerge -u gentoo-sources grub syslog-ng vixie-cron slocate \
  sysfsutils reiserfsprogs ifplugd localepurge logrotate vim \
  cpudyn splashutils splash-themes-gentoo splash-themes-livecd

if [ $? == 0 ] ; then
   cd /etc/splash/
   splash_geninitramfs gentoo -r 1280x1024 -g /boot/fbsplash-gentoo-1280x1024 -v
   cd /

   rc-update add syslog-ng default
   rc-update add vixie-cron default
   rc-update add cpudyn default
   rc-update add splash default
else
   eerror "Installing mandatory software gone wrong"
   exit 1
fi

einfo "Gnome setup"

rc-update del famd default

emerge --unmerge app-admin/fam
emerge -u gnome gamin alsa-utils alsa-oss beryl emerald emerald-themes heliodor mesa-progs nvidia-drivers

if [ $? == 0 ] ; then
   echo -n "options nvidia NVreg_EnableAGPSBA=1 NVreg_EnableAGPFW=1" >> /etc/modules.d/nvidia
   echo -n " NVreg_DeviceFileUID=0 NVreg_DeviceFileGID=27" >> /etc/modules.d/nvidia
   echo -n " NVreg_DeviceFileMode=0660 NVreg_RemapLimit=0x7c00000" >> /etc/modules.d/nvidia

   einfo "Alsa setup"
   alsaconf
   modules-update -f

   rc-update add hald default
   rc-update add dbus default
   rc-update add avahi-dnsconfd default
   rc-update add xdm default
   rc-update add alsasound default
else
   eerror "Gnome setup gone wrong"
   exit 1
fi

etc-update
dispatch-conf
env-update

einfo "Kernel setup"
genkernel --kernel-cc=/usr/lib/ccache/bin/gcc --gensplash=gentoo --menuconfig --bootloader=grub all
if [ $? != 0 ] ; then
   eerror "Kernel setup gone wrong"
   exit 1
fi

EOF


einfo "Press anything to keep on going"
read


chroot ${CHROOT_DIR} sh myGentooSetupPt2.sh

cat >> /boot/grub/grub.conf << "EOF"
default 0
timeout 8
fallback 1
splashimage=(hd1,0)/boot/grub/splash.xpm.gz

# Linux kernel
title=Gentoo Linux (2.6.19-gentoo-r5)
root (hd1,0)
kernel /boot/kernel-genkernel-x86_64-2.6.19-gentoo-r5 root=/dev/sda1 vga=0x31a resume=/dev/hda2 showopts splash=verbose,theme:gentoo console=tty1 iommu=memaper
initrd /boot/fbsplash-gentoo-1280x1024

# For installing GRUB into the hard disk
title Install GRUB into the hard disk
root    (hd1,0)
setup   (hd0)

# Change the colors.
title Change the colors
color light-green/brown blink-red/blue
EOF

einfo "Grub setup"
cp /proc/mounts /etc/mtab

grub << "EOF"
device (hd0) /dev/hda
device (hd1) /dev/sda
root (hd1,0)
setup (hd1)
setup (hd0)
quit
EOF

einfo "Edit config files"
vi /etc/rc.conf
vi /etc/conf.d/clock
vi /etc/conf.d/hostname
vi /etc/conf.d/keymaps
vi /etc/conf.d/rc
vi /etc/conf.d/hdparm
vi /boot/grub/grub.conf

einfo "Network setup"
cat >> /etc/conf.d/net << "EOF"
modules=( "ifconfig" )
config_eth0=( "192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255" )
routes_eth0=( "default gw 192.168.0.1" )
EOF

rc-update add net.eth0 default

_________________
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 Mar 08, 2007 1:21 pm; edited 1 time in total
Back to top
View user's profile Send private message
mark_alec
Bodhisattva
Bodhisattva


Joined: 11 Sep 2004
Posts: 6066
Location: Melbourne, Australia

PostPosted: Thu Mar 08, 2007 6:30 am    Post subject: Reply with quote

Moved from Installing Gentoo to Unsupported Software.
_________________
www.gentoo.org.au || #gentoo-au
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software 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