Gentoo


make.conf

cat >/etc/make.conf <<DELIM
# These settings were set by the metro build script that automatically built this stage.
# Please consult /etc/make.conf.example for a more detailed example.

ACCEPT_KEYWORDS="~amd64"
FEATURES="mini-manifest parallel-fetch"
CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=core2 -O2 -pipe"

USE="bash-completion cjk python vim-syntax -alac -alsa -cdr -cups -dri -dvd -dvdr -encode \
-flac -fortran -ipv6 -lame -mad -mp3 -mpeg -ogg -pppd -vorbis -wavpack -xorg"
LINGUAS="zh_CN zh en"

MAKEOPTS="-j5"
EMERGE_DEFAULT_OPTS="-av"
GENTOO_MIRRORS="http://ftp.osuosl.org/pub/gentoo"

# source /var/lib/layman/make.conf
PORTDIR_OVERLAY="${PORTDIR_OVERLAY} /usr/local/portage/"

PHP_TARGETS="php5-3"
DELIM

Update

#if you update your perl
perl-cleaner --all
#if you update your python
python-updater

emerge

ebuild /path/to/ebuild fetch
ebuild /path/to/ebuild unpack
ebuild /path/to/ebuild compile
ebuild /path/to/ebuild install
ebuild /path/to/ebuild qmerge
ebuild /path/to/ebuild clean

Install

# syslog and vixie
emerge syslog-ng logrotate vixie-cron 
rc-update add syslog-ng vixie-cron default
# iostat sar etc.
emerge sysstat
# ftp telnet nslookup dig nmap etc.
emerge lftp netkit-telnetd bind-tool nmap tcpdump elinks ntp vsftpd
emerge gentoolkit eix ccache sudo mlocate sqlite vim unzip

cat >> ~/.bashrc <<DELIM

# locale
export LANG="zh_CN.UTF-8"
export LC_COLLATE="C"

DELIM

fstab

NTFS:
/dev/sda6 /mnt/wine ntfs defaults,nls=utf8 0 0
VFAT
/dev/sda7 /mnt/winf vfat defaults,codepage=936,iocharset=utf8 0 0

ssh-agent

eval `ssh-agent`
ssh-add ~/.ssh/id_rsa

layman

echo "app-portage/layman subversion git" >> /etc/portage/package.use
emerge layman
echo "source /var/lib/layman/make.conf" >> /etc/make.conf
mkdir /var/lib/layman
echo "PORTDIR_OVERLAY=\"\"" > /var/lib/layman/make.conf
mkdir -p /usr/local/portage/profiles
echo "zhong" > /usr/local/portage/profile/repo_name
echo "PORTDIR_OVERLAY="${PORTDIR_OVERLAY} /usr/local/portage/" >> /etc/make.conf
mkdir -p /usr/local/portage/media-fonts/msfonts
cd !$
wget http://wiki.zhonglog.com/_export/code/linux:gentoo?codeblock=7 -O msfonts-0.1.0.ebuild
ebuild msfonts-0.1.0.ebuild manifest
emerge msfonts
cat >msfonts-0.1.0.ebuild <<DELIM
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit font

DESCRIPTION="Microsoft's non-free fonts"
HOMEPAGE="http://wiki.zhonglog.com/linux:gentoo"
SRC_URI="http://wiki.zhonglog.com/static/msfonts.tar.bz2"

KEYWORDS="amd64 ~amd64 x86 ~x86"
SLOT="0"
IUSE="X"

DEPEND=""
RDEPEND=""

S=${WORKDIR}
FONT_S=${WORKDIR}
FONT_SUFFIX="ttf"

src_unpack() {
        echo ">>> Unpacking ${A} to ${WORKDIR}"
        tar xjvf "${DISTDIR}"/${A} > /dev/null \
                        || die "failed to unpack ${A}"
}
DELIM

中文 man

cat > /etc/locale.gen <<DELIM
en_US ISO-8859-1
en_US.UTF-8 UTF-8
zh_CN.GB18030 GB18030
zh_CN.GBK GBK
zh_CN.UTF-8 UTF-8
zh_CN GB2312
DELIM

locale-gen
emerge -C man
emerge man-db

module-rebuild

emerge module-rebuild
module-rebuild populate
module-rebuild rebuild
rmmod nvidia
depmod -a
modprobe nvidia
startx

fix wget.mo

msgunfmt /usr/share/locale/zh_CN/LC_MESSAGES/wget.mo -o - | sed 's/eta(英国中部时间)/ETA/' | msgfmt - -o /tmp/zh_CN.mo
sudo cp /tmp/zh_CN.mo /usr/share/locale/zh_CN/LC_MESSAGES/wget.mo