From d0406e3d6f1151a689207d154f7de6fdd61a4715 Mon Sep 17 00:00:00 2001 From: gobo72 Date: Sun, 13 Mar 2011 14:30:51 +0000 Subject: [PATCH] =?utf8?q?-Ajout=C3=A9=20fichier=20=C3=A0=20chaque=20stage?= =?utf8?q?=20pour=20indiquer=20qu'il=20est=20compl=C3=A9t=C3=A9.=20-R?= =?utf8?q?=C3=A9gl=C3=A9=20probl=C3=A8mes=20avec=20Makefile=20pour=20les?= =?utf8?q?=20stages?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Makefile | 5 ++--- functions/main | 21 +++++++++++++++++++++ stage0/create-version | 21 +++++++++------------ stage0/hv-install-1 | 6 +++++- stage1/hv-install-1 | 7 +++++-- stage1/post-install | 2 ++ stage2/hv-install-2 | 2 ++ stage3/hv-install-1 | 3 ++- stage4/hv-install-1 | 3 +++ stage5/hv-install-1 | 3 +++ stage6/hv-install-1 | 3 +++ 11 files changed, 57 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 2b3202b..933338d 100644 --- a/Makefile +++ b/Makefile @@ -12,9 +12,9 @@ RUN_MODE := $(shell . functions/version && check_hvlinux_version) ifeq ($(RUN_MODE),HOST) - STAGES := "0 1" + STAGES := 0 1 else ifeq ($(RUN_MODE),NATIVE) - STAGES := "2 3 4 5" + STAGES := 2 3 4 5 else $(error Unable to determine run mode.) endif @@ -27,7 +27,6 @@ ifeq ($(MAKECMDGOALS),test) endif all: - @echo "Stages: $(STAGES)" @for k in $(STAGES); do \ make -C stage$${k} $(MAKECMDGOALS); \ done diff --git a/functions/main b/functions/main index 76aa3a0..e0bd99e 100644 --- a/functions/main +++ b/functions/main @@ -1161,3 +1161,24 @@ print_status() echo } + +# This function will exit if the stage is already completed +check_completed_stage() +{ + if [ -f ${LFS_LOG_DIR}/stage-completed ]; then + echo "${LFS_STAGE} completed" + exit 0 + else + return 0 + fi +} + +write_completed_stage() +{ + touch ${LFS_LOG_DIR}/stage-completed +} + +display_stage_build_stats() +{ + echo "Total build time: $(get_total_build_time ${LFS_LOG_FILE})h" +} diff --git a/stage0/create-version b/stage0/create-version index 527e7ba..6ebbff1 100644 --- a/stage0/create-version +++ b/stage0/create-version @@ -6,24 +6,21 @@ create_hvlinux_version() { local CFG_DIR="../config" - if [ -f ${CFG_DIR}/${HV_VER_FILE} ]; then - echo "Version file already created" - return 0 - fi - - echo "Create new hvlinux-version file" + if [ ! -f ${CFG_DIR}/${HV_VER_FILE} ]; then + echo "Create new hvlinux-version file" - if [ ! -x /usr/bin/uuidgen ]; then - echo "Error, missing /usr/bin/uuidgen program" - exit 1 - fi + if [ ! -x /usr/bin/uuidgen ]; then + echo "Error, missing /usr/bin/uuidgen program" + exit 1 + fi - cat > ${CFG_DIR}/${HV_VER_FILE} < ${CFG_DIR}/${HV_VER_FILE} <> ${CFG_DIR}/${HV_VER_FILE} + echo "HVUUID=$(uuidgen)" >> ${CFG_DIR}/${HV_VER_FILE} + fi # Copy local file to destination LFS partition mkdir -pv ${LFS}/etc diff --git a/stage0/hv-install-1 b/stage0/hv-install-1 index 8b69a4a..72fb50b 100755 --- a/stage0/hv-install-1 +++ b/stage0/hv-install-1 @@ -4,6 +4,9 @@ source ../functions/main init_log_file +# This function will exit if the stage is already completed +check_completed_stage + rscr mult "Performing pre-install" pre-install rscr mult "Creating HVLinux version file" create-version @@ -12,6 +15,7 @@ rscr mult "Creating HVLinux version file" create-version # directory of the user. su - lfs -c "cd ${PWD}; ./hv-install-2" -echo "Total build time: $(get_total_build_time ${LFS_LOG_FILE})h" +write_completed_stage +display_stage_build_stats exit 0 diff --git a/stage1/hv-install-1 b/stage1/hv-install-1 index a33015d..0fe2837 100755 --- a/stage1/hv-install-1 +++ b/stage1/hv-install-1 @@ -4,6 +4,9 @@ source ../functions/main init_log_file +# This function will exit if the stage is already completed +check_completed_stage + rscr mult "Performing pre-install" pre-install # Logging-in as 'lfs' user, and executing the hv-install-2 script. The @@ -12,7 +15,7 @@ rscr mult "Performing pre-install" pre-install su - lfs -c "cd ${PWD}; ./hv-install-2" rscr mult "Performing post-install" post-install - -echo "Total build time: $(get_total_build_time ${LFS_LOG_FILE})h" +write_completed_stage +display_stage_build_stats exit 0 diff --git a/stage1/post-install b/stage1/post-install index 5f4755b..e9c8eaa 100755 --- a/stage1/post-install +++ b/stage1/post-install @@ -45,4 +45,6 @@ fi # Change the ownership for ${LFS} and its subdirectories chown -Rv root:root ${LFS} +write_completed_stage + exit $? diff --git a/stage2/hv-install-2 b/stage2/hv-install-2 index 857afa3..1a78e4c 100755 --- a/stage2/hv-install-2 +++ b/stage2/hv-install-2 @@ -68,4 +68,6 @@ echo "Stage2 successfully completed." echo "You must now compile a new kernel (go to /usr/src/linux)." echo "After that, you can reboot and try your new system." +write_completed_stage + exec /bin/bash --login diff --git a/stage3/hv-install-1 b/stage3/hv-install-1 index f26a298..a1837be 100755 --- a/stage3/hv-install-1 +++ b/stage3/hv-install-1 @@ -119,6 +119,7 @@ ipkg -m noac ${LIBMNG} ipkg ${FREETYPE} ipkg ${FONTCONFIG} -echo "Total build time: $(get_total_build_time ${LFS_LOG_FILE})h" +write_completed_stage +display_stage_build_stats exit $? diff --git a/stage4/hv-install-1 b/stage4/hv-install-1 index 37297bd..9ed64fd 100755 --- a/stage4/hv-install-1 +++ b/stage4/hv-install-1 @@ -119,4 +119,7 @@ ipkg ${PYTHON} "--enable-shared" ipkg -m acnb ${WINDOWMAKER} ipkg ${WINDOWMAKER_EXTRA} +write_completed_stage +display_stage_build_stats + exit $? diff --git a/stage5/hv-install-1 b/stage5/hv-install-1 index 55940a6..ed9878a 100755 --- a/stage5/hv-install-1 +++ b/stage5/hv-install-1 @@ -243,4 +243,7 @@ ipkg ${GEDA_GATTRIB} rscr mult "Performing post-install" cis-post-install +write_completed_stage +display_stage_build_stats + exit $? diff --git a/stage6/hv-install-1 b/stage6/hv-install-1 index 84e4231..5fbdcda 100755 --- a/stage6/hv-install-1 +++ b/stage6/hv-install-1 @@ -107,4 +107,7 @@ ipkg ${ABIWORD} "--disable-spellcheck" ipkg_gnome ${EVOLUTION} "--with-nss-includes=/usr/include/nss --with-nspr-includes=/usr/include/nspr --with-openldap=yes --with-krb5=/usr" ipkg_gnome ${EVOLUTION_EXCHANGE} +write_completed_stage +display_stage_build_stats + exit $? -- 2.20.1