All pastes #1017748 Raw Edit

gentoo-install-20080514.sh

public shellscript v1 · immutable
#1017748 ·published 2008-05-14 07:24 UTC
rendered paste body
#!/bin/sh## Gentoo installation script by ExclusivE [icq#433955 exclusive_tm@mail.ru]# v. 20080514## Notes:# * kernel must be compiled via Genkernel# * IDE drives must be attached via libata driver## Write here partitionsdrive=sdbboot="${drive}6"swap="${drive}7"root="${drive}8"die() {    local err="$1"    echo -e '\e\033[01;31m\e ' Error: $err'\e\033[00m\e'    exit 1}#die lol#exitcheck_hdd() {    local my_hd=`mount|grep 'dev.* / '|awk '{print $1}'|sed 's/^\/dev\/\([a-z]\+\).*$/\1/'`    local my_sn="`sginfo -s $my_hd`"    local dst_sn="`sginfo -s $drive`"    if [ "$dst_sn" == "$my_sn" ];    then        die "Защита от самоуничтожения"    fi}create_fs() {    echo -e '\e\033[01;32m\e ' Creating filesystems'\e\033[00m\e'    mkfs.ext2 /dev/$boot || die    mkfs.reiserfs /dev/$root || die    mkswap /dev/$swap || die}mount_fs() {    echo -e '\e\033[01;32m\e ' Mounting filesystems'\e\033[00m\e'    swapon /dev/$swap || die    mount -o noatime /dev/$root /mnt/1 || die "can't mount root"    test -d /mnt/1/boot || mkdir /mnt/1/boot || die "can\'t create boot directory"    mount -o noatime /dev/$boot /mnt/1/boot  || die "can\'t mount boot"    mount /boot || echo can\'t mount my boot, похуй, продолжаем}copy_system() {    echo -e '\e\033[01;32m\e ' Copyng system...'\e\033[00m\e'    rsync -a --devices -h --exclude-from=/root/install/exclude-list  / /mnt/1 || die "Copy failed"    rm /mnt/1/etc/udev/rules.d/70-persistent-cd.rules /mnt/1/etc/udev/rules.d/70-persistent-net.rules    mkdir /mnt/1/{tmp,var/tmp,mnt,mnt/1,mnt/2,mnt/cdrom,mnt/cdrom1,mnt/flash,mnt/floppy,media,sys,proc,home,home/l00z3r,var/tmp/paludis}    chmod 777 /mnt/1/{tmp,var/tmp}    chmod +t /mnt/1/{tmp,var/tmp}    chown root:plugdev /mnt/1/media /mnt/1/mnt/*    chmod 775 /mnt/1/media /mnt/1/mnt/*    chown l00z3r /mnt/1/home/l00z3r    chmod 775 /mnt/1/var/tmp/paludis    chmod +s /mnt/1/var/tmp/paludis    chown :paludisbuild /mnt/1/var/tmp/paludis}create_fstab() {    cp /root/install/fstab /mnt/1/etc/fstab    echo -e '\e\033[01;32m\e' Writing fstab..'\e\033[00m\e'.    root_id=`ls -l /dev/disk/by-id/|grep $root|awk '{print $9}'|head -n 1`    swap_id=`ls -l /dev/disk/by-id/|grep $swap|awk '{print $9}'|head -n 1`    boot_id=`ls -l /dev/disk/by-id/|grep $boot|awk '{print $9}'|head -n 1`    echo "/dev/disk/by-id/$root_id      /       reiserfs        noatime 0 1/dev/disk/by-id/$boot_id        /boot   ext2    noatime,noauto  1 2/dev/disk/by-id/$swap_id        none    swap    sw      0 0" >> /mnt/1/etc/fstab}config_grub() {    echo -e '\e\033[01;32m\e' Writing grub.conf...'\e\033[00m\e'    root_uuid=`blkid -s UUID  -o value /dev/$root`    kernel_ver=`uname -r`# дальше еще 2 черезжопных способа#    `debugreiserfs /dev/sdb6 2>/dev/null|grep UUID|cut -d " " -f 2`# `ls -l /dev/disk/by-uuid/|grep $root|awk '{print $9}'|head -n 1`    let boot_num="`echo $boot|sed 's/^.*\([0-9]\+\)/\1/'`-1"    local grub_conf="timeout 3\ndefault 0\ntitle Gentoo Linux\nroot (hd0,${boot_num})\nkernel /kernel-genkernel-x86-${kernel_ver} real_root=UUID=${root_uuid} vga=791 splash=silent,theme:crystal-gentoo-r1 console=tty1 quiet udev\ninitrd /initramfs-genkernel-x86-${kernel_ver}\n\ntitle Gentoo Linux [intel+via chipsets]\nroot (hd0,${boot_num})\nkernel /kernel-genkernel-x86-${kernel_ver} real_root=UUID=${root_uuid} console=tty1 quiet psmouse.rate=200 vga=791 splash=silent,theme:crystal-gentoo-r1 nodetect doload=pata_via,ata_piix,pata_amd\ninitrd /initramfs-genkernel-x86-${kernel_ver}\n\ntitle Gentoo Linux [failsafe console]\nroot (hd0,${boot_num})\nkernel /kernel-genkernel-x86-${kernel_ver} real_root=UUID=${root_uuid} nofb nox\ninitrd /initramfs-genkernel-x86-${kernel_ver}\n\ntitle next hdd\nmap (hd0) (hd1)\nmap (hd1) (hd0)\nrootnoverify (hd1,0)\nchainloader +1\n\n#title win\n#root (hd0,0)\n#makeactive\n#chainloader +1\n\n"    echo -e $grub_conf > /mnt/1/boot/grub/menu.lst    echo -e '\e\033[01;32m\e' Installing grub...'\e\033[00m\e'    grub-install /dev/$drive}mount_pseudofs() {    mount -t proc none /mnt/1/proc    mount -o bind /dev /mnt/1/dev}check_hddcreate_fsmount_fscopy_systemcreate_fstabconfig_grubmount_pseudofschroot /mnt/1 /root/bin/postinst