# make.conf
```
# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
COMMON_FLAGS="-march=native -mtune=native -O2 -pipe"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"
MAKEOPTS="-j3"

# NOTE: This stage was built with the bindist Use flag enabled

# This sets the language of build output to English.
# Please keep this setting intact when reporting bugs.
LC_MESSAGES=C

GENTOO_MIRRORS="http://ftp.free.fr/mirrors/ftp.gentoo.org/"

LINGUAS="fr fr_FR en en_GB"
L10N="fr fr-FR en en-GB"
LLVM_TARGETS="X86"

ACCEPT_LICENSE="-* @FREE @BINARY-REDISTRIBUTABLE"
USE="-help -selinux -systemd minimal"
```

# partitionning
Create 2 partitions :
/dev/sda1 1024M for boot
/dev/sda2 the reste for lvm

mkfs.vfat -F 32 /dev/sda1

pvcreate /dev/sda2
vgcreate vg_system /dev/sda2
lvcreate -L 5G vg_system -n lv_home
lvcreate -L 15G vg_system -n lv_root
lvcreate -L 2G vg_system -n lv_tmp
lvcreate -L 10G vg_system -n lv_usr
lvcreate -L 5G vg_system -n lv_var
lvcreate -L 5G vg_system -n lv_var_log
lvcreate -L 15G vg_system -n lv_var_tmp
lvcreate -L 5G vg_system -n lv_var_cache
lvcreate -L 2G vg_system -n lv_swap

mkfs.ext4 /dev/vg_system/lv_home
mkfs.ext4 /dev/vg_system/lv_root
mkfs.ext4 /dev/vg_system/lv_tmp
mkfs.ext4 /dev/vg_system/lv_usr
mkfs.ext4 /dev/vg_system/lv_var
mkfs.ext4 /dev/vg_system/lv_var_log
mkfs.ext4 /dev/vg_system/lv_var_tmp
mkfs.ext4 /dev/vg_system/lv_var_cache

mkswap /dev/vg_system/lv_swap
swapon /dev/vg_system/lv_swap

mkdir --parents /mnt/gentoo
mount /dev/vg_system/lv_root /mnt/gentoo
mkdir /mnt/gentoo/{home,tmp,var,usr}
mount /dev/vg_system/lv_home /mnt/gentoo/home
mount /dev/vg_system/lv_tmp /mnt/gentoo/tmp
mount /dev/vg_system/lv_usr /mnt/gentoo/usr/
mount /dev/vg_system/lv_var /mnt/gentoo/var/
mkdir /mnt/gentoo/var/{log,cache,tmp}
mount /dev/vg_system/lv_var_log /mnt/gentoo/var/log
mount /dev/vg_system/lv_var_cache /mnt/gentoo/var/cache
mount /dev/vg_system/lv_var_tmp /mnt/gentoo/var/tmp

# Init system 
ntpd -q -g
cd /mnt/gentoo

wget https://bouncer.gentoo.org/fetch/root/all/releases/amd64/autobuilds/$(curl -s https://distfiles.gentoo.org/releases/amd64/autobuilds/latest-stage3-amd64-openrc.txt | awk '!/^#/{gsub(/#.*/,"",$0); print $1}')
tar xpf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner
nano -w /mnt/gentoo/etc/portage/make.conf

# Installationg system
mkdir --parents /mnt/gentoo/etc/portage/repos.conf
cp /mnt/gentoo/usr/share/portage/config/repos.conf /mnt/gentoo/etc/portage/repos.conf/gentoo.conf
cp --dereference /etc/resolv.conf /mnt/gentoo/etc/
mount --types proc /proc /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --make-rslave /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev
mount --make-rslave /mnt/gentoo/dev
mount --bind /run /mnt/gentoo/run
mount --make-slave /mnt/gentoo/run 

chroot /mnt/gentoo /bin/bash
source /etc/profile
export PS1="(chroot) ${PS1}"
mount /dev/sda1 /boot
emerge-webrsync
emerge --sync

eselect profile set 1

emerge -vaA app-portage/cpuid2cpuflags
echo "*/* $(cpuid2cpuflags)" > /etc/portage/package.use/00cpu-flags

