From 846471086b3c581619eeda5ad706475a1a17ddf9 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Wed, 29 Dec 2010 18:08:49 +0100 Subject: refactor locale, initcpio and initialtime code * remove locale, initcpio and initialtime workers, move logic in new postconfigure_target function * for base and automatic procedures, postconfigure_target() gets called automatically * interactive procedure calls this in interactive_configure_system in the same way it calls preconfigure_target * rename target_run_mkinitcpio to target_run_mkinitcpio, to be consistent with other functions --- doc/official_installation_guide_en | 2 ++ examples/fancy-install-on-sda | 1 + examples/generic-install-on-sda | 1 + src/core/libs/lib-software.sh | 3 +-- src/core/libs/lib-ui-interactive.sh | 14 ++++++++++++++ src/core/procedures/automatic | 2 +- src/core/procedures/base | 21 +-------------------- src/core/procedures/interactive | 5 +---- 8 files changed, 22 insertions(+), 27 deletions(-) diff --git a/doc/official_installation_guide_en b/doc/official_installation_guide_en index 5d4c0e7..b2200ef 100644 --- a/doc/official_installation_guide_en +++ b/doc/official_installation_guide_en @@ -479,6 +479,8 @@ Configure System does multiple things: * preseed some configuration files after you agreed. (eg network settings) * allow you to manually change important config files for your target system. * allow you to set the root password for the target. +* automatically run some tools which use the updated configuration (locales, + mkinitcpio, time settings, etc) **Configuration Files** diff --git a/examples/fancy-install-on-sda b/examples/fancy-install-on-sda index ec920d4..0e6934d 100644 --- a/examples/fancy-install-on-sda +++ b/examples/fancy-install-on-sda @@ -21,6 +21,7 @@ worker_intro () { worker_configure_system () { preconfigure_target sed -i 's/^HOSTNAME="myhost"/HOSTNAME="arch-fancy-install"/' $var_TARGET_DIR/etc/rc.conf + postconfigure_target } # These variables are mandatory diff --git a/examples/generic-install-on-sda b/examples/generic-install-on-sda index a5b9a2e..7892644 100644 --- a/examples/generic-install-on-sda +++ b/examples/generic-install-on-sda @@ -27,6 +27,7 @@ worker_intro () { worker_configure_system () { preconfigure_target sed -i 's/^HOSTNAME="myhost"/HOSTNAME="arch-generic-install"/' $var_TARGET_DIR/etc/rc.conf + postconfigure_target } diff --git a/src/core/libs/lib-software.sh b/src/core/libs/lib-software.sh index 3aee2f7..4e32a63 100644 --- a/src/core/libs/lib-software.sh +++ b/src/core/libs/lib-software.sh @@ -3,9 +3,8 @@ TMP_MKINITCPIO_LOG=$LOG_DIR/mkinitcpio.log TMP_PACMAN_LOG=$LOG_DIR/pacman.log -# run_mkinitcpio() taken from setup. adapted a lot # runs mkinitcpio on the target system, displays output -run_mkinitcpio() +target_run_mkinitcpio() { target_special_fs on diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh index f73c5b8..2aea25b 100644 --- a/src/core/libs/lib-ui-interactive.sh +++ b/src/core/libs/lib-ui-interactive.sh @@ -80,6 +80,14 @@ preconfigure_target () { # TODO: we should probably update /etc/crypttab if the user has non-/ encrypted disks. } +# do some target configuration steps automatically, after user decided he configured his system. +# as usual, this function is okay with being called multiple times +postconfigure_target () { + target_run_mkinitcpio || return $? + target_locale-gen || return $? + cp /etc/localtime ${var_TARGET_DIR}/etc/localtime || return $? +} + interactive_configure_system() { seteditor || return 1 @@ -139,6 +147,12 @@ interactive_configure_system() # temporary backup files are not useful anymore past this point. find "${var_TARGET_DIR}/etc/" -name '*~' -delete &>/dev/null + if ! postconfigure_target + then + show_warning "Postconfigure failed" "Beware: I just tried to automatically configure some stuff, but something failed. Please report this. Continue at your own risk" + ask_yesno "Do you want to continue?" no || return 1 + fi + return 0 } diff --git a/src/core/procedures/automatic b/src/core/procedures/automatic index a61468a..ba533fa 100644 --- a/src/core/procedures/automatic +++ b/src/core/procedures/automatic @@ -6,7 +6,7 @@ # It should be: # phase_preparation=(configure intro sysprep select_source runtime_network runtime_repositories runtime_packages) # phase_basics=(set_clock prepare_disks) -# phase_system=(package_list install_packages configure_system mkinitcpio locales install_bootloader) +# phase_system=(package_list install_packages configure_system install_bootloader) # phase_finish=(msg_report) # In theory, the only manual thing should maybe be configuring the runtime network and putting the configfile in place diff --git a/src/core/procedures/base b/src/core/procedures/base index e2d470d..68a91ee 100644 --- a/src/core/procedures/base +++ b/src/core/procedures/base @@ -29,8 +29,6 @@ phase_system=(\ package_list \ install_packages \ configure_system \ - mkinitcpio \ - locales \ install_bootloader) phase_finish=(msg_report) @@ -158,24 +156,7 @@ worker_auto_network () worker_configure_system () { preconfigure_target -} - - -worker_mkinitcpio () -{ - run_mkinitcpio -} - - -worker_locales () -{ - target_locale-gen -} - - -worker_initialtime () -{ - cp /etc/localtime ${var_TARGET_DIR}/etc/localtime + postconfigure_target } diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive index 77e17a4..bac495c 100644 --- a/src/core/procedures/interactive +++ b/src/core/procedures/interactive @@ -74,10 +74,7 @@ mainmenu() check_depend worker package_list && \ check_depend worker select_source && execute worker install_packages && default=7 ;; "7") - check_depend worker install_packages && execute worker configure_system && { execute worker mkinitcpio ; \ - execute worker locales ; - execute worker initialtime ; - true ; } && default=8 ;; + check_depend worker install_packages && execute worker configure_system && default=8 ;; "8") check_depend worker configure_system && execute worker install_bootloader && default=9 ;; "9") -- cgit v1.2.3-54-g00ecf