From: gobo72 Date: Fri, 5 Nov 2010 02:04:19 +0000 (+0000) Subject: -Removed all ipkg_* functions and replaced them with a single ipkg function accepting... X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=b5bfb2006502b57fab234345a2393fd04e6d55ad;p=hvlinux.git -Removed all ipkg_* functions and replaced them with a single ipkg function accepting getopt arguments. --- diff --git a/functions b/functions index 53747fd..9c863ea 100644 --- a/functions +++ b/functions @@ -696,48 +696,97 @@ decompress_package() } # Installation of a package -# -# First argument: Real package name -# Second argument: Installation script name -# Third argument: Unique identification label in 'install.log' +# Arg. #1: Package name and version (ex: gcc-4.5.1) # Remaining arguments: Additional configure options +# Options: +# -h Display this help and returns +# -l Unique identification label in 'install.log' +# (default is package name and version) +# -m Installation mode: +# ac Standard autoconf package, build in separate dir +# acnb Standard autoconf package, building in source dir +# nb No autoconf (configure) +# gnome +# xorg +# pm +# -s Name of script to execute (default is ipkg.sh) ipkg() { START_TIME=$(echo `date +%s`) + + export IPKG_MODE="ac" + export HVLABEL="" # Global variable + local SCRIPT=./ipkg.sh + + while getopts "hl:m:" flag ;do + case ${flag} in + l) + # Alternate label + HVLABEL=${OPTARG} + ;; + m) + # Installation mode + case ${OPTARG} in + ac|acnb|noac|gnome|xorg|pm) + IPKG_MODE=${OPTARG} + ;; + *) + echo "${FUNCNAME}(): Unsupported mode: ${OPTARG}." + return 1 + ;; + esac + ;; + s) + # Alternate script name + SCRIPT=${OPTARG} + ;; + ?) + echo "${FUNCNAME}(): Invalid option: ${OPTARG}." + return 1 + ;; + esac + done + shift `expr "${OPTIND}" - 1` + + unset OPTSTRING + unset OPTIND + unset OPTARG + local PACKAGE_NAME=${1} - local SCRIPT=./${2} - local LABEL=${3} - + # Checking for correct number of arguments - if [ $# -lt 3 ]; then + if [ $# -lt 1 ]; then echo echo "${FUNCNAME}(): Missing argument" echo " command was: \"${FUNCNAME}() $*\"" exit ${EXIT_FAILURE} fi - shift - shift shift local CONFIGURE_OPTS=${*} + if [ -z "${HVLABEL}" ]; then + # Default label = package name and version + HVLABEL=${PACKAGE_NAME} + fi + # Checking if script is valid and executable if [ ! -x ${SCRIPT} ]; then echo - echo "${FUNCNAME}(): script not found: ${SCRIPT}" + echo "${FUNCNAME}(): cannot execute script: ${SCRIPT}" exit ${EXIT_FAILURE} fi - PACKAGE_LOG=${LFS_LOG_DIR}/${LABEL}.log + PACKAGE_LOG=${LFS_LOG_DIR}/${HVLABEL}.log # Checking if package was previously successfully installed - if grep "^${LABEL} successfully installed" ${LFS_LOG_FILE} \ + if grep "^${HVLABEL} successfully installed" ${LFS_LOG_FILE} \ 1> /dev/null 2>&1; then return $EXIT_SUCCESS fi # Displaying label - MSGSTRING="Installing ${LABEL}" + MSGSTRING="Installing ${HVLABEL}" display_checkbox_msg ${MSGSTRING} echo "------------------------" 1>> ${LFS_LOG_FILE} @@ -793,7 +842,7 @@ ipkg() fi # Writing success string to the end of the log file - echo "${LABEL} successfully installed" 1>> ${LFS_LOG_FILE} + echo "${HVLABEL} successfully installed" 1>> ${LFS_LOG_FILE} # Displaying build time after the package name print_status success @@ -801,110 +850,6 @@ ipkg() return $EXIT_SUCCESS } -# Installation of a package, removing source and build directories after. -# Try to merge this function with static_ipkg()??? -# -# First argument: package name -# Second argument: script name -# Remaining arguments: additional configure options -ipkg_cust() -{ - # Checking for correct number of arguments - if [ $# -lt 2 ]; then - echo - echo "${FUNCNAME}(): Wrong number of arguments" - echo " command was: \"${FUNCNAME}() $*\"" - exit ${EXIT_FAILURE} - fi - - local PACKAGE=${1} - local LABEL=${PACKAGE} - local CUSTOM_SCRIPT=${2} - shift - shift - local CONFIGURE_OPTS=${*} - - ipkg ${PACKAGE} ${CUSTOM_SCRIPT} ${LABEL} ${CONFIGURE_OPTS} -} - -# Static function called by: -# ipkg_ac -# ipkg_ac_nb -# ipkg_gnome -# -# First argument: script name -# Second argument: package name -# Remaining arguments: additional configure options -static_ipkg() -{ - # Checking for correct number of arguments - if [ $# -lt 2 ]; then - echo - echo "${FUNCNAME}(): Wrong number of arguments" - echo " command was: \"${FUNCNAME}() $*\"" - exit ${EXIT_FAILURE} - fi - - local SCRIPT=${1} - local PACKAGE=${2} - local LABEL=${PACKAGE} - shift - shift - local CONFIGURE_OPTS=${*} - - ipkg ${PACKAGE} ${SCRIPT} ${LABEL} ${CONFIGURE_OPTS} -} - - -# Installation of a package conforming to GNU autotools. -# The package must be able to be built outside the -# source directory. -# -# First argument: package name -# Remaining arguments: additional configure options -ipkg_ac() -{ - static_ipkg cis-ac ${*} -} - -# Installation of a package conforming to GNU autotools, -# but that must be built inside the source directory. -# -# First argument: package name -# Remaining arguments: additional configure options -ipkg_ac_nb() -{ - static_ipkg cis-ac-nobuild ${*} -} - -# Installation of a GNOME package. -# -# First argument: package name -# Remaining arguments: additional configure options -ipkg_gnome() -{ - static_ipkg cis-gnome ${*} -} - -# Installation of a PERL module -# -# First argument: package name -ipkg_pm() -{ - # Checking for correct number of arguments - if [ $# -ne 1 ]; then - echo - echo "${FUNCNAME}(): Wrong number of arguments" - echo " command was: \"${FUNCNAME}() $*\"" - exit ${EXIT_FAILURE} - fi - - local PACKAGE=${1} - local LABEL=${PACKAGE} - - ipkg ${PACKAGE} cis-pm ${LABEL} -} - # Run command, no log # First argument: Message to display during script # Second argument: command + arguments @@ -964,7 +909,7 @@ rscr() SCRMODE=${1} MSGSTRING=${2} SCRIPT=${3} - LABEL=${SCRIPT} + HVLABEL=${SCRIPT} shift shift SCRIPT_ARGS=${*} @@ -981,18 +926,18 @@ rscr() exit ${EXIT_FAILURE} fi - PACKAGE_LOG=${LFS_LOG_DIR}/${LABEL}.log + PACKAGE_LOG=${LFS_LOG_DIR}/${HVLABEL}.log if [ "x${SCRMODE}" = "xonce" ]; then # Checking if package was previously successfully installed - if grep "^${LABEL} successfully installed" ${LFS_LOG_FILE} 1> /dev/null 2>&1; then + if grep "^${HVLABEL} successfully installed" ${LFS_LOG_FILE} 1> /dev/null 2>&1; then return $EXIT_SUCCESS fi fi display_checkbox_msg ${MSGSTRING} echo "------------------------" 1>> ${LFS_LOG_FILE} - echo ${LABEL} 1>> ${LFS_LOG_FILE} + echo ${HVLABEL} 1>> ${LFS_LOG_FILE} # Executing script ./${SCRIPT} ${SCRIPT_ARGS} 1>> ${PACKAGE_LOG} 2>&1 @@ -1000,7 +945,7 @@ rscr() if [ "x${SCRMODE}" = "xonce" ]; then # Writing success string to the end of the log file - echo "${LABEL} successfully installed" 1>> ${LFS_LOG_FILE} + echo "${HVLABEL} successfully installed" 1>> ${LFS_LOG_FILE} fi # Displaying build time after the package name diff --git a/stage0/cis-ac b/stage0/cis-ac deleted file mode 100755 index dd5186c..0000000 --- a/stage0/cis-ac +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/bash -set -o errexit - -# First argument of this script is the package name. -# Remaining arguments are additional configure options. - -PACKAGE=${1} -shift -CONFIGURE_OPTS=${*} - -# Reading system configuration informations, functions and package versions. -source ${SCRDIR}/../sysinfos -source ${SCRDIR}/../functions -source ${SCRDIR}/../packages-list - -# Setting default configure options for all scripts -CONFIGURE_OPTS="\ - --prefix=/cross-tools \ - ${CONFIGURE_OPTS}" - -# Default configure function -hvconfig() -{ - cd ${LFS_TMP}/${PACKAGE}-build - - echo "Running configure with options:" - echo " <${CONFIGURE_OPTS}>" - - ../${PACKAGE}/configure ${CONFIGURE_OPTS} -} - -# Default build function -hvbuild() -{ - ${HVMAKE} - ${HVMAKE} install -} - -hvpatch() -{ - # Applying patches (if any) - apply_patches ${PACKAGE} -} - -PACKAGE_DEF=${SCRDIR}/pkg/$(get_pkg_name ${PACKAGE}) - -if [ -f ${PACKAGE_DEF} ]; then - echo "Load custom package functions and definitions" - source ${PACKAGE_DEF} -fi - -hvpatch - -# Execute config-cache function if applicable -if function_exists hvconfig_cache ; then - echo "Running configure cache script" - hvconfig_cache - - CONFIGURE_OPTS="${CONFIGURE_OPTS} --cache-file=${LFS_TMP}/${PACKAGE}-build/config.cache" -fi - -# Execute pre-configure function if applicable -if function_exists hvconfig_pre ; then - echo "Running configure pre-script" - hvconfig_pre -fi - -if [ -n "${HV_NO_CONFIGURE_SCRIPT}" ]; then - echo "Not calling configure because ${PACKAGE} has no configure script" -else - hvconfig -fi - -# Execute post-configure function if applicable -if function_exists hvconfig_post ; then - echo "Running configure post-script" - hvconfig_post -fi - -hvbuild - -# Execute post-build function if applicable -if function_exists hvbuild_post ; then - echo "Running build post-script" - hvbuild_post -fi - -exit $? diff --git a/stage0/install-1 b/stage0/install-1 index 786c754..749d949 100755 --- a/stage0/install-1 +++ b/stage0/install-1 @@ -1,9 +1,20 @@ #!/bin/bash -source ~/.bashrc - LFS_STAGE=stage0 +# Let shell functions inherit ERR trap. Same as `set -E'. +set -o errtrace + +# Setting ERR trap does implicit `set -o errexit'. +trap myerr ERR + +function myerr() +{ + echo + echo "*** An error occured during ${LFS_STAGE}" + exit 1 +} + # Reading system configuration informations, functions and package versions. source ../sysinfos source ../functions @@ -14,50 +25,14 @@ export LFS_LOG_DIR=${LFS}/var/log/hvlinux-install/${LFS_STAGE} export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log export LFS_TMP="${LFS}/tmp" -init_log_file - -# Scripts directory -export SCRDIR=$(pwd) - -ipkg_ac ${KERNEL} - -case "${HVL_TARGET}" in - x86*) - ipkg_ac ${FILE_PKG} - ipkg_ac ${NCURSES} "\ - --without-debug \ - --without-shared" - ;; -esac - -CPPFLAGS=-fexceptions \ - ipkg_ac ${GMP} "--enable-cxx" - -export LDFLAGS="-Wl,-rpath,/cross-tools/lib" - -ipkg_ac ${MPFR} "\ - --enable-shared \ - --with-gmp=/cross-tools" -ipkg_ac ${MPC} "\ - --with-gmp=/cross-tools \ - --with-mpfr=/cross-tools" -ipkg_ac ${PPL} "\ - --enable-shared \ - --enable-interfaces=c,cxx \ - --disable-optimization \ - --with-libgmp-prefix=/cross-tools \ - --with-libgmpxx-prefix=/cross-tools" -ipkg_ac ${CLOOG_PPL} "\ - --enable-shared \ - --with-bits=gmp \ - --with-gmp=/cross-tools \ - --with-ppl=/cross-tools" - -LDFLAGS="" - -ipkg_ac ${BINUTILS} -GCC_PASS1="1" ipkg ${GCC} cis-ac "${GCC}-pass1" -ipkg_ac ${EGLIBC} -GCC_PASS2="1" ipkg ${GCC} cis-ac "${GCC}-pass2" - -exit $? +echo "Performing pre-install" +./pre-install + +# Logging-in as 'lfs' user, and executing the install-2 script. The +# 'su -' command starts with a clean environment and enters the home +# directory of the user. +su - lfs -c "cd ${PWD}; ./install-2" + +echo "Total build time: $(get_total_build_time ${LFS_LOG_FILE})h" + +exit 0 diff --git a/stage0/install-2 b/stage0/install-2 new file mode 100755 index 0000000..75e54f0 --- /dev/null +++ b/stage0/install-2 @@ -0,0 +1,61 @@ +#!/bin/bash + +source ~/.bashrc + +LFS_STAGE=stage0 + +# Reading system configuration informations, functions and package versions. +source ../sysinfos +source ../functions +source ../packages-list + +export LFS_PKG_DIR="$(dirname $(pwd))/packages/${LFS_STAGE}" +export LFS_LOG_DIR=${LFS}/var/log/hvlinux-install/${LFS_STAGE} +export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log +export LFS_TMP="${LFS}/tmp" + +init_log_file + +# Scripts directory +export SCRDIR=$(pwd) + +ipkg -m noac ${KERNEL} + +case "${HVL_TARGET}" in + x86*) + ipkg ${FILE_PKG} + ipkg ${NCURSES} + ;; +esac + +CPPFLAGS=-fexceptions \ + ipkg ${GMP} "--enable-cxx" + +export LDFLAGS="-Wl,-rpath,/cross-tools/lib" + +ipkg ${MPFR} "\ + --enable-shared \ + --with-gmp=/cross-tools" +ipkg ${MPC} "\ + --with-gmp=/cross-tools \ + --with-mpfr=/cross-tools" +ipkg ${PPL} "\ + --enable-shared \ + --enable-interfaces=c,cxx \ + --disable-optimization \ + --with-libgmp-prefix=/cross-tools \ + --with-libgmpxx-prefix=/cross-tools" +ipkg ${CLOOG_PPL} "\ + --enable-shared \ + --with-bits=gmp \ + --with-gmp=/cross-tools \ + --with-ppl=/cross-tools" + +LDFLAGS="" + +ipkg ${BINUTILS} +ipkg -l "${GCC}-pass1" ${GCC} +ipkg ${EGLIBC} +ipkg -l "${GCC}-pass2" ${GCC} + +exit $? diff --git a/stage0/ipkg.sh b/stage0/ipkg.sh new file mode 100755 index 0000000..2abb327 --- /dev/null +++ b/stage0/ipkg.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -o errexit + +# First argument of this script is the package name. +# Remaining arguments are additional configure options. + +PACKAGE=${1} +shift +CONFIGURE_OPTS=${*} + +# Reading system configuration informations, functions and package versions. +source ${SCRDIR}/../sysinfos +source ${SCRDIR}/../functions +source ${SCRDIR}/../packages-list + +# Setting default configure options for all scripts +CONFIGURE_OPTS="\ + --prefix=/cross-tools \ + ${CONFIGURE_OPTS}" + +source ${SCRDIR}/../functions-ac + +exit $? diff --git a/stage0/pkg/gcc b/stage0/pkg/gcc index c1eb6b0..423b932 100644 --- a/stage0/pkg/gcc +++ b/stage0/pkg/gcc @@ -35,7 +35,7 @@ hvconfig_pre() --with-mpfr=/cross-tools \ --with-gmp=/cross-tools" - if [ -n "${GCC_PASS1}" ]; then + if [ "x${HVLABEL}" = "x${GCC}-pass1" ]; then CONFIGURE_OPTS="${CONFIGURE_OPTS} \ --disable-shared \ --without-headers \ @@ -76,7 +76,7 @@ hvconfig_pre() sed -e "s@\(^CROSS_SYSTEM_HEADER_DIR =\).*@\1 /tools/include@g" \ -i gcc/Makefile.in - if [ -n "${GCC_PASS1}" ]; then + if [ "x${HVLABEL}" = "x${GCC}-pass1" ]; then # We will create a dummy limits.h so the build will not use the one # provided by the host distro: touch /tools/include/limits.h @@ -85,7 +85,7 @@ hvconfig_pre() hvbuild() { - if [ -n "${GCC_PASS1}" ]; then + if [ "x${HVLABEL}" = "x${GCC}-pass1" ]; then ${HVMAKE} all-gcc all-target-libgcc ${HVMAKE} install-gcc install-target-libgcc else diff --git a/stage0/pkg/linux b/stage0/pkg/linux index b5d275f..65e9be0 100644 --- a/stage0/pkg/linux +++ b/stage0/pkg/linux @@ -1,7 +1,5 @@ #!/bin/bash -HV_NO_CONFIGURE_SCRIPT=1 - hvbuild() { cd ${LFS_TMP}/${PACKAGE} diff --git a/stage0/pkg/ncurses b/stage0/pkg/ncurses index 18a27ae..846af37 100644 --- a/stage0/pkg/ncurses +++ b/stage0/pkg/ncurses @@ -1,5 +1,10 @@ #!/bin/bash +CONFIGURE_OPTS="\ + --without-debug \ + --without-shared \ + ${CONFIGURE_OPTS}" + hvbuid() { # Only one binary is needed for the Cross-Tools. diff --git a/stage0/pkg/uclibc b/stage0/pkg/uclibc deleted file mode 100644 index 3fb5e22..0000000 --- a/stage0/pkg/uclibc +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -HV_NO_CONFIGURE_SCRIPT=1 - -hvpatch() -{ - # Manually apply patch - apply_patch ${1}-branch_update-1.patch ${PACKAGE} - - case "${HVL_TARGET}" in - arm926t) - apply_patch ${PACKAGE}-config-arm926t.patch ${PACKAGE} - ;; - esac -} - -hvbuild() -{ - cd ${LFS_TMP}/${1} - - sed -e "s@\(^CROSS_COMPILER_PREFIX=\).*@\1\"${CLFS_TARGET}-\"@" \ - -e "s@\(^KERNEL_HEADERS=\).*@\1\"/tools/include\"@" \ - -e "s@.*\(DEVEL_PREFIX=\).*@\1\"/tools/\"@" \ - -e "s@.*\(^ARCH_${CLFS_NOT_ENDIAN}_ENDIAN\).*@# \1 is not set@g" \ - -e "s@.*\(ARCH_${CLFS_ENDIAN}_ENDIAN\).*@\1=y@g" \ - -e "s@.*\(ARCH_WANTS_${CLFS_ENDIAN}_ENDIAN\).*@\1=y@g" \ - -i .config - - ${HVMAKE} CROSS=${CLFS_TARGET}- CC="${CLFS_TARGET}-gcc ${BUILD}" - ${HVMAKE} PREFIX=${CLFS} install -} diff --git a/stage0/stage0-install b/stage0/stage0-install deleted file mode 100755 index 770821f..0000000 --- a/stage0/stage0-install +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -LFS_STAGE=stage0 - -# Let shell functions inherit ERR trap. Same as `set -E'. -set -o errtrace - -# Setting ERR trap does implicit `set -o errexit'. -trap myerr ERR - -function myerr() -{ - echo - echo "*** An error occured during ${LFS_STAGE}" - exit 1 -} - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -export LFS_PKG_DIR="$(dirname $(pwd))/packages/${LFS_STAGE}" -export LFS_LOG_DIR=${LFS}/var/log/hvlinux-install/${LFS_STAGE} -export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log -export LFS_TMP="${LFS}/tmp" - -echo "Performing pre-install" -./pre-install - -# Logging-in as 'lfs' user, and executing the install-1 script. The -# 'su -' command starts with a clean environment and enters the home -# directory of the user. -su - lfs -c "cd ${PWD}; ./install-1" - -echo "Total build time: $(get_total_build_time ${LFS_LOG_FILE})h" - -exit 0 diff --git a/stage1/cis-ac b/stage1/cis-ac deleted file mode 100755 index de929c3..0000000 --- a/stage1/cis-ac +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash -set -o errexit - -# First argument of this script is the package name. -# Remaining arguments are additional configure options. - -PACKAGE=${1} -shift -CONFIGURE_OPTS=${*} - -# Reading system configuration informations, functions and package versions. -source ${SCRDIR}/../sysinfos -source ${SCRDIR}/../functions -source ${SCRDIR}/../packages-list - -# Setting default configure options for all scripts -CONFIGURE_OPTS="\ - --prefix=/tools \ - --build=${CLFS_HOST} \ - --host=${CLFS_TARGET} \ - ${CONFIGURE_OPTS}" - -# Default configure function -hvconfig() -{ - cd ${LFS_TMP}/${PACKAGE}-build - - echo "Running configure with options:" - echo " <${CONFIGURE_OPTS}>" - - CC="${CC} ${CLFS_BUILDFLAGS}" CXX="${CXX} ${CLFS_BUILDFLAGS}" \ - ../${PACKAGE}/configure ${CONFIGURE_OPTS} -} - -# Default build function -hvbuild() -{ - ${HVMAKE} - ${HVMAKE} install -} - -hvpatch() -{ - # Applying patches (if any) - apply_patches ${PACKAGE} -} - -PACKAGE_DEF=${SCRDIR}/pkg/$(get_pkg_name ${PACKAGE}) - -if [ -f ${PACKAGE_DEF} ]; then - echo "Load custom package functions and definitions" - source ${PACKAGE_DEF} -fi - -hvpatch - -# Execute config-cache function if applicable -if function_exists hvconfig_cache ; then - echo "Running configure cache script" - hvconfig_cache - - CONFIGURE_OPTS="${CONFIGURE_OPTS} --cache-file=${LFS_TMP}/${PACKAGE}-build/config.cache" -fi - -# Execute pre-configure function if applicable -if function_exists hvconfig_pre ; then - echo "Running configure pre-script" - hvconfig_pre -fi - -if [ -n "${HV_NO_CONFIGURE_SCRIPT}" ]; then - echo "Not calling configure because ${PACKAGE} has no configure script" -else - hvconfig -fi - -# Execute post-configure function if applicable -if function_exists hvconfig_post ; then - echo "Running configure post-script" - hvconfig_post -fi - -hvbuild - -# Execute post-build function if applicable -if function_exists hvbuild_post ; then - echo "Running build post-script" - hvbuild_post -fi - -exit $? diff --git a/stage1/install-1 b/stage1/install-1 index be2fd3e..886d265 100755 --- a/stage1/install-1 +++ b/stage1/install-1 @@ -1,111 +1,41 @@ #!/bin/bash -set -o errexit -source ~/.bashrc +LFS_STAGE=stage1 + +# Let shell functions inherit ERR trap. Same as `set -E'. +set -o errtrace + +# Setting ERR trap does implicit `set -o errexit'. +trap myerr ERR + +function myerr() +{ + echo + echo "*** An error occured during ${LFS_STAGE}" + exit 1 +} # Reading system configuration informations, functions and package versions. source ../sysinfos source ../functions source ../packages-list -export LFS_PKG_DIR="$(dirname $(pwd))/packages/stage1" -export LFS_LOG_DIR=${LFS}/var/log/hvlinux-install/stage1 +export LFS_PKG_DIR="$(dirname $(pwd))/packages/${LFS_STAGE}" +export LFS_LOG_DIR=${LFS}/var/log/hvlinux-install/${LFS_STAGE} export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log export LFS_TMP="${LFS}/tmp" init_log_file -# Building temporary system -export CC="${CLFS_TARGET}-gcc" -export CXX="${CLFS_TARGET}-g++" -export AR="${CLFS_TARGET}-ar" -export AS="${CLFS_TARGET}-as" -export RANLIB="${CLFS_TARGET}-ranlib" -export LD="${CLFS_TARGET}-ld" -export STRIP="${CLFS_TARGET}-strip" - -# Scripts directory -export SCRDIR=$(pwd) - -HOST_CC=gcc CPPFLAGS=-fexceptions \ - ipkg_ac ${GMP} "--enable-cxx" -ipkg_ac ${MPFR} "--enable-shared" -ipkg_ac ${MPC} -ipkg_ac ${PPL} "\ - --enable-shared \ - --enable-interfaces=c,cxx \ - --disable-optimization \ - --with-libgmp-prefix=/tools \ - --with-libgmpxx-prefix=/tools" -ipkg_ac ${CLOOG_PPL} "\ - --enable-shared \ - --with-bits=gmp \ - --with-gmp=/tools \ - --with-ppl=/tools" -ipkg_ac ${ZLIB} -ipkg_ac ${BINUTILS} "\ - --target=${CLFS_TARGET} \ - --with-lib-path=/tools/lib \ - --disable-nls \ - --enable-shared \ - --disable-multilib" -ipkg_ac ${GCC} "\ - --target=${CLFS_TARGET} \ - --disable-multilib \ - --with-local-prefix=/tools \ - --libexecdir=/tools/lib \ - --disable-nls \ - --disable-libstdcxx-pch \ - --enable-long-long \ - --enable-c99 \ - --enable-shared \ - --enable-threads=posix \ - --enable-__cxa_atexit \ - --enable-languages=c,c++" -ipkg_ac ${NCURSES} "\ - --with-shared \ - --without-debug \ - --without-ada \ - --enable-overwrite \ - --with-build-cc=gcc" -ipkg_ac ${BASH} "--without-bash-malloc" -ipkg_ac ${BISON} -ipkg_ac ${BZIP2} -ipkg_ac ${COREUTILS} "--enable-install-program=hostname" -ipkg_ac ${DIFFUTILS} -ipkg_ac ${FINDUTILS} -ipkg_ac ${FILE_PKG} -ipkg_ac ${FLEX} -ipkg_ac ${GAWK} -ipkg_ac ${GETTEXT} "--disable-shared" -ipkg_ac ${GREP} "\ - --disable-perl-regexp \ - --without-included-regex" -ipkg_ac ${GZIP} -ipkg_ac ${MFOUR} -ipkg_ac ${MAKE_PACKAGE} -ipkg_ac ${PATCH_PACKAGE} -ipkg_ac ${SED} -ipkg_ac ${TAR_PACKAGE} -ipkg_ac ${TEXINFO} -ipkg_ac ${XZ_UTILS} +rscr mult "Performing pre-install" pre-install -# Chapter 7 -rscr once "Creating directory structure" create-directories -rscr once "Creating symbolic links" create-symlinks +# Logging-in as 'lfs' user, and executing the install-2 script. The +# 'su -' command starts with a clean environment and enters the home +# directory of the user. +su - lfs -c "cd ${PWD}; ./install-2" -ipkg_ac ${NANO} "--enable-color --enable-multibuffer" -ipkg_ac ${UTIL_LINUX_NG} -ipkg_ac ${E2FSPROGS} -ipkg_ac ${SYSVINIT} -ipkg_ac ${MODULE_INIT_TOOLS} -ipkg_ac ${UDEV} -ipkg_ac ${KERNEL} +rscr mult "Performing post-install" post-install -rscr once "Creating default users" create-users -rscr once "Creating default groups" create-groups -rscr once "Creating default log files" create-logfiles -rscr once "Creating default config files" create-config-files -rscr once "Installing bootscripts" install-bootscripts +echo "Total build time: $(get_total_build_time ${LFS_LOG_FILE})h" -exit $? +exit 0 diff --git a/stage1/install-2 b/stage1/install-2 new file mode 100755 index 0000000..ce63d88 --- /dev/null +++ b/stage1/install-2 @@ -0,0 +1,94 @@ +#!/bin/bash +set -o errexit + +source ~/.bashrc + +# Reading system configuration informations, functions and package versions. +source ../sysinfos +source ../functions +source ../packages-list + +export LFS_PKG_DIR="$(dirname $(pwd))/packages/stage1" +export LFS_LOG_DIR=${LFS}/var/log/hvlinux-install/stage1 +export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log +export LFS_TMP="${LFS}/tmp" + +init_log_file + +# Building temporary system +export CC="${CLFS_TARGET}-gcc" +export CXX="${CLFS_TARGET}-g++" +export AR="${CLFS_TARGET}-ar" +export AS="${CLFS_TARGET}-as" +export RANLIB="${CLFS_TARGET}-ranlib" +export LD="${CLFS_TARGET}-ld" +export STRIP="${CLFS_TARGET}-strip" + +# Scripts directory +export SCRDIR=$(pwd) + +HOST_CC=gcc CPPFLAGS=-fexceptions \ + ipkg ${GMP} "--enable-cxx" +ipkg ${MPFR} "--enable-shared" +ipkg ${MPC} +ipkg ${PPL} "\ + --enable-shared \ + --enable-interfaces=c,cxx \ + --disable-optimization \ + --with-libgmp-prefix=/tools \ + --with-libgmpxx-prefix=/tools" +ipkg ${CLOOG_PPL} "\ + --enable-shared \ + --with-bits=gmp \ + --with-gmp=/tools \ + --with-ppl=/tools" +ipkg -m acnb ${ZLIB} +ipkg ${BINUTILS} +ipkg ${GCC} +ipkg ${NCURSES} "\ + --with-shared \ + --without-debug \ + --without-ada \ + --enable-overwrite \ + --with-build-cc=gcc" +ipkg ${BASH} "--without-bash-malloc" +ipkg ${BISON} +ipkg -m noac ${BZIP2} +ipkg ${COREUTILS} "--enable-install-program=hostname" +ipkg ${DIFFUTILS} +ipkg ${FINDUTILS} +ipkg ${FILE_PKG} +ipkg ${FLEX} +ipkg ${GAWK} +ipkg ${GETTEXT} "--disable-shared" +ipkg ${GREP} "\ + --disable-perl-regexp \ + --without-included-regex" +ipkg ${GZIP} +ipkg ${MFOUR} +ipkg ${MAKE_PACKAGE} +ipkg ${PATCH_PACKAGE} +ipkg ${SED} +ipkg ${TAR_PACKAGE} +ipkg ${TEXINFO} +ipkg ${XZ_UTILS} + +# Chapter 7 +rscr once "Creating directory structure" create-directories +rscr once "Creating symbolic links" create-symlinks + +ipkg ${NANO} "--enable-color --enable-multibuffer" +ipkg ${UTIL_LINUX_NG} +ipkg ${E2FSPROGS} +ipkg -m noac ${SYSVINIT} +ipkg ${MODULE_INIT_TOOLS} +ipkg ${UDEV} +ipkg -m noac ${KERNEL} + +rscr once "Creating default users" create-users +rscr once "Creating default groups" create-groups +rscr once "Creating default log files" create-logfiles +rscr once "Creating default config files" create-config-files +rscr once "Installing bootscripts" install-bootscripts + +exit $? diff --git a/stage1/ipkg.sh b/stage1/ipkg.sh new file mode 100755 index 0000000..8f0b294 --- /dev/null +++ b/stage1/ipkg.sh @@ -0,0 +1,30 @@ +#!/bin/bash +set -o errexit + +# First argument of this script is the package name. +# Remaining arguments are additional configure options. + +PACKAGE=${1} +shift +CONFIGURE_OPTS=${*} + +# Reading system configuration informations, functions and package versions. +source ${SCRDIR}/../sysinfos +source ${SCRDIR}/../functions +source ${SCRDIR}/../packages-list + +# Setting default configure options for all scripts +CONFIGURE_OPTS="\ + --prefix=/tools \ + --build=${CLFS_HOST} \ + --host=${CLFS_TARGET} \ + ${CONFIGURE_OPTS}" + +CC="${CC} ${CLFS_BUILDFLAGS}" +CXX="${CXX} ${CLFS_BUILDFLAGS}" + +source ${SCRDIR}/../functions-ac + +ldconfig + +exit $? diff --git a/stage1/pkg/binutils b/stage1/pkg/binutils index 605dc88..293b0f1 100644 --- a/stage1/pkg/binutils +++ b/stage1/pkg/binutils @@ -1,5 +1,13 @@ #!/bin/bash +CONFIGURE_OPTS="\ + --target=${CLFS_TARGET} \ + --with-lib-path=/tools/lib \ + --disable-nls \ + --enable-shared \ + --disable-multilib \ + ${CONFIGURE_OPTS}" + hvconfig_pre() { case "${HVL_TARGET}" in diff --git a/stage1/pkg/bzip2 b/stage1/pkg/bzip2 index caadb9b..56bd28c 100644 --- a/stage1/pkg/bzip2 +++ b/stage1/pkg/bzip2 @@ -1,17 +1,13 @@ #!/bin/bash -# This package doesn't have a configure script... -hvconfig() +hvbuild() { cd ${LFS_TMP}/${PACKAGE} # Bzip2's default Makefile target automatically runs the testsuite as well. # Disable the tests since they won't work on a multi-architecture build: sed -e 's@^\(all:.*\) test@\1@g' -i Makefile -} -hvbuild() -{ ${HVMAKE} CC="${CC} ${CLFS_BUILDFLAGS}" AR="${AR}" RANLIB="${RANLIB}" ${HVMAKE} PREFIX=/tools install } diff --git a/stage1/pkg/e2fsprogs b/stage1/pkg/e2fsprogs index 0d9f401..49f5977 100644 --- a/stage1/pkg/e2fsprogs +++ b/stage1/pkg/e2fsprogs @@ -1,20 +1,17 @@ #!/bin/bash -hvconfig() -{ - cd ${LFS_TMP}/${PACKAGE}-build +CC="${CC} ${CLFS_BUILDFLAGS}" +PKG_CONFIG=true - CC="${CC} ${CLFS_BUILDFLAGS}" PKG_CONFIG=true \ - ../${PACKAGE}/configure \ - --prefix=/tools \ - --enable-elf-shlibs \ - --with-linker=${LD} \ - --host=${CLFS_TARGET} \ - --disable-libblkid \ - --disable-libuuid \ - --disable-fsck \ - --disable-uuidd -} +CONFIGURE_OPTS="\ + --prefix=/tools \ + --enable-elf-shlibs \ + --with-linker=${LD} \ + --host=${CLFS_TARGET} \ + --disable-libblkid \ + --disable-libuuid \ + --disable-fsck \ + --disable-uuidd" hvbuild() { diff --git a/stage1/pkg/gcc b/stage1/pkg/gcc index bde638a..85d8a73 100644 --- a/stage1/pkg/gcc +++ b/stage1/pkg/gcc @@ -1,5 +1,20 @@ #!/bin/bash +CONFIGURE_OPTS="\ + --target=${CLFS_TARGET} \ + --disable-multilib \ + --with-local-prefix=/tools \ + --libexecdir=/tools/lib \ + --disable-nls \ + --disable-libstdcxx-pch \ + --enable-long-long \ + --enable-c99 \ + --enable-shared \ + --enable-threads=posix \ + --enable-__cxa_atexit \ + --enable-languages=c,c++ \ + ${CONFIGURE_OPTS}" + hvpatch() { # Manually applying patches if specified diff --git a/stage1/pkg/gettext b/stage1/pkg/gettext index 6bd0d9a..7bcd57a 100644 --- a/stage1/pkg/gettext +++ b/stage1/pkg/gettext @@ -1,5 +1,11 @@ #!/bin/bash +CONFIGURE_OPTS="\ + --prefix=/tools \ + --build=${CLFS_HOST} \ + --host=${CLFS_TARGET} \ + ${CONFIGURE_OPTS}" + # When cross-compiling the Gettext configure script assumes we don't have a # working wcwidth when we do. The following will fix possible compilation # errors because of this assumption: @@ -14,17 +20,11 @@ hvconfig() { cd ${LFS_TMP}/${PACKAGE}/gettext-tools - FINAL_CFG_OPTS="\ - --prefix=/tools \ - --build=${CLFS_HOST} \ - --host=${CLFS_TARGET} \ - ${CONFIGURE_OPTS}" - echo "Running configure with options:" - echo " <${FINAL_CFG_OPTS}>" + echo " <${CONFIGURE_OPTS}>" CC="${CC} ${CLFS_BUILDFLAGS}" CXX="${CXX} ${CLFS_BUILDFLAGS}" \ - ./configure ${FINAL_CFG_OPTS} + ./configure ${CONFIGURE_OPTS} } hvbuild() diff --git a/stage1/pkg/linux b/stage1/pkg/linux index 0857772..542335c 100644 --- a/stage1/pkg/linux +++ b/stage1/pkg/linux @@ -1,7 +1,5 @@ #!/bin/bash -HV_NO_CONFIGURE_SCRIPT=1 - hvbuild() { cd ${LFS_TMP}/${PACKAGE} diff --git a/stage1/pkg/sysvinit b/stage1/pkg/sysvinit index aaa9bcf..0716d41 100644 --- a/stage1/pkg/sysvinit +++ b/stage1/pkg/sysvinit @@ -1,8 +1,6 @@ #!/bin/bash -HV_NO_CONFIGURE_SCRIPT=1 - -hvconfig_pre() +hvbuild() { cd ${LFS_TMP}/${PACKAGE} @@ -11,10 +9,7 @@ hvconfig_pre() -e 's@\(mknod \)-m \([0-9]* \)\(.* \)p@\1\3p; chmod \2\3@g' \ -e "s@/usr/lib@/tools/lib@" \ -i src/Makefile -} -hvbuild() -{ make -C src clobber make -C src CC="${CC} ${CLFS_BUILDFLAGS}" make -C src install INSTALL=install ROOT=${LFS} diff --git a/stage1/pkg/udev b/stage1/pkg/udev index 984e6f7..3dc3776 100644 --- a/stage1/pkg/udev +++ b/stage1/pkg/udev @@ -16,7 +16,6 @@ CONFIGURE_OPTS="\ hvconfig_pre() { cd ${LFS_TMP}/${PACKAGE} - install -dv ${LFS}/lib/{firmware,udev/devices/{pts,shm}} } diff --git a/stage1/pkg/zlib b/stage1/pkg/zlib index 3cd0f86..a1da1ca 100644 --- a/stage1/pkg/zlib +++ b/stage1/pkg/zlib @@ -2,10 +2,5 @@ CC="${CC} ${CLFS_BUILDFLAGS}" -hvconfig() -{ - cd ${LFS_TMP}/${PACKAGE} - - ./configure \ - --prefix=/tools -} +CONFIGURE_OPTS="\ + --prefix=/tools" diff --git a/stage1/stage1-install b/stage1/stage1-install deleted file mode 100755 index dd89a72..0000000 --- a/stage1/stage1-install +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -LFS_STAGE=stage1 - -# Let shell functions inherit ERR trap. Same as `set -E'. -set -o errtrace - -# Setting ERR trap does implicit `set -o errexit'. -trap myerr ERR - -function myerr() -{ - echo - echo "*** An error occured during ${LFS_STAGE}" - exit 1 -} - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -export LFS_PKG_DIR="$(dirname $(pwd))/packages/${LFS_STAGE}" -export LFS_LOG_DIR=${LFS}/var/log/hvlinux-install/${LFS_STAGE} -export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log -export LFS_TMP="${LFS}/tmp" - -init_log_file - -rscr mult "Performing pre-install" pre-install - -# Logging-in as 'lfs' user, and executing the install-1 script. The -# 'su -' command starts with a clean environment and enters the home -# directory of the user. -su - lfs -c "cd ${PWD}; ./install-1" - -rscr mult "Performing post-install" post-install - -echo "Total build time: $(get_total_build_time ${LFS_LOG_FILE})h" - -exit 0 diff --git a/stage2/cis-ac b/stage2/cis-ac deleted file mode 100755 index e836f99..0000000 --- a/stage2/cis-ac +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash -set -o errexit - -# First argument of this script is the package name. -# Remaining arguments are additional configure options. - -PACKAGE=${1} -shift -CONFIGURE_OPTS=${*} - -# Reading system configuration informations, functions and package versions. -source ${SCRDIR}/../sysinfos -source ${SCRDIR}/../functions -source ${SCRDIR}/../packages-list - -# Setting default configure options for all scripts -CONFIGURE_OPTS="\ - --prefix=/usr \ - --sysconfdir=/etc \ - ${CONFIGURE_OPTS}" - -# Default configure function -hvconfig() -{ - cd ${LFS_TMP}/${PACKAGE}-build - - echo "Running configure with options:" - echo " <${CONFIGURE_OPTS}>" - - ../${PACKAGE}/configure ${CONFIGURE_OPTS} -} - -# Default build function -hvbuild() -{ - ${HVMAKE} - ${HVMAKE} install -} - -hvpatch() -{ - # Applying patches (if any) - apply_patches ${PACKAGE} -} - -PACKAGE_DEF=${SCRDIR}/pkg/$(get_pkg_name ${PACKAGE}) - -if [ -f ${PACKAGE_DEF} ]; then - echo "Load custom package functions and definitions" - source ${PACKAGE_DEF} -fi - -hvpatch - -# Execute config-cache function if applicable -if function_exists hvconfig_cache ; then - echo "Running configure cache script" - hvconfig_cache - - CONFIGURE_OPTS="${CONFIGURE_OPTS} --cache-file=${LFS_TMP}/${PACKAGE}-build/config.cache" -fi - -# Execute pre-configure function if applicable -if function_exists hvconfig_pre ; then - echo "Running configure pre-script" - hvconfig_pre -fi - -if [ -n "${HV_NO_CONFIGURE_SCRIPT}" ]; then - echo "Not calling configure because ${PACKAGE} has no configure script" -else - hvconfig -fi - -# Execute post-configure function if applicable -if function_exists hvconfig_post ; then - echo "Running configure post-script" - hvconfig_post -fi - -hvbuild - -# Execute post-build function if applicable -if function_exists hvbuild_post ; then - echo "Running build post-script" - hvbuild_post -fi - -ldconfig - -exit $? diff --git a/stage2/cis-bootscripts b/stage2/cis-bootscripts deleted file mode 100755 index 50717e6..0000000 --- a/stage2/cis-bootscripts +++ /dev/null @@ -1,106 +0,0 @@ -#!/bin/bash -set -o errexit - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -DHCP_USED="no" - -cat > /etc/sysconfig/network/ifconfig.lo << "EOF" -ONBOOT="yes" -BOOTPROTO="static" -IPADDR="127.0.0.1" -PREFIX_LENGTH=8 -IFSCOPE="scope host" -EOF - -LOOP_INDEX="0" -for nic_device in ${INTERFACES}; do - file="/etc/sysconfig/network/ifconfig.${nic_device}" - echo "ONBOOT=\"yes\"" > ${file} - echo "BOOTPROTO=\"${BOOTPROTO[${LOOP_INDEX}]}\"" >> ${file} - echo "IPADDR=\"${IP_ADDRESS[${LOOP_INDEX}]}\"" >> ${file} - echo "PREFIX_LENGTH=\"${PREFIX_LENGTH[${LOOP_INDEX}]}\"" >> ${file} - echo "IFSCOPE=\"\"" >> ${file} - - if [ "x${BOOTPROTO[${LOOP_INDEX}]}" = "xdhcp" ]; then - GATEWAY="" - DHCP_USED="yes" - fi - - LOOP_INDEX=$((${LOOP_INDEX} + 1)) -done - -# "/etc/resolv.conf" file -if [ "x${DHCP_USED}" = "xno" ]; then - if [ -f /etc/resolv.conf ]; then - rm -f /etc/resolv.conf - fi - touch /etc/resolv.conf - for i in $(seq 0 $((${#NAMESERVER[@]} - 1))); do - echo "nameserver ${NAMESERVER[i]}" >> /etc/resolv.conf - done - chmod 644 /etc/resolv.conf -fi - -# "/etc/sysconfig/network/network-parameters" file creation -echo "#!/bin/sh" > /etc/sysconfig/network/network-parameters -echo "DOMAINNAME=\"${DOMAIN}\"" >> /etc/sysconfig/network/network-parameters -echo "INTERFACES_UP=\"lo ${INTERFACES}\"" >> /etc/sysconfig/network/network-parameters -echo "INTERFACES_DN=\"${INTERFACES} lo\"" >> /etc/sysconfig/network/network-parameters -echo "GATEWAY=\"${GATEWAY}\"" >> /etc/sysconfig/network/network-parameters - -cat >> /etc/sysconfig/network/network-parameters << EOF - -# On which network interface(s) to activate the DHCP server. -# Leave empty or comment the line to disable the DHCP server. -#DHCP_SERVER_IF="eth0" - -# Set to "yes" to enable the NFS server: -NFS_SERVER_ENA="no" - -# Set FIREWALL_ENA to "yes" to enable the firewall: -FIREWALL_ENA="no" -# Set FIREWALL_WWW to the ethernet interface connected to the outside world (internet): -FIREWALL_WWW="eth0" -# Set FIREWALL_LAN to the ethernet interface connected to the internal LAN: -FIREWALL_LAN="eth1" -EOF - -# Keyboard settings -cat > /etc/sysconfig/keyboard << "EOF" -# Keyboard language: us, cf, fr, etc. -KEYBOARD=us -EOF - -# Replacing 'KEYBOARD=us' entry with appropriate keyboard layout specified by user in sysinfos -if [ "x${KEYBOARD}" != "x" ]; then - sed -i s/KEYBOARD=us/KEYBOARD=${KEYBOARD}/ /etc/sysconfig/keyboard -fi - -# Removing /tools from the PATH environment variable during boot for bootscripts: -sed -i -e "s!^\(export PATH=\).*tools.*!\1/bin:/usr/bin:/sbin:/usr/sbin!" /etc/rc.d/init.d/functions - -# Copying boot scripts -STAGE2_BOOTSCRIPTS="ifdown ifup keyboard mountnetfs network sysklogd" -for bootscript in ${STAGE2_BOOTSCRIPTS}; do - install -m755 bootscripts/${bootscript} /etc/rc.d/init.d -done - -# Necessary because bootscript_add_* scripts use ${LFS} when -# writing/modifyng files -export LFS= - -# rcsysinit.d -bootscript_add_rcsysinit sysklogd 50 93 -bootscript_add_rcsysinit keyboard 55 00 - -# rc3.d -bootscript_add_rc3 network 05 80 -bootscript_add_rc3 mountnetfs 30 10 - -chown -R root:root /etc/rc.d /etc/sysconfig - -exit $? diff --git a/stage2/cis-bzip2 b/stage2/cis-bzip2 deleted file mode 100755 index b29d8de..0000000 --- a/stage2/cis-bzip2 +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -set -o errexit - -# First argument of this script is the package name - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -# Applying patches (if any) -apply_patches ${1} - -cd ${LFS_TMP}/${1} -make -f Makefile-libbz2_so -make clean -make -j ${MAKEJOBS} -make PREFIX=/usr install - -cp -fv bzip2-shared /bin/bzip2 -cp -afv libbz2.so* /lib -ln -sfvT ../../lib/libbz2.so.1.0 /usr/lib/libbz2.so -rm -fv /usr/bin/{bunzip2,bzcat,bzip2} -ln -sfvT bzip2 /bin/bunzip2 -ln -sfvT bzip2 /bin/bzcat - -exit $? diff --git a/stage2/cis-compressdoc b/stage2/cis-compressdoc deleted file mode 100755 index 19ac7e5..0000000 --- a/stage2/cis-compressdoc +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -set -o errexit - -# First argument of this script is the package name. - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -# If not already installed by previous invocation of this script: -install -m755 ${SCRDIR}/misc/compressdoc /usr/sbin - -# Compressing man pages with bzip2 -/usr/sbin/compressdoc --bz2 - -exit $? diff --git a/stage2/cis-diffutils b/stage2/cis-diffutils deleted file mode 100755 index 17b1f12..0000000 --- a/stage2/cis-diffutils +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -set -o errexit - -# First argument of this script is the package name. -# Remaining arguments are additional configure options. - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -PACKAGE=${1} -shift -CONFIGURE_OPTS=${*} - -# Applying patches (if any) -apply_patches ${PACKAGE} - -# The above patch will cause the Diffutils build system to attempt to rebuild -# the diff.1 man page using the unavailable program help2man: -cd ${LFS_TMP}/${PACKAGE} -touch man/diff.1 - -cd ${LFS_TMP}/${PACKAGE}-build -../${PACKAGE}/configure \ - --prefix=/usr \ - --sysconfdir=/etc \ - ${CONFIGURE_OPTS} -make -make install -ldconfig - -exit $? diff --git a/stage2/cis-findutils b/stage2/cis-findutils deleted file mode 100755 index 7172e90..0000000 --- a/stage2/cis-findutils +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -set -o errexit - -# First argument of this script is the package name - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -# Applying patches (if any) -apply_patches ${1} - -cd ${LFS_TMP}/${1}-build -../${1}/configure \ - --prefix=/usr \ - --libexecdir=/usr/lib/findutils \ - --localstatedir=/var/lib/locate -make -j ${MAKEJOBS} -make install - -# Some of the scripts in the LFS-Bootscripts package depend on find. -# As /usr may not be available during the early stages of booting, this -# program needs to be on the root partition. The updatedb script also -# needs to be modified to correct an explicit path: -mv -v /usr/bin/find /bin -sed -i -e 's/find:=${BINDIR}/find:=\/bin/' /usr/bin/updatedb - -exit $? diff --git a/stage2/cis-gdbm b/stage2/cis-gdbm deleted file mode 100755 index bacb24e..0000000 --- a/stage2/cis-gdbm +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -set -o errexit - -# First argument of this script is the package name. -# Remaining arguments are additional configure options. - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -PACKAGE=${1} -shift -CONFIGURE_OPTS=${*} - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -# Applying patches (if any) -apply_patches ${PACKAGE} - -cd ${LFS_TMP}/${PACKAGE}-build -../${PACKAGE}/configure \ - --prefix=/usr \ - --sysconfdir=/etc \ - ${CONFIGURE_OPTS} -make -make install -make install-compat - -ldconfig - -exit $? diff --git a/stage2/cis-groff b/stage2/cis-groff deleted file mode 100755 index 460e545..0000000 --- a/stage2/cis-groff +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -set -o errexit - -# First argument of this script is the package name - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -# Applying patches (if any) -apply_patches ${1} - -cd ${LFS_TMP}/${1} - -PAGE=letter ./configure \ - --prefix=/usr \ - --enable-multibyte -# Groff does not like to be made in parallel. -make -make install - -# Some documentation programs, such as xman, will not work properly without -# the following symlinks: -ln -fsv eqn /usr/bin/geqn -ln -fsv tbl /usr/bin/gtbl - -exit $? diff --git a/stage2/cis-grub b/stage2/cis-grub deleted file mode 100755 index bef600a..0000000 --- a/stage2/cis-grub +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -set -o errexit - -# First argument of this script is the package name - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -PACKAGE=${1} -shift -CONFIGURE_OPTS=${*} - -# Manually applying patches because of order -apply_patch ${PACKAGE}-use_mmap-1.patch ${PACKAGE} -apply_patch ${PACKAGE}-256byte_inode-1.patch ${PACKAGE} -apply_patch ${PACKAGE}-ext4-1.patch ${PACKAGE} -apply_patch ${PACKAGE}-fixes-1.patch ${PACKAGE} - -GRUB_STAGE_FILES="/usr/lib/grub/i386-pc" - -cd ${LFS_TMP}/${PACKAGE}-build -../${PACKAGE}/configure \ - --prefix=/usr \ - --sysconfdir=/etc \ - ${CONFIGURE_OPTS} -make -j ${MAKEJOBS} -make install - -mkdir -p /boot/grub -cp -a ${GRUB_STAGE_FILES}/stage{1,2} /boot/grub -cp -a ${GRUB_STAGE_FILES}/{e2fs,reiserfs}_stage1_5 /boot/grub - -exit $? - diff --git a/stage2/cis-gzip b/stage2/cis-gzip deleted file mode 100755 index 5a4b628..0000000 --- a/stage2/cis-gzip +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -set -o errexit - -# First argument of this script is the package name - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -# Applying patches (if any) -apply_patches ${1} - -cd ${LFS_TMP}/${1} -./configure \ - --prefix=/usr \ - --bindir=/bin -make -j ${MAKEJOBS} -make install - -# Move some programs that do not need to be on the root filesystem: -mv -fv /bin/{gzexe,uncompress,zcmp,zdiff,zegrep} /usr/bin -mv -fv /bin/{zfgrep,zforce,zgrep,zless,zmore,znew} /usr/bin - -# Return last error -exit $? diff --git a/stage2/cis-hv-utilities b/stage2/cis-hv-utilities deleted file mode 100755 index 7fa350c..0000000 --- a/stage2/cis-hv-utilities +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -set -o errexit - -# First argument of this script is the package name - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -SRCDIR="./hv-utilities" -PREFIX="/usr/local" -BINDIR="${PREFIX}/bin" -SYSBINDIR="${PREFIX}/sbin" -BIN_UTILITIES="camera-download cd-erase cd-copy pstopdf distro-backup dos2unix \ - dvd-ram-format fix-avi gztobz2 hv-backup hv-video-dvd mail-files \ - mail-if-fail mail-statistics media-write pstopdf replace.pl \ - rotatelogs setdate strip-debug-symbols tarbz2 tildes-clean" - -for program in ${BIN_UTILITIES}; do - install -v ${SRCDIR}/${program} ${BINDIR} -done - -exit $? diff --git a/stage2/cis-inetutils b/stage2/cis-inetutils deleted file mode 100755 index d1076bc..0000000 --- a/stage2/cis-inetutils +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -set -o errexit - -# First argument of this script is the package name. -# Remaining arguments are additional configure options. - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -PACKAGE=${1} -shift -CONFIGURE_OPTS=${*} - -# Applying patches (if any) -apply_patches ${PACKAGE} - -# This is only a basic installation (no servers) of inetutils. - -cd ${LFS_TMP}/${PACKAGE}-build -../${PACKAGE}/configure \ - --prefix=/usr \ - --sysconfdir=/etc \ - ${CONFIGURE_OPTS} -make -make install - -# Move some programs to their FHS-compliant place: -mv -v /usr/bin/{hostname,ping,ping6} /bin -mv -v /usr/bin/traceroute /sbin - -ldconfig - -exit $? diff --git a/stage2/cis-kbd b/stage2/cis-kbd deleted file mode 100755 index 7f3bc67..0000000 --- a/stage2/cis-kbd +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -set -o errexit - -# First argument of this script is the package name - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -cd ${LFS_TMP}/${1} - -# The Kbd package doesn't come shipped with the standard configure scripts, so generate them now: -autoreconf - -# Applying patches (if any) -apply_patches ${1} - -# --datadir=/lib/kbd -# This option puts keyboard layout data in a directory that will -# always be on the root partition instead of the default /usr/share/kbd -cd ${LFS_TMP}/${1} -./configure \ - --prefix=/usr \ - --datadir=/lib/kbd -make -j ${MAKEJOBS} -make install - -# Some of the scripts in the LFS-Bootscripts package depend on kbd_mode, -# openvt, and setfont. As /usr may not be available during the early stages -# of booting, those binaries need to be on the root partition: -mv -v /usr/bin/{kbd_mode,loadkeys,openvt,setfont} /bin - -exit $? diff --git a/stage2/cis-module-init-tools b/stage2/cis-module-init-tools deleted file mode 100755 index 901beab..0000000 --- a/stage2/cis-module-init-tools +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -set -o errexit - -# First argument of this script is the package name - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -# Applying patches (if any) -apply_patches ${1} - -# --enable-zlib: To handle compressed kernel modules. -cd ${LFS_TMP}/${1}-build -../${1}/configure \ - --prefix=/ \ - --enable-zlib \ - --mandir=/usr/share/man -make -j ${MAKEJOBS} -make INSTALL=install install - -cat > /etc/modprobe.conf << "EOF" -# modprobe.conf -EOF - -exit $? diff --git a/stage2/cis-perl-pass2 b/stage2/cis-perl-pass2 deleted file mode 100755 index 6781d17..0000000 --- a/stage2/cis-perl-pass2 +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -set -o errexit - -# First argument of this script is the package name. -# Remaining arguments are additional configure options. - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -PACKAGE=${1} -shift -CONFIGURE_OPTS=${*} - -# Applying patches (if any) -apply_patches ${PACKAGE} - -cd ${LFS_TMP}/${PACKAGE} - -# This version of Perl now builds the Compress::Raw::Zlib module. By default -# Perl will use an internal copy of the Zlib source for the build. Issue the -# following command so that Perl will use the Zlib library installed on the system: -sed -i -e "s|BUILD_ZLIB\s*= True|BUILD_ZLIB = False|" \ - -e "s|INCLUDE\s*= ./zlib-src|INCLUDE = /usr/include|" \ - -e "s|LIB\s*= ./zlib-src|LIB = /usr/lib|" \ - ext/Compress-Raw-Zlib/config.in - -sh Configure -des \ - -Dprefix=/usr \ - -Dvendorprefix=/usr \ - -Dman1dir=/usr/share/man/man1 \ - -Dman3dir=/usr/share/man/man3 \ - -Dpager="/usr/bin/less -isR" -make -make install -ldconfig - -exit $? diff --git a/stage2/cis-popt b/stage2/cis-popt deleted file mode 100755 index 9df4792..0000000 --- a/stage2/cis-popt +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -set -o errexit - -# First argument of this script is the package name. - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -# Applying patches (if any) -apply_patches ${1} - -cd ${LFS_TMP}/${1} -# fix taken backported from the development version of popt fixes -# a problem identified by the included testsuite: -sed -i -e "/*origOptString ==/c 0)" popt.c - -./configure \ - --prefix=/usr \ - --sysconfdir=/etc -make -j ${MAKEJOBS} -make install - -exit $? diff --git a/stage2/cis-post-install b/stage2/cis-post-install deleted file mode 100755 index 3e65624..0000000 --- a/stage2/cis-post-install +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -set -o errexit - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -cat > /etc/default/useradd << "EOF" -# useradd defaults file -HOME=/home -INACTIVE=-1 -EXPIRE= -SHELL=/bin/bash -SKEL=/etc/skel -CREATE_MAIL_SPOOL=yes -EOF - -chmod -v 644 /etc/default/useradd - -if [ -n "${REGUSER}" ]; then - hv_useradd -g users -G audio,video,usb -s /bin/bash -m ${REGUSER} -fi - -echo "Copying /etc/skel files to root directory" -# Copy skel files to root directory. First create a copy to change owner -cp -au /etc/skel/.??* /root - -# Fixing ownership of directories /tmp and /var/log (may have been created by -# a regular user when fetching packages). -chown -v root:root /tmp -chown -v root:root /var -chown -v root:root /var/log - -exit $? diff --git a/stage2/cis-psmisc b/stage2/cis-psmisc deleted file mode 100755 index 2646a1d..0000000 --- a/stage2/cis-psmisc +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -set -o errexit - -# First argument of this script is the package name - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -# Applying patches (if any) -apply_patches ${1} - -# By default, Psmisc's pidof program is not installed. This usually is -# not a problem because it is installed later in the Sysvinit package, -# which provides a better pidof program. - -cd ${LFS_TMP}/${1}-build -../${1}/configure \ - --prefix=/usr -make -j ${MAKEJOBS} -make install - -# By default, Psmisc's pidof program is not installed. This usually is not a -# problem because it is installed later in the Sysvinit package, which provides -# a better pidof program. If Sysvinit will not be used for a particular system, -# complete the installation of Psmisc by creating the following symlink: -#ln -sv killall /bin/pidof - -exit $? diff --git a/stage2/cis-shadow b/stage2/cis-shadow deleted file mode 100755 index bc63f0a..0000000 --- a/stage2/cis-shadow +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -set -o errexit - -# First argument of this script is the package name - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -# Applying patches (if any) -apply_patches ${1} - -cd ${LFS_TMP}/${1} - -# Disable the installation of the groups program and its man page, as -# Coreutils provides a better version. -sed -i 's/groups$(EXEEXT) //' src/Makefile.in -find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \; - -# Disable the installation of Chinese and Korean manual pages, since Man-DB -# cannot format them properly: -sed -i -e 's/ ko//' -e 's/ zh_CN zh_TW//' man/Makefile.in - -# Instead of using the default crypt method, use the more secure MD5 method -# of password encryption, which also allows passwords longer than 8 characters. -# It is also necessary to change the obsolete /var/spool/mail location for user -# mailboxes that Shadow uses by default to the /var/mail location used currently: -sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD MD5@' \ - -e 's@/var/spool/mail@/var/mail@' etc/login.defs - -cd ${LFS_TMP}/${1}-build -../${1}/configure \ - --sysconfdir=/etc \ - --without-selinux -make -j ${MAKEJOBS} -make install - -var_add_shadow "ENV_SUPATH" /etc/login.defs "/usr/local/sbin:/usr/local/bin" - -# Move some misplaced symlinks/programs to their proper locations. -mv /usr/bin/passwd /bin - -# The -D option of the useradd program requires this directory for it -# to work properly. -mkdir -p /etc/default - -# To enable shadowed passwords: -pwconv - -# To enable shadowed group passwords: -grpconv - -exit $? diff --git a/stage2/cis-stripping b/stage2/cis-stripping deleted file mode 100755 index 92161d1..0000000 --- a/stage2/cis-stripping +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -/tools/bin/find /{,usr/}{bin,lib,sbin} -type f \ - -exec /tools/bin/strip --strip-debug '{}' ';' - -# Return success -exit 0 diff --git a/stage2/cis-sysklogd b/stage2/cis-sysklogd deleted file mode 100755 index 77c3643..0000000 --- a/stage2/cis-sysklogd +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -set -o errexit - -# First argument of this script is the package name - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -# Applying patches (if any) -apply_patches ${1} - -cd ${LFS_TMP}/${1} -make -j ${MAKEJOBS} -make install - -cat > /etc/syslog.conf << "EOF" -# /etc/syslog.conf - -auth,authpriv.* -/var/log/auth.log -*.*;auth,authpriv.none -/var/log/sys.log -daemon.* -/var/log/daemon.log -kern.* -/var/log/kern.log -mail.* -/var/log/mail.log -user.* -/var/log/user.log -cron.* -/var/log/cron.log -*.emerg * -EOF - -exit $? diff --git a/stage2/cis-sysvinit b/stage2/cis-sysvinit deleted file mode 100755 index 01f29d9..0000000 --- a/stage2/cis-sysvinit +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -set -o errexit - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -# Applying patches (if any) -apply_patches ${1} - -cd ${LFS_TMP}/${1} - -sed -i 's@Sending processes@& configured via /etc/inittab@g' src/init.c - -# A maintained version of the wall program was installed earlier by -# Util-linux-ng. Suppress the installation of Sysvinit's version: -sed -i -e 's/utmpdump wall/utmpdump/' \ - -e 's/mountpoint.1 wall.1/mountpoint.1/' src/Makefile - -make -j ${MAKEJOBS} -C src -make -C src install - -# /etc/inittab was installed in stage 1 - -exit $? diff --git a/stage2/cis-texinfo b/stage2/cis-texinfo deleted file mode 100755 index f05cb36..0000000 --- a/stage2/cis-texinfo +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -set -o errexit - -# First argument of this script is the package name - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -# Applying patches (if any) -apply_patches ${1} - -cd ${LFS_TMP}/${1}-build -../${1}/configure \ - --prefix=/usr -make -j ${MAKEJOBS} -make install -make TEXMF=/usr/share/texmf install-tex - -exit $? diff --git a/stage2/cis-toolchain-adjust b/stage2/cis-toolchain-adjust deleted file mode 100755 index af99d6b..0000000 --- a/stage2/cis-toolchain-adjust +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -set -o errexit - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -# Amend the GCC specs file so that it points to the new dynamic linker, and so -# that GCC knows where to find its start files. -gcc -dumpspecs | \ - sed \ - -e 's@/tools/lib/ld@/lib/ld@g' \ - -e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' > \ - `dirname $(gcc --print-libgcc-file-name)`/specs - -exit $? diff --git a/stage2/cis-toolchain-test b/stage2/cis-toolchain-test deleted file mode 100755 index e169c69..0000000 --- a/stage2/cis-toolchain-test +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -set -o errexit - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -# Testing toolchain -cd /tmp -echo 'main(){}' > dummy.c -gcc dummy.c -Wl,--verbose &> dummy.log - -if ! readelf -l a.out | grep 'Requesting program interpreter: /lib/ld-linux.*.so.2' 1> /dev/null 2>&1 ; then - echo "String 'Requesting program interpreter: /lib/ld-linux.*.so.2' not found" - exit 1 -fi - -rm dummy.{c,log} a.out - -exit $? diff --git a/stage2/cis-udev b/stage2/cis-udev deleted file mode 100755 index b045306..0000000 --- a/stage2/cis-udev +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -set -o errexit - -# First argument of this script is the package name. - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -# Applying patches (if any) -apply_patches ${1} - -cd ${LFS_TMP}/${1} -./configure \ - --prefix=/usr \ - --sysconfdir=/etc \ - --sbindir=/sbin \ - --with-rootlibdir=/lib \ - --libexecdir=/lib/udev \ - --docdir=/usr/share/doc/${1} \ - --disable-extras \ - --disable-introspection -make -make install - -# Udev has to be configured in order to work properly, as its default -# configuration does not cover all devices. First install two extra -# rules files from Udev to help support device-mapper and RAID setups: -install -m644 -v rules/packages/64-*.rules \ - /lib/udev/rules.d/ - -# Now install a file to create symlinks for certain hand-held devices: -install -m644 -v rules/packages/40-pilot-links.rules \ - /lib/udev/rules.d/ - -# Now install a file to handle ISDN devices: -install -m644 -v rules/packages/40-isdn.rules \ - /lib/udev/rules.d/ - -install -m755 ${SCRDIR}/misc/udev-create-persistent-net.sh /usr/local/bin - -ldconfig - -exit $? diff --git a/stage2/cis-udev-config b/stage2/cis-udev-config deleted file mode 100755 index d4c9d8d..0000000 --- a/stage2/cis-udev-config +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -set -o errexit - -# First argument of this script is the package name. - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list - -# Applying patches (if any) -apply_patches ${1} - -cd ${LFS_TMP}/${1} -make install - -# Install the documentation that explains the LFS-specific rules files: -make install-doc - -exit $? diff --git a/stage2/compressdoc b/stage2/compressdoc new file mode 100755 index 0000000..19ac7e5 --- /dev/null +++ b/stage2/compressdoc @@ -0,0 +1,17 @@ +#!/bin/bash +set -o errexit + +# First argument of this script is the package name. + +# Reading system configuration informations, functions and package versions. +source ../sysinfos +source ../functions +source ../packages-list + +# If not already installed by previous invocation of this script: +install -m755 ${SCRDIR}/misc/compressdoc /usr/sbin + +# Compressing man pages with bzip2 +/usr/sbin/compressdoc --bz2 + +exit $? diff --git a/stage2/install-1 b/stage2/install-1 new file mode 100755 index 0000000..279066d --- /dev/null +++ b/stage2/install-1 @@ -0,0 +1,74 @@ +#!/bin/bash + +LFS_STAGE=stage2 + +export LFS_PKG_DIR="$(dirname $(pwd))/packages/${LFS_STAGE}" +export LFS_LOG_DIR=/var/log/hvlinux-install/${LFS_STAGE} +export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log +export LFS_TMP=/tmp + +# Reading system configuration informations, functions and package versions. +source ../sysinfos +source ../functions +source ../packages-list +source /etc/profile + +if [ "x${USER}" != "xroot" ]; then + echo "You must be the superuser to install hvlinux." + exit 1 +fi + +init_log_file + +# Scripts directory +export SCRDIR=$(pwd) + +ipkg -l "${PERL}-pass1" ${PERL} +ipkg -m noac ${KERNEL} +ipkg -m noac ${MANPAGES} +ipkg ${EGLIBC} +rscr once "Adjusting toolchain" toolchain-adjust +rscr mult "Testing toolchain" toolchain-test + +export CC="gcc -isystem /usr/include" +export CXX="g++ -isystem /usr/include" +export LDFLAGS="-Wl,-rpath-link,/lib" + +CPPFLAGS=-fexceptions \ + ipkg ${GMP} "--enable-cxx --enable-mpbsd" +ipkg ${MPFR} "--enable-shared --with-gmp=/usr" +ipkg ${MPC} +CPPFLAGS=-fexceptions \ + ipkg ${PPL} "--enable-shared --disable-optimization" +ipkg ${CLOOG_PPL} "--enable-shared --with-gmp --with-ppl" + +unset CC +unset CXX +unset LDFLAGS + +ipkg ${ZLIB} +ipkg ${BINUTILS} +ipkg ${GCC} +rscr mult "Testing toolchain" toolchain-test +ipkg ${SED} "--bindir=/bin" +ipkg ${PKG_CONFIG} +ipkg ${NCURSES} +ipkg ${UTIL_LINUX_NG} +ipkg ${E2FSPROGS} +ipkg ${COREUTILS} +ipkg -m noac ${IANA} +ipkg ${MFOUR} +ipkg ${BISON} +ipkg ${PROCPS} +ipkg ${LIBTOOL} +ipkg ${FLEX} +ipkg -m noac ${IPROUTE2} +ipkg -l "${PERL}-pass2" ${PERL} +ipkg ${READLINE} +ipkg ${AUTOCONF} +ipkg ${AUTOMAKE} +ipkg ${BASH} "--bindir=/bin --without-bash-malloc --with-installed-readline" + +/bin/bash +h -c ./install-2 + +exit $? diff --git a/stage2/install-2 b/stage2/install-2 index 14ab663..34c3d45 100755 --- a/stage2/install-2 +++ b/stage2/install-2 @@ -17,57 +17,49 @@ init_log_file # Scripts directory export SCRDIR=$(pwd) -ipkg_cust ${GDBM} cis-gdbm -ipkg_cust ${INETUTILS} cis-inetutils \ - --libexecdir=/usr/sbin \ - --localstatedir=/var \ - --disable-ifconfig \ - --disable-logger \ - --disable-syslogd \ - --disable-whois \ - --disable-servers -ipkg_cust ${BZIP2} cis-bzip2 -ipkg_cust ${DIFFUTILS} cis-diffutils -ipkg_ac ${FILE_PKG} -ipkg_ac ${GAWK} "--libexecdir=/usr/lib" -ipkg_cust ${FINDUTILS} cis-findutils -ipkg_ac ${GETTEXT} -ipkg_ac ${GREP} "--bindir=/bin --without-included-regex" -ipkg_cust ${GROFF} cis-groff -ipkg_cust ${GZIP} cis-gzip - -ipkg_cust ${KBD} cis-kbd -ipkg_ac ${LESS} -ipkg_ac ${MAKE_PACKAGE} -ipkg_ac ${MAN_DB} \ +ipkg ${GDBM} +ipkg ${INETUTILS} +ipkg -m noac ${BZIP2} +ipkg ${DIFFUTILS} +ipkg ${FILE_PKG} +ipkg ${GAWK} "--libexecdir=/usr/lib" +ipkg ${FINDUTILS} +ipkg ${GETTEXT} +ipkg ${GREP} "--bindir=/bin --without-included-regex" +ipkg ${GROFF} +ipkg ${GZIP} +ipkg ${KBD} +ipkg ${LESS} +ipkg ${MAKE_PACKAGE} +ipkg ${MAN_DB} "\ --libexecdir=/usr/lib \ --disable-setuid \ --with-browser=/usr/bin/lynx \ --with-vgrind=/usr/bin/vgrind \ - --with-grap=/usr/bin/grap -ipkg_cust ${MODULE_INIT_TOOLS} cis-module-init-tools -ipkg_ac ${PATCH_PACKAGE} -ipkg_cust ${PSMISC} cis-psmisc -ipkg_cust ${SHADOW} cis-shadow -ipkg_cust ${SYSKLOGD} cis-sysklogd -ipkg_cust ${SYSVINIT} cis-sysvinit -ipkg_ac ${TAR_PACKAGE} "--bindir=/bin --libexecdir=/usr/sbin" -ipkg_cust ${TEXINFO} cis-texinfo -ipkg_cust ${UDEV} cis-udev -ipkg_cust ${UDEV_CONFIG} cis-udev-config -#ipkg_cust ${GRUB} cis-grub + --with-grap=/usr/bin/grap" +ipkg ${MODULE_INIT_TOOLS} +ipkg ${PATCH_PACKAGE} +ipkg ${PSMISC} +ipkg -m noac ${SHADOW} +ipkg ${SYSKLOGD} +ipkg ${SYSVINIT} +ipkg ${TAR_PACKAGE} "--bindir=/bin --libexecdir=/usr/sbin" +ipkg ${TEXINFO} +ipkg ${UDEV} +ipkg -m noac ${UDEV_CONFIG} +ipkg ${GRUB} -rscr once "Installing HV-utilities" cis-hv-utilities -rscr mult "Compressing man pages" cis-compressdoc -rscr once "Installing bootscripts" cis-bootscripts -#rscr mult "Stripping" cis-stripping +rscr once "Installing HV-utilities" install-hv-utilities +rscr mult "Compressing man pages" compressdoc +rscr once "Installing bootscripts" install-bootscripts +#rscr mult "Stripping" stripping echo "Total build time: $(get_total_build_time ${LFS_LOG_FILE})h" # Creating root password passwd root || exit 1 -rscr mult "Performing post-install" cis-post-install +rscr mult "Performing post-install" post-install ldconfig lasterror=$? diff --git a/stage2/install-bootscripts b/stage2/install-bootscripts new file mode 100755 index 0000000..50717e6 --- /dev/null +++ b/stage2/install-bootscripts @@ -0,0 +1,106 @@ +#!/bin/bash +set -o errexit + +# Reading system configuration informations, functions and package versions. +source ../sysinfos +source ../functions +source ../packages-list + +DHCP_USED="no" + +cat > /etc/sysconfig/network/ifconfig.lo << "EOF" +ONBOOT="yes" +BOOTPROTO="static" +IPADDR="127.0.0.1" +PREFIX_LENGTH=8 +IFSCOPE="scope host" +EOF + +LOOP_INDEX="0" +for nic_device in ${INTERFACES}; do + file="/etc/sysconfig/network/ifconfig.${nic_device}" + echo "ONBOOT=\"yes\"" > ${file} + echo "BOOTPROTO=\"${BOOTPROTO[${LOOP_INDEX}]}\"" >> ${file} + echo "IPADDR=\"${IP_ADDRESS[${LOOP_INDEX}]}\"" >> ${file} + echo "PREFIX_LENGTH=\"${PREFIX_LENGTH[${LOOP_INDEX}]}\"" >> ${file} + echo "IFSCOPE=\"\"" >> ${file} + + if [ "x${BOOTPROTO[${LOOP_INDEX}]}" = "xdhcp" ]; then + GATEWAY="" + DHCP_USED="yes" + fi + + LOOP_INDEX=$((${LOOP_INDEX} + 1)) +done + +# "/etc/resolv.conf" file +if [ "x${DHCP_USED}" = "xno" ]; then + if [ -f /etc/resolv.conf ]; then + rm -f /etc/resolv.conf + fi + touch /etc/resolv.conf + for i in $(seq 0 $((${#NAMESERVER[@]} - 1))); do + echo "nameserver ${NAMESERVER[i]}" >> /etc/resolv.conf + done + chmod 644 /etc/resolv.conf +fi + +# "/etc/sysconfig/network/network-parameters" file creation +echo "#!/bin/sh" > /etc/sysconfig/network/network-parameters +echo "DOMAINNAME=\"${DOMAIN}\"" >> /etc/sysconfig/network/network-parameters +echo "INTERFACES_UP=\"lo ${INTERFACES}\"" >> /etc/sysconfig/network/network-parameters +echo "INTERFACES_DN=\"${INTERFACES} lo\"" >> /etc/sysconfig/network/network-parameters +echo "GATEWAY=\"${GATEWAY}\"" >> /etc/sysconfig/network/network-parameters + +cat >> /etc/sysconfig/network/network-parameters << EOF + +# On which network interface(s) to activate the DHCP server. +# Leave empty or comment the line to disable the DHCP server. +#DHCP_SERVER_IF="eth0" + +# Set to "yes" to enable the NFS server: +NFS_SERVER_ENA="no" + +# Set FIREWALL_ENA to "yes" to enable the firewall: +FIREWALL_ENA="no" +# Set FIREWALL_WWW to the ethernet interface connected to the outside world (internet): +FIREWALL_WWW="eth0" +# Set FIREWALL_LAN to the ethernet interface connected to the internal LAN: +FIREWALL_LAN="eth1" +EOF + +# Keyboard settings +cat > /etc/sysconfig/keyboard << "EOF" +# Keyboard language: us, cf, fr, etc. +KEYBOARD=us +EOF + +# Replacing 'KEYBOARD=us' entry with appropriate keyboard layout specified by user in sysinfos +if [ "x${KEYBOARD}" != "x" ]; then + sed -i s/KEYBOARD=us/KEYBOARD=${KEYBOARD}/ /etc/sysconfig/keyboard +fi + +# Removing /tools from the PATH environment variable during boot for bootscripts: +sed -i -e "s!^\(export PATH=\).*tools.*!\1/bin:/usr/bin:/sbin:/usr/sbin!" /etc/rc.d/init.d/functions + +# Copying boot scripts +STAGE2_BOOTSCRIPTS="ifdown ifup keyboard mountnetfs network sysklogd" +for bootscript in ${STAGE2_BOOTSCRIPTS}; do + install -m755 bootscripts/${bootscript} /etc/rc.d/init.d +done + +# Necessary because bootscript_add_* scripts use ${LFS} when +# writing/modifyng files +export LFS= + +# rcsysinit.d +bootscript_add_rcsysinit sysklogd 50 93 +bootscript_add_rcsysinit keyboard 55 00 + +# rc3.d +bootscript_add_rc3 network 05 80 +bootscript_add_rc3 mountnetfs 30 10 + +chown -R root:root /etc/rc.d /etc/sysconfig + +exit $? diff --git a/stage2/install-hv-utilities b/stage2/install-hv-utilities new file mode 100755 index 0000000..7fa350c --- /dev/null +++ b/stage2/install-hv-utilities @@ -0,0 +1,24 @@ +#!/bin/bash +set -o errexit + +# First argument of this script is the package name + +# Reading system configuration informations, functions and package versions. +source ../sysinfos +source ../functions +source ../packages-list + +SRCDIR="./hv-utilities" +PREFIX="/usr/local" +BINDIR="${PREFIX}/bin" +SYSBINDIR="${PREFIX}/sbin" +BIN_UTILITIES="camera-download cd-erase cd-copy pstopdf distro-backup dos2unix \ + dvd-ram-format fix-avi gztobz2 hv-backup hv-video-dvd mail-files \ + mail-if-fail mail-statistics media-write pstopdf replace.pl \ + rotatelogs setdate strip-debug-symbols tarbz2 tildes-clean" + +for program in ${BIN_UTILITIES}; do + install -v ${SRCDIR}/${program} ${BINDIR} +done + +exit $? diff --git a/stage2/ipkg.sh b/stage2/ipkg.sh new file mode 100755 index 0000000..41f028d --- /dev/null +++ b/stage2/ipkg.sh @@ -0,0 +1,26 @@ +#!/bin/bash +set -o errexit + +# First argument of this script is the package name. +# Remaining arguments are additional configure options. + +PACKAGE=${1} +shift +CONFIGURE_OPTS=${*} + +# Reading system configuration informations, functions and package versions. +source ${SCRDIR}/../sysinfos +source ${SCRDIR}/../functions +source ${SCRDIR}/../packages-list + +# Setting default configure options for all scripts +CONFIGURE_OPTS="\ + --prefix=/usr \ + --sysconfdir=/etc \ + ${CONFIGURE_OPTS}" + +source ${SCRDIR}/../functions-ac + +ldconfig + +exit $? diff --git a/stage2/pkg/bzip2 b/stage2/pkg/bzip2 new file mode 100755 index 0000000..dae7691 --- /dev/null +++ b/stage2/pkg/bzip2 @@ -0,0 +1,17 @@ +#!/bin/bash + +hvbuild() +{ + cd ${LFS_TMP}/${PACKAGE} + make -f Makefile-libbz2_so + make clean + make -j ${MAKEJOBS} + make PREFIX=/usr install + + cp -fv bzip2-shared /bin/bzip2 + cp -afv libbz2.so* /lib + ln -sfvT ../../lib/libbz2.so.1.0 /usr/lib/libbz2.so + rm -fv /usr/bin/{bunzip2,bzcat,bzip2} + ln -sfvT bzip2 /bin/bunzip2 + ln -sfvT bzip2 /bin/bzcat +} diff --git a/stage2/pkg/diffutils b/stage2/pkg/diffutils new file mode 100755 index 0000000..9c919b8 --- /dev/null +++ b/stage2/pkg/diffutils @@ -0,0 +1,8 @@ +#!/bin/bash + +hvconfig_pre() +{ + # A patch will cause the Diffutils build system to attempt to rebuild + # the diff.1 man page using the unavailable program help2man: + touch ${LFS_TMP}/${PACKAGE}/man/diff.1 +} diff --git a/stage2/pkg/findutils b/stage2/pkg/findutils new file mode 100755 index 0000000..4bdfba7 --- /dev/null +++ b/stage2/pkg/findutils @@ -0,0 +1,16 @@ +#!/bin/bash + +CONFIGURE_OPTS="\ + --libexecdir=/usr/lib/findutils \ + --localstatedir=/var/lib/locate \ + ${CONFIGURE_OPTS}" + +hvbuild_post() +{ + # Some of the scripts in the LFS-Bootscripts package depend on find. As + # /usr may not be available during the early stages of booting, this program + # needs to be on the root partition. The updatedb script also needs to be + # modified to correct an explicit path: + mv -v /usr/bin/find /bin + sed -i -e 's/find:=${BINDIR}/find:=\/bin/' /usr/bin/updatedb +} diff --git a/stage2/pkg/gdbm b/stage2/pkg/gdbm new file mode 100755 index 0000000..fae0104 --- /dev/null +++ b/stage2/pkg/gdbm @@ -0,0 +1,6 @@ +#!/bin/bash + +hvbuild_port() +{ + make install-compat +} diff --git a/stage2/pkg/groff b/stage2/pkg/groff new file mode 100755 index 0000000..9c4a6a2 --- /dev/null +++ b/stage2/pkg/groff @@ -0,0 +1,17 @@ +#!/bin/bash + +PAGE=letter + +CONFIGURE_OPTS="\ + --enable-multibyte + ${CONFIGURE_OPTS}" + +# Groff does not like to be made in parallel. + +hvbuild_post() +{ + # Some documentation programs, such as xman, will not work properly without + # the following symlinks: + ln -fsv eqn /usr/bin/geqn + ln -fsv tbl /usr/bin/gtbl +} diff --git a/stage2/pkg/gzip b/stage2/pkg/gzip new file mode 100755 index 0000000..fa9a1cf --- /dev/null +++ b/stage2/pkg/gzip @@ -0,0 +1,12 @@ +#!/bin/bash + +CONFIGURE_OPTS="\ + --bindir=/bin + ${CONFIGURE_OPTS}" + +hvbuild_post() +{ + # Move some programs that do not need to be on the root filesystem: + mv -fv /bin/{gzexe,uncompress,zcmp,zdiff,zegrep} /usr/bin + mv -fv /bin/{zfgrep,zforce,zgrep,zless,zmore,znew} /usr/bin +} diff --git a/stage2/pkg/inetutils b/stage2/pkg/inetutils new file mode 100755 index 0000000..b1ad3c1 --- /dev/null +++ b/stage2/pkg/inetutils @@ -0,0 +1,17 @@ +#!/bin/bash + +CONFIGURE_OPTS="\ + --libexecdir=/usr/sbin \ + --localstatedir=/var \ + --disable-ifconfig \ + --disable-logger \ + --disable-syslogd \ + --disable-whois \ + --disable-servers" + +hvbuild_post() +{ + # Move some programs to their FHS-compliant place: + mv -v /usr/bin/{hostname,ping,ping6} /bin + mv -v /usr/bin/traceroute /sbin +} diff --git a/stage2/pkg/iproute2 b/stage2/pkg/iproute2 index 855c1f7..990869c 100644 --- a/stage2/pkg/iproute2 +++ b/stage2/pkg/iproute2 @@ -1,7 +1,5 @@ #!/bin/bash -HV_NO_CONFIGURE_SCRIPT=1 - hvbuild() { # The arpd binary included in this package is dependent on Berkeley DB. diff --git a/stage2/pkg/kbd b/stage2/pkg/kbd new file mode 100755 index 0000000..060a57c --- /dev/null +++ b/stage2/pkg/kbd @@ -0,0 +1,16 @@ +#!/bin/bash + +# --datadir=/lib/kbd +# This option puts keyboard layout data in a directory that will +# always be on the root partition instead of the default /usr/share/kbd +CONFIGURE_OPTS="\ + --datadir=/lib/kbd + ${CONFIGURE_OPTS}" + +hvbuild_post() +{ + # Some of the scripts in the LFS-Bootscripts package depend on kbd_mode, + # openvt, and setfont. As /usr may not be available during the early stages + # of booting, those binaries need to be on the root partition: + mv -v /usr/bin/{kbd_mode,loadkeys,openvt,setfont} /bin +} diff --git a/stage2/pkg/linux b/stage2/pkg/linux index 71e7574..2065bf0 100644 --- a/stage2/pkg/linux +++ b/stage2/pkg/linux @@ -1,7 +1,5 @@ #!/bin/bash -HV_NO_CONFIGURE_SCRIPT=1 - hvbuild() { # The kernel sources were already copied into /usr/src in stage0 diff --git a/stage2/pkg/man-pages b/stage2/pkg/man-pages index 823d701..b99d563 100644 --- a/stage2/pkg/man-pages +++ b/stage2/pkg/man-pages @@ -1,9 +1,6 @@ #!/bin/bash -HV_NO_CONFIGURE_SCRIPT=1 - hvbuild() { - cd ${LFS_TMP}/${PACKAGE} - make install + make -C ${LFS_TMP}/${PACKAGE} install } diff --git a/stage2/pkg/module-init-tools b/stage2/pkg/module-init-tools new file mode 100755 index 0000000..44a2aa6 --- /dev/null +++ b/stage2/pkg/module-init-tools @@ -0,0 +1,25 @@ +#!/bin/bash + +# --enable-zlib-dynamic: To handle compressed kernel modules. +CONFIGURE_OPTS="\ + --enable-zlib-dynamic \ + --mandir=/usr/share/man \ + ${CONFIGURE_OPTS}" + +hvbuild() +{ + make -j ${MAKEJOBS} + + # INSTALL=install + # Normally, make install will not install the binaries if they already + # exist. This option overrides that behavior by calling install instead + # of using the default wrapper script. + make INSTALL=install install +} + +hvbuild_post() +{ + cat > /etc/modprobe.conf << "EOF" +# modprobe.conf +EOF +} diff --git a/stage2/pkg/perl b/stage2/pkg/perl index b689a73..79c19a8 100644 --- a/stage2/pkg/perl +++ b/stage2/pkg/perl @@ -2,20 +2,42 @@ hvconfig_pre() { - # Change a hardcoded path from /usr/include to /tools/include: - sed -i 's@/usr/include@/tools/include@g' ${LFS_TMP}/${PACKAGE}/ext/Errno/Errno_pm.PL + if [ "x${HVLABEL}" = "x${PERL}-pass1" ]; then + # Change a hardcoded path from /usr/include to /tools/include: + sed -i 's@/usr/include@/tools/include@g' \ + ${LFS_TMP}/${PACKAGE}/ext/Errno/Errno_pm.PL + + CONFIGURE_OPTS="\ + --prefix=/tools \ + -Dcc=gcc" + else + # By default, Perl's Compress::Raw::Zlib module builds and links against + # its own internal copy of Zlib. The following command will tell it to + # use the system-installed Zlib: + sed -i -e '/^BUILD_ZLIB/s/True/False/' \ + -e '/^INCLUDE/s,\./zlib-src,/usr/include,' \ + -e '/^LIB/s,\./zlib-src,/usr/lib,' \ + ${LFS_TMP}/${PACKAGE}/cpan/Compress-Raw-Zlib/config.in + + CONFIGURE_OPTS="\ + --prefix=/usr \ + -Dvendorprefix=/usr \ + -Dman1dir=/usr/share/man/man1 \ + -Dman3dir=/usr/share/man/man3 \ + -Dpager=\"/bin/less -isR\" \ + -Dusethreads -Duseshrplib" + fi } hvconfig() { cd ${LFS_TMP}/${PACKAGE} - - ./configure.gnu \ - --prefix=/tools \ - -Dcc="gcc" + ./configure.gnu ${CONFIGURE_OPTS} } hvbuild_post() { - ln -svfT /tools/bin/perl /usr/bin/perl + if [ "x${HVLABEL}" = "x${PERL}-pass1" ]; then + ln -svfT /tools/bin/perl /usr/bin/perl + fi } diff --git a/stage2/pkg/psmisc b/stage2/pkg/psmisc new file mode 100755 index 0000000..acd0241 --- /dev/null +++ b/stage2/pkg/psmisc @@ -0,0 +1,8 @@ +#!/bin/bash + +hvbuild_post() +{ + # Move the killall and fuser programs to the location specified by the FHS: + mv -v /usr/bin/fuser /bin + mv -v /usr/bin/killall /bin +} diff --git a/stage2/pkg/shadow b/stage2/pkg/shadow new file mode 100755 index 0000000..5dbd099 --- /dev/null +++ b/stage2/pkg/shadow @@ -0,0 +1,44 @@ +#!/bin/bash + +CONFIGURE_OPTS="\ + --without-selinux + ${CONFIGURE_OPTS}" + +hvconfig_pre() +{ + cd ${LFS_TMP}/${PACKAGE} + + # Disable the installation of the groups program and its man page, as + # Coreutils provides a better version. + sed -i 's/groups$(EXEEXT) //' src/Makefile.in + find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \; + + # Disable the installation of Chinese and Korean manual pages, since Man-DB + # cannot format them properly: + sed -i -e 's/ ko//' -e 's/ zh_CN zh_TW//' man/Makefile.in + + # Instead of using the default crypt method, use the more secure MD5 method + # of password encryption, which also allows passwords longer than 8 characters. + # It is also necessary to change the obsolete /var/spool/mail location for user + # mailboxes that Shadow uses by default to the /var/mail location used currently: + sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD MD5@' \ + -e 's@/var/spool/mail@/var/mail@' etc/login.defs +} + +hvbuild_post() +{ + var_add_shadow "ENV_SUPATH" /etc/login.defs "/usr/local/sbin:/usr/local/bin" + + # Move some misplaced symlinks/programs to their proper locations. + mv /usr/bin/passwd /bin + + # The -D option of the useradd program requires this directory for it + # to work properly. + mkdir -p /etc/default + + # To enable shadowed passwords: + pwconv + + # To enable shadowed group passwords: + grpconv +} diff --git a/stage2/pkg/sysklogd b/stage2/pkg/sysklogd new file mode 100755 index 0000000..2e84881 --- /dev/null +++ b/stage2/pkg/sysklogd @@ -0,0 +1,17 @@ +#!/bin/bash + +hvbuild_post() +{ + cat > /etc/syslog.conf << "EOF" +# /etc/syslog.conf + +auth,authpriv.* -/var/log/auth.log +*.*;auth,authpriv.none -/var/log/sys.log +daemon.* -/var/log/daemon.log +kern.* -/var/log/kern.log +mail.* -/var/log/mail.log +user.* -/var/log/user.log +cron.* -/var/log/cron.log +*.emerg * +EOF +} diff --git a/stage2/pkg/sysvinit b/stage2/pkg/sysvinit new file mode 100755 index 0000000..4a80bd8 --- /dev/null +++ b/stage2/pkg/sysvinit @@ -0,0 +1,19 @@ +#!/bin/bash + +hvconfig_pre() +{ + cd ${LFS_TMP}/${PACKAGE} + + sed -i 's@Sending processes@& configured via /etc/inittab@g' src/init.c + + # A maintained version of the wall program was installed earlier by + # Util-linux-ng. Suppress the installation of Sysvinit's version: + sed -i -e 's/utmpdump wall/utmpdump/' \ + -e 's/mountpoint.1 wall.1/mountpoint.1/' src/Makefile +} + +hvbuild() +{ + make -j ${MAKEJOBS} -C src + make -C src install +} diff --git a/stage2/pkg/texinfo b/stage2/pkg/texinfo new file mode 100755 index 0000000..b335f2d --- /dev/null +++ b/stage2/pkg/texinfo @@ -0,0 +1,6 @@ +#!/bin/bash + +hvbuild_post() +{ + make TEXMF=/usr/share/texmf install-tex +} diff --git a/stage2/pkg/udev b/stage2/pkg/udev new file mode 100755 index 0000000..ba93614 --- /dev/null +++ b/stage2/pkg/udev @@ -0,0 +1,29 @@ +#!/bin/bash + +CONFIGURE_OPTS="\ + --sbindir=/sbin \ + --with-rootlibdir=/lib \ + --libexecdir=/lib/udev \ + --docdir=/usr/share/doc/${PACKAGE} \ + --disable-extras \ + --disable-introspection \ + ${CONFIGURE_OPTS}" + +hvbuild_post() +{ + # Udev has to be configured in order to work properly, as its default + # configuration does not cover all devices. First install two extra + # rules files from Udev to help support device-mapper and RAID setups: + install -m644 -v rules/packages/64-*.rules \ + /lib/udev/rules.d/ + + # Now install a file to create symlinks for certain hand-held devices: + install -m644 -v rules/packages/40-pilot-links.rules \ + /lib/udev/rules.d/ + + # Now install a file to handle ISDN devices: + install -m644 -v rules/packages/40-isdn.rules \ + /lib/udev/rules.d/ + + install -m755 ${SCRDIR}/misc/udev-create-persistent-net.sh /usr/local/bin +} diff --git a/stage2/pkg/udev-config b/stage2/pkg/udev-config new file mode 100755 index 0000000..9a082eb --- /dev/null +++ b/stage2/pkg/udev-config @@ -0,0 +1,10 @@ +#!/bin/bash + +hvbuild() +{ + cd ${LFS_TMP}/${PACKAGE} + make install + + # Install the documentation that explains the LFS-specific rules files: + make install-doc +} diff --git a/stage2/post-install b/stage2/post-install new file mode 100755 index 0000000..3e65624 --- /dev/null +++ b/stage2/post-install @@ -0,0 +1,35 @@ +#!/bin/bash +set -o errexit + +# Reading system configuration informations, functions and package versions. +source ../sysinfos +source ../functions +source ../packages-list + +cat > /etc/default/useradd << "EOF" +# useradd defaults file +HOME=/home +INACTIVE=-1 +EXPIRE= +SHELL=/bin/bash +SKEL=/etc/skel +CREATE_MAIL_SPOOL=yes +EOF + +chmod -v 644 /etc/default/useradd + +if [ -n "${REGUSER}" ]; then + hv_useradd -g users -G audio,video,usb -s /bin/bash -m ${REGUSER} +fi + +echo "Copying /etc/skel files to root directory" +# Copy skel files to root directory. First create a copy to change owner +cp -au /etc/skel/.??* /root + +# Fixing ownership of directories /tmp and /var/log (may have been created by +# a regular user when fetching packages). +chown -v root:root /tmp +chown -v root:root /var +chown -v root:root /var/log + +exit $? diff --git a/stage2/stage2-install b/stage2/stage2-install deleted file mode 100755 index 869ab96..0000000 --- a/stage2/stage2-install +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash - -LFS_STAGE=stage2 - -export LFS_PKG_DIR="$(dirname $(pwd))/packages/${LFS_STAGE}" -export LFS_LOG_DIR=/var/log/hvlinux-install/${LFS_STAGE} -export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log -export LFS_TMP=/tmp - -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list -source /etc/profile - -if [ "x${USER}" != "xroot" ]; then - echo "You must be the superuser to install hvlinux." - exit 1 -fi - -init_log_file - -# Scripts directory -export SCRDIR=$(pwd) - -PERL_PASS1="1" ipkg ${PERL} cis-ac "${PERL}-pass1" -ipkg_ac ${KERNEL} -ipkg_ac ${MANPAGES} -ipkg_ac ${EGLIBC} -rscr once "Adjusting toolchain" cis-toolchain-adjust -rscr mult "Testing toolchain" cis-toolchain-test - -CPPFLAGS=-fexceptions CC="gcc -isystem /usr/include" \ - CXX="g++ -isystem /usr/include" LDFLAGS="-Wl,-rpath-link,/lib" \ - ipkg_ac ${GMP} "--enable-cxx --enable-mpbsd" - -CC="gcc -isystem /usr/include" LDFLAGS="-Wl,-rpath-link,/lib" \ - ipkg_ac ${MPFR} "--enable-shared --with-gmp=/usr" - -CC="gcc -isystem /usr/include" LDFLAGS="-Wl,-rpath-link,/lib" \ - ipkg_ac ${MPC} - -CPPFLAGS=-fexceptions CC="gcc -isystem /usr/include" \ - CXX="g++ -isystem /usr/include" \ - LDFLAGS="-Wl,-rpath-link,/lib" \ - ipkg_ac ${PPL} "--enable-shared --disable-optimization" - -CC="gcc -isystem /usr/include" LDFLAGS="-Wl,-rpath-link,/lib" \ - ipkg_ac ${CLOOG_PPL} "--enable-shared --with-gmp --with-ppl" - -ipkg_ac ${ZLIB} -ipkg_ac ${BINUTILS} -ipkg_ac ${GCC} -rscr mult "Testing toolchain" cis-toolchain-test - -ipkg_ac ${SED} "--bindir=/bin" -ipkg_ac ${PKG_CONFIG} -ipkg_ac ${NCURSES} -ipkg_ac ${UTIL_LINUX_NG} -ipkg_ac ${E2FSPROGS} -ipkg_ac ${COREUTILS} -HV_NO_CONFIGURE_SCRIPT=1 ipkg_ac ${IANA} -ipkg_ac ${MFOUR} -ipkg_ac ${BISON} -ipkg_ac ${PROCPS} -ipkg_ac ${LIBTOOL} -ipkg_ac ${FLEX} -ipkg_ac ${IPROUTE2} -PERL_PASS2="1" ipkg ${PERL} cis-ac "${PERL}-pass2" -ipkg_ac ${READLINE} -ipkg_ac ${AUTOCONF} -ipkg_ac ${AUTOMAKE} -ipkg_ac ${BASH} "--bindir=/bin --without-bash-malloc --with-installed-readline" - -/bin/bash +h -c ./install-2 - -exit $? diff --git a/stage2/stripping b/stage2/stripping new file mode 100755 index 0000000..92161d1 --- /dev/null +++ b/stage2/stripping @@ -0,0 +1,12 @@ +#!/bin/bash + +# Reading system configuration informations, functions and package versions. +source ../sysinfos +source ../functions +source ../packages-list + +/tools/bin/find /{,usr/}{bin,lib,sbin} -type f \ + -exec /tools/bin/strip --strip-debug '{}' ';' + +# Return success +exit 0 diff --git a/stage2/toolchain-adjust b/stage2/toolchain-adjust new file mode 100755 index 0000000..af99d6b --- /dev/null +++ b/stage2/toolchain-adjust @@ -0,0 +1,17 @@ +#!/bin/bash +set -o errexit + +# Reading system configuration informations, functions and package versions. +source ../sysinfos +source ../functions +source ../packages-list + +# Amend the GCC specs file so that it points to the new dynamic linker, and so +# that GCC knows where to find its start files. +gcc -dumpspecs | \ + sed \ + -e 's@/tools/lib/ld@/lib/ld@g' \ + -e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' > \ + `dirname $(gcc --print-libgcc-file-name)`/specs + +exit $? diff --git a/stage2/toolchain-test b/stage2/toolchain-test new file mode 100755 index 0000000..e169c69 --- /dev/null +++ b/stage2/toolchain-test @@ -0,0 +1,21 @@ +#!/bin/bash +set -o errexit + +# Reading system configuration informations, functions and package versions. +source ../sysinfos +source ../functions +source ../packages-list + +# Testing toolchain +cd /tmp +echo 'main(){}' > dummy.c +gcc dummy.c -Wl,--verbose &> dummy.log + +if ! readelf -l a.out | grep 'Requesting program interpreter: /lib/ld-linux.*.so.2' 1> /dev/null 2>&1 ; then + echo "String 'Requesting program interpreter: /lib/ld-linux.*.so.2' not found" + exit 1 +fi + +rm dummy.{c,log} a.out + +exit $? diff --git a/stage3/cis-ac-nobuild b/stage3/cis-ac-nobuild deleted file mode 120000 index 06c3fe7..0000000 --- a/stage3/cis-ac-nobuild +++ /dev/null @@ -1 +0,0 @@ -../stage2/cis-ac-nobuild \ No newline at end of file