Added more options to try

This commit is contained in:
oddlama 2020-01-04 13:09:29 +01:00
parent 0d952d5a34
commit 23769585dc
No known key found for this signature in database
GPG Key ID: 88EA325D51D53908
3 changed files with 23 additions and 9 deletions

View File

@ -22,9 +22,16 @@ sync_time() {
|| die "Could not save time to hardware clock" || die "Could not save time to hardware clock"
} }
check_config() {
[[ "$KEYMAP" =~ ^[0-9A-Za-z-]*$ ]] \
|| die "KEYMAP contains invalid characters"
}
prepare_installation_environment() { prepare_installation_environment() {
einfo "Preparing installation environment" einfo "Preparing installation environment"
check_config
check_has_program gpg check_has_program gpg
check_has_program hwclock check_has_program hwclock
check_has_program lsblk check_has_program lsblk

View File

@ -50,7 +50,8 @@ main_install_gentoo_in_chroot() {
# Lock the root password, making the account unaccessible for the # Lock the root password, making the account unaccessible for the
# period of installation, except by chrooting # period of installation, except by chrooting
einfo "Locking root account" einfo "Locking root account"
passwd -l root passwd -l root \
|| die "Could not change root password"
einfo "Selecting portage mirrors" einfo "Selecting portage mirrors"
# TODO mirrorselect # TODO mirrorselect
@ -65,8 +66,7 @@ main_install_gentoo_in_chroot() {
# Sync portage # Sync portage
einfo "Syncing portage tree" einfo "Syncing portage tree"
try emerge-webrsync \ try emerge-webrsync
|| die "Failed to sync portage tree"
# Set timezone # Set timezone
einfo "Selecting timezone" einfo "Selecting timezone"
@ -82,6 +82,11 @@ main_install_gentoo_in_chroot() {
|| die "Could not generate locales" || die "Could not generate locales"
try eselect locale set "$LOCALE" try eselect locale set "$LOCALE"
# Set keymap
einfo "Selecting keymap"
sed -i "/keymap=/c\\$KEYMAP" /etc/conf.d/keymaps \
|| die "Could not sed replace in /etc/conf.d/keymaps"
# Update environment # Update environment
env_update env_update
@ -93,8 +98,7 @@ main_install_gentoo_in_chroot() {
# Install git (for git portage overlays) # Install git (for git portage overlays)
einfo "Installing git" einfo "Installing git"
try emerge --verbose dev-vcs/git \ try emerge --verbose dev-vcs/git
|| die "Error while installing git"
#get kernel #get kernel

View File

@ -59,7 +59,8 @@ ask() {
local response local response
while true; do while true; do
flush_stdin flush_stdin
read -r -p "$* (Y/n) " response read -r -p "$* (Y/n) " response \
|| die "Error in read"
case "${response,,}" in case "${response,,}" in
'') return 0 ;; '') return 0 ;;
y|yes) return 0 ;; y|yes) return 0 ;;
@ -72,7 +73,7 @@ ask() {
try() { try() {
local response local response
local cmd_status local cmd_status
local prompt_parens="(Shell/retry/cancel/print)" local prompt_parens="(Shell/retry/abort/continue/print)"
# Outer loop, allows us to retry the command # Outer loop, allows us to retry the command
while true; do while true; do
@ -87,7 +88,8 @@ try() {
# Prompt until input is valid # Prompt until input is valid
while true; do while true; do
flush_stdin flush_stdin
read -r response read -r response \
|| die "Error in read"
case "${response,,}" in case "${response,,}" in
''|s|shell) ''|s|shell)
echo_console "Hint: The script log is at '$GENTOO_BOOTSTRAP_DIR/log.out'" echo_console "Hint: The script log is at '$GENTOO_BOOTSTRAP_DIR/log.out'"
@ -95,7 +97,8 @@ try() {
/bin/bash --init-file <(echo "disable_logging; source $TMP_DIR/.bashrc") /bin/bash --init-file <(echo "disable_logging; source $TMP_DIR/.bashrc")
;; ;;
r|retry) continue 2 ;; r|retry) continue 2 ;;
c|cancel) die "Installation cancelled" ;; a|abort) die "Installation aborted" ;;
c|continue) return 0 ;;
p|print) echo_console "\$ $*" ;; p|print) echo_console "\$ $*" ;;
*) echo_console -n "Response not understood $prompt_parens " ;; *) echo_console -n "Response not understood $prompt_parens " ;;
esac esac