From 54f7b0f322ce0452c00f7b3a0c1ecca44e887a31 Mon Sep 17 00:00:00 2001 From: oddlama Date: Fri, 3 Jan 2020 23:48:49 +0100 Subject: [PATCH] Added timezone and locale settings --- README.md | 5 +++++ scripts/config.sh | 22 ++++++++++++++++++++++ scripts/functions.sh | 7 ++++++- scripts/main.sh | 24 ++++++++++++++++++++++-- 4 files changed, 55 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1f4a45f..676ecba 100644 --- a/README.md +++ b/README.md @@ -51,3 +51,8 @@ It will do the following steps for you: * Generate an ssh keypair (type configurable) * Setup a secure sshd (safe ciphers, login only with keypair) * Install ansible + +# References + +* [Sakaki's EFI Install Guide](https://wiki.gentoo.org/wiki/Sakaki%27s_EFI_Install_Guide) +* [Gentoo AMD64 Handbook](https://wiki.gentoo.org/wiki/Handbook:AMD64) diff --git a/scripts/config.sh b/scripts/config.sh index 425155d..550e886 100644 --- a/scripts/config.sh +++ b/scripts/config.sh @@ -42,3 +42,25 @@ GENTOO_MIRROR="https://mirror.eu.oneandone.net/linux/distributions/gentoo/gentoo # The stage3 tarball to install STAGE3_BASENAME="stage3-amd64-hardened+nomultilib" #STAGE3_BASENAME="stage3-amd64-hardened-selinux+nomultilib" + +# The timezone for the new system +TIMEZONE="Europe/Berlin" + +# A list of additional locales to generate. You should only +# add locales here if you really need them and want to localize +# your system. Otherwise, leave this list empty, and use C.utf8. +LOCALES="" +# The locale to set for the system. Be careful, this setting differs +# from the LOCALES list entries. (e.g. .UTF-8 vs .utf8) +LOCALE="C.utf8" +# For a german system you could use: +# LOCALES=" +# de_DE.UTF-8 UTF-8 +# de_DE ISO-8859-1 +# de_DE@euro ISO-8859-15 +# " # End of LOCALES +# LOCALE="de_DE.utf8" + +# The default keymap for the system +KEYMAP="de-latin1-nodeadkeys" +#KEYMAP="us" diff --git a/scripts/functions.sh b/scripts/functions.sh index 248dae3..5342c88 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -277,7 +277,12 @@ gentoo_umount() { fi } -interactive_bash() { +env_update() { + env-update \ + || die "Error in env-update" + source /etc/profile \ + || die "Could not source /etc/profile" + export PS1="(chroot) \$PS1" } gentoo_chroot() { diff --git a/scripts/main.sh b/scripts/main.sh index 5cd5496..6a23152 100755 --- a/scripts/main.sh +++ b/scripts/main.sh @@ -54,17 +54,37 @@ main_install_gentoo_in_chroot() { einfo "Selecting portage mirrors" # TODO mirrorselect + # TODO custom gentoo.conf for /var/db/repos ??? # TODO gpg portage sync # TODO additional binary repos # TODO safe dns settings (claranet) + # Mount efi partition einfo "Mounting efi" mount_by_partuuid "$PARTITION_UUID_EFI" "/boot/efi" + # Sync portage einfo "Syncing portage tree" - emerge-webrsync + emerge-webrsync\ + || die "Failed to sync portage tree" - einfo "Selecting portage profile '$'" + # Set timezone + einfo "Selecting timezone" + echo "$TIMEZONE" > /etc/timezone \ + || die "Could not write /etc/timezone" + emerge -v --config sys-libs/timezone-data + + # Set locale + einfo "Selecting locale" + echo "$LOCALES" > /etc/locale.gen \ + || die "Could not write /etc/locale.gen" + locale-gen \ + || die "Could not generate locales" + eselect locale set "$LOCALE" \ + || die "Could not select locale" + + # Update environment + env_update #get kernel