.PHONY: get test
-all: get
+RUN_MODE := $(shell . functions/version && check_hvlinux_version)
-# Fetch packages from network
-get:
- @for k in $$(seq 0 5); do \
- make -C stage$${k} $(MAKECMDGOALS); \
- done
+ifeq ($(RUN_MODE),HOST)
+ STAGES := "0 1"
+else ifeq ($(RUN_MODE),NATIVE)
+ STAGES := "2 3 4 5"
+else
+ $(error Unable to determine run mode.)
+endif
-# Test integrity of packages
-test:
- @for k in $$(seq 0 6); do \
+ifeq ($(MAKECMDGOALS),get)
+ STAGES := $(shell seq 0 5)
+endif
+ifeq ($(MAKECMDGOALS),test)
+ STAGES := $(shell seq 0 5)
+endif
+
+all:
+ @echo "Stages: $(STAGES)"
+ @for k in $(STAGES); do \
make -C stage$${k} $(MAKECMDGOALS); \
done
+
+$(MAKECMDGOALS): all
# Load functions
source ../functions/fpkg
source ../functions/lpkg
+source ../functions/version
# Constants for return codes
EXIT_SUCCESS=0
return ${EXIT_FAILURE}
fi
-if [ "x${LFS_STAGE}" != "xstage0" -a "x${LFS_STAGE}" != "xstage1" ] ;then
+if [ "x${LFS_STAGE}" != "xstage0" -a "x${LFS_STAGE}" != "xstage1" ]; then
LFS=""
fi
exit ${EXIT_FAILURE}
fi
- # Checking if script is valid and executable
- if [ ! -x ${SCRDIR}/${SCRIPT} ]; then
+ # Checking if script file is found
+ if [ ! -f ${SCRDIR}/${SCRIPT} ]; then
echo "${FUNCNAME}(): script not found: ${SCRIPT}"
exit ${EXIT_FAILURE}
fi
+ # ... and make sure it is executable
+ if [ ! -x ${SCRDIR}/${SCRIPT} ]; then
+ echo "${FUNCNAME}(): execute bit not set: ${SCRIPT}"
+ exit ${EXIT_FAILURE}
+ fi
PACKAGE_LOG=${LFS_LOG_DIR}/${HVLABEL}.log
--- /dev/null
+#!/bin/sh
+# Running this script as 'sh' for Make
+
+CFG_DIR="config"
+HV_VER_FILE="hvlinux-version"
+
+check_hvlinux_version()
+{
+ # Default value, assume we run on the host.
+ export HVLINUX_RUN_MODE="host"
+
+ if [ -f ${CFG_DIR}/${HV_VER_FILE} ]; then
+ . ${CFG_DIR}/${HV_VER_FILE}
+
+ # Compare local UUID to the one in /etc to determine if we run on the
+ # host or on the newly-built HVLinux system.
+ if [ -f /etc/${HV_VER_FILE} ]; then
+ # Save value
+ HVUUID_LOCAL=${HVUUID}
+
+ . /etc/${HV_VER_FILE}
+
+ if [ "x${HVUUID_LOCAL}" = "x${HVUUID}" ]; then
+ HVLINUX_RUN_MODE="native"
+ else
+ # Restore value in case of mismatch
+ HVUUID=${HVUUID_LOCAL}
+ fi
+ fi
+ fi
+
+ if [ "x${HVLINUX_RUN_MODE}" = "xnative" ]; then
+ #echo "Running in NATIVE mode (stage >= 2)"
+ echo "NATIVE"
+ else
+ #echo "Running in HOST mode (stage 0 or 1)"
+ echo "HOST"
+ fi
+}
--- /dev/null
+#!/bin/bash
+
+source ../functions/main
+
+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 [ ! -x /usr/bin/uuidgen ]; then
+ echo "Error, missing /usr/bin/uuidgen program"
+ exit 1
+ fi
+
+ cat > ${CFG_DIR}/${HV_VER_FILE} <<EOF
+# Do not edit this file.
+# This file is autogenerated by the HVLinux build system
+EOF
+
+ echo "HVUUID=$(uuidgen)" >> ${CFG_DIR}/${HV_VER_FILE}
+
+ # Copy local file to destination LFS partition
+ mkdir -pv ${LFS}/etc
+ cp ${CFG_DIR}/${HV_VER_FILE} ${LFS}/etc
+}
+
+create_hvlinux_version
init_log_file
rscr mult "Performing pre-install" pre-install
+rscr mult "Creating HVLinux version file" create-version
# Logging-in as 'lfs' user, and executing the hv-install-2 script. The
# 'su -' command starts with a clean environment and enters the home
--- /dev/null
+#!/bin/bash
+
+# When cross-compiling configure cannot properly detect the existence of
+# certain features:
+hvconfig_cache()
+{
+cat > ${LFS_TMP}/${PACKAGE}-build/config.cache << EOF
+ac_cv_func_strnlen_working=yes
+EOF
+}