Last active
December 28, 2015 20:39
-
-
Save kemadz/7558995 to your computer and use it in GitHub Desktop.
Funtoo Install Script Chroot Part for Virtualbox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Funtoo Install Script Chroot Part for Virtualbox | |
# 校准系统, UTC标准时间 | |
echo "-*- Adjusting the time -*-" | |
ntpdate time1.google.com | |
# 创建分区 | |
echo "-*- Partitioning the disk -*-" | |
sgdisk \ | |
-n 1:2048:+512m -c 1:boot \ | |
-n 2:0:+32m -c 2:gpt -t 2:ef02 \ | |
-n 3:0:+1g -c 3:swap -t 3:8200 \ | |
-n 4:0:0 -c 4:root \ | |
/dev/sda | |
# 创建文件系统 | |
echo "-*- Making filesystem -*-" | |
mkfs.ext4 -L boot /dev/sda1 >/dev/null 2>&1 | |
mkfs.ext4 -L root /dev/sda4 >/dev/null 2>&1 | |
mkswap -L swap /dev/sda3 >/dev/null 2>&1 | |
# 设置文件系统检查频率,每30次mount,或180天 | |
#tune2fs -l /dev/sda1 | |
#tune2fs -c 30 -i 180 /dev/sda1 | |
#tune2fs -c 30 -i 180 /dev/sda4 | |
# 挂载文件系统 | |
echo "-*- Mounting filesystem -*-" | |
mkdir /mnt/fnto | |
mount /dev/sda4 /mnt/fnto | |
mkdir /mnt/fnto/boot | |
mount /dev/sda1 /mnt/fnto/boot | |
swapon /dev/sda3 | |
# 下载和解压 stage3 和 portage 包 | |
echo "-*- Downloading stage3 and portage -*-" | |
cd /mnt/fnto | |
wget http://goo.gl/aWJShn >/dev/null 2>&1 | |
wget http://goo.gl/lHHmLf >/dev/null 2>&1 | |
wget http://fanzhi.org/fnto/bzImage >/dev/null 2>&1 | |
wget http://fanzhi.org/fnto/lib.txz >/dev/null 2>&1 | |
echo "-*- Extracting stage3 -*-" | |
tar xpf stage3-latest.tar.xz | |
echo "-*- Extracting portage -*-" | |
tar xf portage-latest.tar.xz -C usr | |
# Chroot 安装配置新系统 | |
mount -o bind /dev /mnt/fnto/dev | |
mount -o bind /proc /mnt/fnto/proc | |
wget https://gist.github.com/kemadz/7559103/raw -O vbox_fnto_chroot.sh | |
chmod +x /mnt/fnto/vbox_fnto_chroot.sh | |
env -i HOME=/root TERM=$TERM /bin/bash | |
chroot /mnt/fnto /bin/bash /vbox_fnto_chroot.sh | |
# 卸载文件系统并重启 | |
cd | |
umount /mnt/fnto/{boot,dev,proc,} | |
shutdown -r now |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment