Created
February 8, 2025 21:47
-
-
Save Polostiyton/e28d1efcdbf6be73d26b97d4221ac686 to your computer and use it in GitHub Desktop.
This file contains 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
### 6. Configuring make.conf | |
echo "Configuring make.conf..." | |
CPU_FLAGS="$(cpuid2cpuflags)" | |
cat <<'EOF' > /mnt/gentoo/etc/portage/make.conf | |
COMMON_FLAGS="-O2 -pipe -march=native" | |
CFLAGS="${COMMON_FLAGS}" | |
CXXFLAGS="${COMMON_FLAGS}" | |
FCFLAGS="${COMMON_FLAGS}" | |
FFLAGS="${COMMON_FLAGS}" | |
MAKEOPTS="-j$(nproc)" | |
CPU_FLAGS="${CPU_FLAGS}" | |
ACCEPT_LICENSE="*" | |
USE="X kde plasma dbus pulseaudio alsa wine" | |
EOF | |
### 7. Setting up mirrors | |
echo "Setting up mirrors..." | |
mkdir -p /mnt/gentoo/etc/portage/repos.conf | |
cp /mnt/gentoo/usr/share/portage/config/repos.conf /mnt/gentoo/etc/portage/repos.conf/gentoo.conf | |
mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf | |
### 8. Copying DNS | |
echo "Copying DNS..." | |
cp /etc/resolv.conf /mnt/gentoo/etc/ | |
### 9. Mounting system directories | |
echo "Mounting system directories..." | |
mount -t 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 | |
### 10. Chrooting into the new system | |
echo "Chrooting into the new system..." | |
chroot /mnt/gentoo /bin/bash <<'EOF' | |
### 11. Updating the Portage tree | |
echo "Updating the Portage tree..." | |
emerge-webrsync | |
### 12. Selecting the profile | |
echo "Selecting the profile..." | |
eselect profile list | |
read -p "Enter the number of the OpenRC profile (e.g., 5): " PROFILE_NUM | |
eselect profile set ${PROFILE_NUM} | |
### 13. Installing the kernel | |
echo "Installing the kernel..." | |
emerge sys-kernel/gentoo-sources sys-kernel/linux-firmware | |
cd /usr/src/linux | |
make menuconfig | |
make -j$(nproc) && make modules_install && make install | |
### 14. Installing GRUB | |
echo "Installing GRUB..." | |
emerge sys-boot/grub | |
grub-install ${DEVICE} | |
grub-mkconfig -o /boot/grub/grub.cfg | |
### 15. Installing KDE and Wine | |
echo "Installing KDE and Wine..." | |
emerge kde-plasma/plasma-meta app-emulation/wine | |
### 16. Setting up language and keyboard layout | |
echo "Setting up language and keyboard layout..." | |
cat <<'EOF2' > /etc/locale.conf | |
LANG="ru_RU.UTF-8" | |
LC_COLLATE="C" | |
EOF2 | |
cat <<'EOF2' > /etc/vconsole.conf | |
KEYMAP="ru" | |
FONT="cyr-sun16" | |
EOF2 | |
cat <<'EOF2' > /etc/env.d/02locale | |
LANG="ru_RU.UTF-8" | |
LC_COLLATE="C" | |
EOF2 | |
echo "ru_RU.UTF-8 UTF-8" >> /etc/locale.gen | |
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen | |
locale-gen | |
eselect locale set ru_RU.utf8 | |
env-update && source /etc/profile | |
### 17. Setting up keyboard layout switching (Alt+Shift) | |
echo "Setting up keyboard layout switching..." | |
cat <<'EOF2' > /etc/X11/xorg.conf.d/00-keyboard.conf | |
Section "InputClass" | |
Identifier "system-keyboard" | |
MatchIsKeyboard "on" | |
Option "XkbLayout" "us,ru" | |
Option "XkbOptions" "grp:alt_shift_toggle" | |
EndSection | |
EOF2 | |
### 18. Setting up time | |
echo "Setting up time..." | |
ln -sf /usr/share/zoneinfo/Europe/Moscow /etc/localtime | |
emerge sys-libs/timezone-data | |
echo "Europe/Moscow" > /etc/timezone | |
echo "UTC=false" >> /etc/conf.d/hwclock | |
hwclock --systohc --localtime | |
### 19. Setting up network | |
echo "Setting up network..." | |
emerge net-misc/dhcpcd | |
rc-update add dhcpcd default | |
### 20. Setting up hostname and root password | |
echo "Setting up hostname and root password..." | |
echo "gentoo" > /etc/hostname | |
passwd | |
### 21. Installing VirtualBox Guest Additions (optional) | |
echo "Installing VirtualBox Guest Additions..." | |
emerge app-emulation/virtualbox-guest-additions | |
rc-update add virtualbox-guest-additions default | |
### 22. Exiting chroot | |
exit | |
EOF | |
### 23. Finishing the installation | |
echo "Finishing the installation..." | |
umount -l /mnt/gentoo/dev{/shm,/pts,} | |
umount -l /mnt/gentoo{/proc,/sys,/boot,} | |
echo "Installation complete! Reboot the system." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment