DeployGentoo

by ezfranca
35 deployments · 4 still active · last rev. 3 years ago

This is script move the data across the partitions, setup the portage and do the initial update.
I am running from a bash script that setups the linode using the API.

Revisions and suggestions are welcomed ;)

Compatible with: No distros currently supported
						#!/bin/bash
echo `date` > /root/timelog.txt

mkdir /mnt/gentoo

mkdir /mnt/gentoo/usr
mkfs.ext3 /dev/xvdc
mount /dev/xvdc /mnt/gentoo/usr
cd /usr
cp -Rp * /mnt/gentoo/usr
rm -rf /usr/*




mkdir /mnt/gentoo/usr/portage

mkfs.ext3 /dev/xvdd
mount /dev/xvdd /mnt/gentoo/usr/portage

mkdir /mnt/gentoo/home
mkfs.ext3 /dev/xvde
mount /dev/xvde /mnt/gentoo/home
cd /home/

mkdir /mnt/gentoo/var/
mkfs.ext3 /dev/xvdf
mount /dev/xvdf /mnt/gentoo/var

mkdir /mnt/gentoo/var/lib/
mkdir /mnt/gentoo/var/lib/mysql/
mkfs.ext3 /dev/xvdg
mount /dev/xvdg /mnt/gentoo/var/lib/mysql

cd /var/
cp -Rp * /mnt/gentoo/var
rm -rf /var/*

echo "/dev/xvda   /            ext3    noatime,errors=remount-ro      0 1" >> /etc/fstab
echo "/dev/xvdb	none		swap		sw		0 0" >> /etc/fstab
echo "/dev/xvdc   /usr            ext3    noatime,errors=remount-ro      0 1" >> /etc/fstab
echo "/dev/xvdd   /usr/portage    ext3    noatime,errors=remount-ro      0 1" >> /etc/fstab
echo "/dev/xvde   /home           ext3    noatime,errors=remount-ro      0 1" >> /etc/fstab
echo "/dev/xvdf   /var            ext3    noatime,errors=remount-ro      0 1" >> /etc/fstab
#echo "/dev/xvdg   /var/lib/mysql  ext3    noatime,errors=remount-ro      0 1" >> /etc/fstab
echo "proc        /proc        proc    defaults             0 0" >> /etc/fstab
echo "shm         /dev/shm     tmpfs   nodev,nosuid,noexec  0 0" >> /etc/fstab


mount -a



cat /etc/make.conf | grep -v MAKEOPTS | grep -v USE | grep -v CFLAGS > /etc/make.conf.bkp
#cat /etc/make.conf | grep -v MAKEOPTS >> /etc/make.conf.bkp


echo 'CFLAGS="-O2 -pipe -march=native"' >> /etc/make.conf.bkp
echo 'SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"' >> /etc/make.conf.bkp
echo 'MAKEOPTS="-j9"' >> /etc/make.conf.bkp
echo 'USE="mmx sse sse2 bash-completion -alsa -cups -gnome -gtk -gtk2 -java -kde -oss -qt -sdl -X"' >> /etc/make.conf.bkp
echo 'LINGUAS="pt_BR"' >> /etc/make.conf.bkp




cp -v /etc/make.conf.bkp /etc/make.conf
mirrorselect -s2

echo "Make.conf ajustado!!"
cat /etc/make.conf

rc-update add syslog-ng
/etc/init.d/syslog-ng start

rc-update add ntp-client
/etc/init.d/ntp-client start

echo "Iniciando o sync"
emerge-webrsync -q

echo "Aguardando para instalação do portage .."
emerge -qu portage

echo "Alterando profile"

eselect profile set 11


emerge --unmerge sysvinit
emerge -qu gcc
emerge -qu binutils
emerge -qu glibc

echo "Atualizando configurações.."

emerge --unmerge 
emerge -uq system && emerge -uq world 
emerge --resume --skipfirst

etc-update --automode -5


emerge -Deq system && emerge -Deq world 

etc-update --automode -5

revdep-rebuild -q
echo `date` >> /root/timelog.txt
shutdown -r now