commit a812d45f430c7fe55c612a21af6399a9ac9fdc69 Author: mrtuxa Date: Thu Nov 24 01:47:59 2022 +0100 Init diff --git a/README.md b/README.md new file mode 100644 index 0000000..f2183b1 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Gentoo Installer diff --git a/bashrc b/bashrc new file mode 100644 index 0000000..08a0662 --- /dev/null +++ b/bashrc @@ -0,0 +1 @@ +bash chroot.sh \ No newline at end of file diff --git a/chroot.sh b/chroot.sh new file mode 100644 index 0000000..5f0dcba --- /dev/null +++ b/chroot.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash + +hostname="gentoo" + +function setupEnv() { + source /etc/profile; + export PS1="(chroot) ${PS1}"; +} + +function ConfiguringPortage() { + emerge-webrsync; + emerge --sync; + emerge --ask app-portage/cpuid2cpuflags; + echo "*/* $(cpuid2cpuflags)" > /etc/portage/package.use/00cpu-flags +} + +function TimeZone() { + echo "Europe/Berlin" > /etc/timezone; + emerge --config timezone-data; +} + +function locale() { + echo "en_US ISO-8859-1" > /etc/locale.gen; + echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen; + echo "de_DE ISO-8859-1" >> /etc/locale.gen; + echo "de_DE.UTF-8 UTF-8" >> /etc/locale.gen; + locale-gen; + eselect locale set 9; + env-update; + source /etc/profile; + export PS1="(chroot) ${PS1}"; +} + +function kernel() { + emerge -a sys-kernel/linux-firmware sys-kernel/gentoo-sources sys-apps/pciutils sys-kernel/gentoo-kernel-bin; +} + +function hostname() { + echo "# Set the hostname variable to set the selected host name" > /etc/conf.d/hostname; + echo "hostname=$(hostname)"; +} + +function installDhcpcd() { + emerge --ask net-misc/dhcpcd; + rc-update add dhcpcd default; +} + +function setRootPassword() { + passwd; +} + +function systemLogger() { + emerge -a app-admin/sysklogd; + rc-update add sysklogd default; +} + +function timeSynchronization() { + emerge --ask net-misc/chrony; + rc-update add chronyd default; +} + +function FileSystemTools() { + emerge -a sys-fs/e2fsprogs sys-fs/dosfstools; +} + +function bootloader() { + echo 'GRUB_PLATFORMS="efi-64"' >> /etc/portage/make.conf; + emerge --ask sys-boot/grub; + grub-install --target=x86_64-efi --efi-directory=/boot; + grub-mkconfig -o /boot/grub/grub.cfg; +} \ No newline at end of file diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..d39486e --- /dev/null +++ b/install.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash + + + +function env() { + bootdisk="/dev/sda1"; + swapdisk="/dev/sda2"; + rootdisk="/dev/sda3"; + rootmountdir="/mnt/gentoo" + bootmountdir="$rootmountdir/boot"; + server="https://ftp.fau.de"; + gentooserverdir="/gentoo/releases/amd64/autobuilds/current-stage3-amd64-desktop-openrc"; + stage3="stage3-amd64-desktop-openrc-20221120T170155Z.tar.xz"; +} + +function mountRootDisk() { + # Mount Root Disk + mkdir $rootmountdir; + mkfs.ext4 $rootdisk; + mount $rootdisk $rootmountdir; +} + +function mountBootDisk() { + # Mount Boot Disk + mkdir $bootmountdir; + mkfs.fat -F 32 $bootdisk; + mount $bootdisk $bootmountdir; +} + +function enableSwap() { + # Create and enable swap + mkswap $swapdisk; + swapon $swapdisk; +} + +function Stage3() { + wget $server$gentooserverdir$stage3 -O $rootmountdir; + tar xpvf $stage3 --xattrs-include='*.*' --numeric-owner --directory=$rootmountdir +} + +function GentooEbuildRepo() { + mkdir --parents $rootmountdir/etc/portage/repos.conf + cp $rootmountdir/usr/share/portage/config/repos.conf $rootmountdir/etc/portage/repos.conf/gentoo.conf +} + +function copyDNS() { + copy --dereference /etc/resolv.conf $rootmountdir/etc +} + +function mountNecessaryFilesystem() { + 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 +} + +function writeStartupScriptToRoot() { + cp chroot.sh $rootmountdir/root + cp bashrc $rootmountdir/root + chroot /mnt/gentoo /bin/bash +} \ No newline at end of file diff --git a/make.conf b/make.conf new file mode 100644 index 0000000..40683ca --- /dev/null +++ b/make.conf @@ -0,0 +1,19 @@ +# 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. +CFLAGS="-march=native -O2 -pipe" +CXXFLAGS="${CFLAGS}" +# WARNING: Changing your CHOST is not something that should be done lightly. +# Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing. +CHOST="x86_64-pc-linux-gnu" +# These are the USE flags that were used in addition to what is provided by the +# profile used for building. +USE="bindist mmx sse sse2" +PORTDIR="/usr/portage" +DISTDIR="${PORTDIR}/distfiles" +PKGDIR="${PORTDIR}/packages" + +MAKEOPTS="-j$(nproc)" +USE="X acl alsa pulseaudio -gtk -gnome -qt5 -kde -dvd" +ACCEPT_LICENSE="*" \ No newline at end of file