echo "sys-fs/lvm2 lvm" > /etc/portage/package.use/lvm
emerge -vaA sys-fs/lvm2
/etc/init.d/lvm start
rc-update add lvm boot

emerge --ask --update --deep --changed-use --keep-going @world

echo "Europe/Paris" > /etc/timezone
emerge --config sys-libs/timezone-data

localedef -i fr_FR -f UTF-8 fr_FR.UTF-8
echo "fr_FR.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen
eselect locale set fr_FR.UTF-8
. /etc/profile

env-update && source /etc/profile && export PS1="(chroot) ${PS1}"

# Kernel
emerge -vaA sys-kernel/linux-firmware sys-kernel/installkernel-gentoo sys-kernel/gentoo-kernel-bin

# System
/etc/fstab :
echo """UUID="$(blkid -o udev /dev/sda1 | grep "ID_FS_UUID=" | cut -d'=' -f2)" /boot vfat defaults,noatime 0 2""" >> /etc/fstab
echo """UUID="$(blkid -o udev /dev/vg_system/lv_root | grep "ID_FS_UUID=" | cut -d'=' -f2)" / ext4 noatime 0 1""" >> /etc/fstab
echo """UUID="$(blkid -o udev /dev/vg_system/lv_home | grep "ID_FS_UUID=" | cut -d'=' -f2)" /home ext4 noatime 0 1""" >> /etc/fstab
echo """UUID="$(blkid -o udev /dev/vg_system/lv_tmp | grep "ID_FS_UUID=" | cut -d'=' -f2)" /tmp ext4	noatime 0 1""" >> /etc/fstab
echo """UUID="$(blkid -o udev /dev/vg_system/lv_usr | grep "ID_FS_UUID=" | cut -d'=' -f2)" /usr ext4	noatime 0 1""" >> /etc/fstab
echo """UUID="$(blkid -o udev /dev/vg_system/lv_var | grep "ID_FS_UUID=" | cut -d'=' -f2)" /var ext4	noatime 0 1""" >> /etc/fstab
echo """UUID="$(blkid -o udev /dev/vg_system/lv_var_log | grep "ID_FS_UUID=" | cut -d'=' -f2)" /var/log ext4	noatime 0 1""" >> /etc/fstab
echo """UUID="$(blkid -o udev /dev/vg_system/lv_var_tmp | grep "ID_FS_UUID=" | cut -d'=' -f2)" /var/tmp ext4	noatime 0 1""" >> /etc/fstab
echo """UUID="$(blkid -o udev /dev/vg_system/lv_var_cache | grep "ID_FS_UUID=" | cut -d'=' -f2)" /var/cache ext4	noatime 0 1""" >> /etc/fstab
echo """UUID="$(blkid -o udev /dev/vg_system/lv_swap | grep "ID_FS_UUID=" | cut -d'=' -f2)" none swap sw 0 0""" >> /etc/fstab

nano /etc/conf.d/hostname
# Set the hostname variable to the selected host name
hostname="tux"

emerge --ask app-admin/sysklogd
rc-update add sysklogd default

emerge -vaA --noreplace net-misc/netifrc

nano /etc/conf.d/net
config_enp7s0="192.168.0.22/24"
routes_enp7s0="default via 192.168.0.3"

cd /etc/init.d
ln -s net.lo net.enp7s0
rc-update add net.enp7s0 default

nano /etc/hosts
nano /etc/conf.d/keymaps -> fr-latin1

# Bootloader
emerge -vaA sys-boot/grub
grub-install /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg

# Softs
emerge -vaA app-misc/tmux \
app-admin/sudo \
app-portage/eix \
app-portage/genlop \
app-shells/bash-completion \
dev-vcs/git \
net-misc/curl \
net-misc/ntp \
sys-fs/e2fsprogs \
sys-fs/dosfstools \
sys-apps/lm-sensors \
sys-apps/mlocate \
sys-apps/smartmontools \
sys-process/htop

rc-update add sshd default

ntpdate -b -u 0.gentoo.pool.ntp.org
rc-service ntp-client start
rc-update add ntp-client default

# Reboot
useradd -m -G users,wheel -s /bin/bash gizmo
passwd gizmo
passwd root

exit
cd
umount -l /mnt/gentoo/dev{/shm,/pts}
umount -R /mnt/gentoo
reboot