可以使用这个脚本,组合执行 http://forum.ubuntu.org.cn/viewtopic.php?f=21&t=372655
代码: 全选
_slim_conf="/etc/slim.conf"
_rc_conf="/etc/rc.conf"
_username=""
_sudoers="/etc/sudoers"
_pacman_conf="/etc/pacman.conf"
_modprobe_conf="/etc/modprobe.d/modprobe.conf"
_bootloader_dev="/dev/sda"
_grub_conf="/etc/default/grub"
_xinitrc_conf="/home/$_username/.xinitrc"
# AUR client
_install_yaourt()
{
grep -q -e "^\[archlinuxfr\]" $_pacman_conf || echo -e "[archlinuxfr]\nServer = http://repo.archlinux.fr/\$arch" >> $_pacman_conf
pacman -Sy yaourt base-devel --noconfirm
}
# X11
_install_X11()
{
pacman -S xorg-server xorg-server-utils xorg-xinit xorg-utils xfce4 xfce4-goodies nvidia nvidia-utils dbus --noconfirm
nvidia-xconfig
}
# Sound
_install_alsa()
{
sudo pacman -S alsa-utils --noconfirm
}
# Display manager
_install_slim()
{
pacman -S slim slim-themes archlinux-themes-slim --noconfirm
}
# Multiboot Boot loader
_install_grub2()
{
sudo pacman -S os-prober grub-bios --noconfirm
yaourt -S grub2-theme-archlinux --noconfirm
yaourt -S grub2-theme-archxion --noconfirm
sudo grub-install --boot-directory=/boot --no-floppy --recheck --debug $_bootloader_dev
}
# software
_install_software()
{
# fonts
pacman -S wqy-bitmapfont wqy-zenhei ttf-dejavu ttf-arphic-ukai ttf-arphic-uming ttf-fireflysung xkill rsync --noconfirm
sudo yaourt -S ttf-ms-fonts-zh_cn --noconfirm
sudo yaourt -S tf-ms-fonts --noconfirm
sudo yaourt -S ttf-microsoft-yahei --noconfirm
# popular software
pacman -S ibus-anthy ibus-pinyin virtualbox virtualbox-source virtualbox-modules wmctrl xbindkeys ntfs-3g p7zip unrar unzip chmsee epdfview stellarium openjdk6 freemind amule smplayer ristretto transmission-gtk firefox flashplugin terminator bash-completion scrot colordiff --noconfirm
# sudo yaourt -S ntpdate --noconfirm
sudo yaourt -S pysdm --noconfirm
# others
sudo pacman -S git gvim python-sphinx openssh tree qgit subversion dia --noconfirm
}
# setting alsa
_config_alsa()
{
mkdir -p /etc/modprobe.d
grep -q -e "^option snd-NAME-OF-MODULE" $_modprobe_conf || echo "options snd-NAME-OF-MODULE ac97_quirk=0" >> $_modprobe_conf
}
_config_slim()
{
# themes
grep -q -e "^current_theme\s*default" $_slim_conf && sed -i -e "s/\(current_theme\ *\)\ *\(default\)/\1fingerprint,flat,archlinux-darch-white/" $_slim_conf
# daemon
grep -q -e "^DAEMONS=(.* dbus slim" $_rc_conf || sed -i "s/^DAEMONS=([^)]*/& dbus slim/" $_rc_conf
# default user
grep -q -e "^default_user" $_slim_conf || sed -i -e '/^#default_user/a default_user\tmatt' $_slim_conf
# automatically
grep -q -e "^auto_login" $_slim_conf || sed -i -e '/^#auto_login/a auto_login\tyes' $_slim_conf
# xinitrc
grep -q -e "^exec startxfce4" $_xinitrc_conf || echo -e "\nexec startxfce4" $_xinitrc_conf
}
_config_grub2()
{
# theme
grep -q -e "^GRUB_THEME" $_grub_conf || sed -i -e "/^#GRUB_THEME=/a GRUB_THEME=/usr/share/grub/themes/Archlinux/theme.txt" $_grub_conf
# kernel parmater
grep -q -e "GRUB_CMDLINE_LINUX_DEFAULT=.*acpi=off" $_grub_conf || sed -i -e "s/^GRUB_CMDLINE_LINUX_DEFAULT=\"[^\"]*/& acpi=off/" $_grub_conf
# disable os probe
grep -q -e "GRUB_DISABLE_OS_PROBER=true" $_grub_conf || echo -e "\nGRUB_DISABLE_OS_PROBER=true\n" >> $_grub_conf
grep -q -e "menuentry 'Ubuntu 12.04'" /etc/grub.d/40_custom || cat >> /etc/grub.d/40_custom << "EOF"
menuentry 'Ubuntu 12.04' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
gfxmode $linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos9)'
search --no-floppy --fs-uuid --set=root 6c7fbafe-845d-4277-b9d3-ab7c34516ef0
linux /boot/vmlinuz-3.2.0-23-generic-pae root=UUID=6c7fbafe-845d-4277-b9d3-ab7c34516ef0 ro quiet acpi=off splash $vt_handoff
initrd /boot/initrd.img-3.2.0-23-generic-pae
}
EOF
sudo RUB_PREFIX="/boot/grub" grub-mkconfig -o /boot/grub/grub.cfg
}
# virtualbox
_config_vbox()
{
grep -q -e "^MODULES" $_rc_conf || echo -e "\nMODULES=()" >> $_rc_conf
grep -q -e "^MODULES.*vboxdrv" $_rc_conf || sudo sed -i "s/^MODULES=([^)]*/& vboxdrv/" $_rc_conf
}
# localization
_config_locale()
{
echo -e '\nHOSTNAME="mattPC"\nLOCALE="en_US.UTF-8"' >> /etc/rc.conf
sed -i -e "s/#\(en_US.UTF-8.*\)/\1/" /etc/locale.gen
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
locale-gen
}
# fix network unreachable
_fix_dhcpcd_mtu()
{
sed -i -e "s/option interface_mtu/#&/" /etc/dhcpcd.conf
}
_add_user()
{
groupadd $_username
useradd -s /bin/bash -g $_username -m -k /etc/skel/ $_username
passwd $_username
grep -q -e "# %wheel" $_sudoers && sed -i -e "s/#\ \(%wheel\)/\1/" $_sudoers
gpasswd -a $_username wheel
}