From 8139fe913bbd64f066246292d0af9362bb7a998e Mon Sep 17 00:00:00 2001 From: gobo72 Date: Tue, 8 Mar 2011 23:28:50 +0000 Subject: [PATCH] =?utf8?q?M=C3=A9nage=20dans=20les=20sysinfos.=20Pr=C3=A9p?= =?utf8?q?aration=20cr=C3=A9ation=20r=C3=A9pertoire=20functions=20et=20pr?= =?utf8?q?=C3=A9paration=20pour=20utiliser=20sysinfos.default?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- config/sysinfos.amd64 | 81 +-- config/sysinfos.atom | 98 ---- config/sysinfos.default | 99 ++++ config/sysinfos.hp-mini | 39 ++ config/sysinfos.server | 96 ---- config/sysinfos.workstn | 89 --- functions | 1108 ------------------------------------ stage1/create-config-files | 3 +- 8 files changed, 149 insertions(+), 1464 deletions(-) delete mode 100644 config/sysinfos.atom create mode 100644 config/sysinfos.default create mode 100644 config/sysinfos.hp-mini delete mode 100644 config/sysinfos.server delete mode 100644 config/sysinfos.workstn delete mode 100644 functions diff --git a/config/sysinfos.amd64 b/config/sysinfos.amd64 index 7561c1a..149c8ab 100644 --- a/config/sysinfos.amd64 +++ b/config/sysinfos.amd64 @@ -1,98 +1,37 @@ #!/bin/bash -# This file contains the informations specific to the target system -# onto which Linux-HV will be installed +# This file contains the informations specific to the target system onto which +# HV-Linux will be installed. -# This is the number of make jobs that can be executed -# simultaneously. Normally, a value of 2 per processor -# gives good results. -MAKEJOBS=1 - -# Installation type: server, ltsp-server or workstation. INST_TYPE="workstation" - -# New user to create -REGUSER="hugo" +HVL_TARGET="x86_64" +MAKEJOBS=2 # Destination path where to install new Linux-HV system. This is usually where # you have mounted your new LFS partition, but it can also be any directory. # This is relevant only for stage 0 and 1. LFS="/mnt/hvlinux" - -# Destination partition where to install new Linux-HV system LFS_PARTITION="/dev/sdb7" - -# Boot partition (if applicable) BOOT_PARTITION="/dev/sdb1" - -# Swap partition (if applicable) SWAP_PARTITION="/dev/sdb2" -# Define this when cross-compiling to the desired target -# architecture. Default is x86 32-bits architecture (i686). -# arm926t - ARM 926T little endian -# x86 (i686) -# x86_64 (AMD Athlon 64) -HVL_TARGET="x86_64" - -# Used for setting machine-specific option in CFLAGS and CPPFLAGS -MARCH_FLAGS="-march=k8 -mtune=k8" +# New user to create +REGUSER="hugo" -# Keyboard mapping (example: us) -KEYBOARD="us" +# Define this if you want the mail addressed to the root user automatically be +# forwarded to someone else. +MAIL_ADMIN="hugo" -# X.org driver (comment to build all drivers) XORG_VIDEO_DRIVER="nouveau" -# Sound card support: yes or no -SOUND_CARD="yes" - -# Removable media drives -CDROM="/dev/sr0" - -# Set to yes to have SANE support -SANE_SUPPORT="yes" -# If your scanner is located onto a remote computer, define the following -# variable to the IP address of that remote computer. -SANE_SERVER="" - -# Define this if you want to use a remote CUPS print server -#CUPS_SERVER="server.hugovil.com" - -TIMEZONE="America/Montreal" - # General network settings INTERFACES="eth0" MACHINE_NAME="chambers64" DOMAIN="mongol.com" LAN_NETWORK_MASK="192.168.1.0/24" # Utilise par sane in stage3 -# Define to yes if you have a dynamic address and you use a dynamic dns -# service. -USE_DYNAMIC_DNS="no" -# Network interface card eth0 settings (ROUTEUR/INTERNET) +# Network interface card eth0 settings BOOTPROTO[0]="dhcp" -IP_ADDRESS[0]="" -PREFIX_LENGTH[0]="" -# GATEWAY is not required if using DHCP -GATEWAY[0]="" - -# DNS servers addresses (not required if using DHCP) -NAMESERVER[0]="" - -# Define this if you want the mail addressed to the root user automatically -# be forwarded to someone else -MAIL_ADMIN="hugo" - -# Define to unix (mbox) or mbx -MAILBOX_FORMAT=unix - -# Alternate port for Sendmail (comment this line to use the standard port 25) -SENDMAIL_PORT="25" - -# Alternate port for Apache (comment this line to use the standard port 80) -HTTPD_PORT="80" -APACHE_USER="www" # Samba support USE_SAMBA="no" diff --git a/config/sysinfos.atom b/config/sysinfos.atom deleted file mode 100644 index 2e8eb29..0000000 --- a/config/sysinfos.atom +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/bash - -# This file contains the informations specific to the target system -# onto which Linux-HV will be installed - -# This is the number of make jobs that can be executed -# simultaneously. Normally, a value of 2 per processor -# gives good results. -MAKEJOBS=1 - -# Installation type: server, ltsp-server or workstation. -INST_TYPE="workstation" - -# New user to create -REGUSER="hugo" - -# Destination path where to install new Linux-HV system. This is usually where -# you have mounted your new LFS partition, but it can also be any directory. -# This is relevant only for stage 0 and 1. -LFS="/mnt/stockage/hvlinux-hp-mini" - -# Destination partition where to install new Linux-HV system -LFS_PARTITION="/dev/sda3" - -# Boot partition (if applicable) -BOOT_PARTITION="/dev/sda1" - -# Swap partition (if applicable) -#SWAP_PARTITION="/dev/sdb2" - -# Define this when cross-compiling to the desired target -# architecture. Default is x86 32-bits architecture (i686). -# arm926t - ARM 926T little endian -# x86 (i686) -# x86_64 (AMD Athlon 64) -HVL_TARGET="x86" - -# Used for setting machine-specific option in CFLAGS and CPPFLAGS -MARCH_FLAGS="-march=atom -mtune=atom" - -# Keyboard mapping (example: us) -KEYBOARD="us" - -# X.org driver (comment to build all drivers) -XORG_VIDEO_DRIVER="intel" - -# Sound card support: yes or no -SOUND_CARD="yes" - -# Removable media drives. Comment if your system doesn't have one. -#CDROM="/dev/sr0" - -# Set to yes to have SANE support -SANE_SUPPORT="yes" -# If your scanner is located onto a remote computer, define the following -# variable to the IP address of that remote computer. -SANE_SERVER="" - -# Define this if you want to use a remote CUPS print server -#CUPS_SERVER="server.hugovil.com" - -TIMEZONE="America/Montreal" - -# General network settings -INTERFACES="eth0" -MACHINE_NAME="gresimuth" -DOMAIN="mongol.com" -LAN_NETWORK_MASK="192.168.1.0/24" # Utilise par sane in stage3 -# Define to yes if you have a dynamic address and you use a dynamic dns -# service. -USE_DYNAMIC_DNS="no" - -# Network interface card eth0 settings (ROUTEUR/INTERNET) -BOOTPROTO[0]="dhcp" -IP_ADDRESS[0]="" -PREFIX_LENGTH[0]="" -# GATEWAY is not required if using DHCP -GATEWAY[0]="" - -# DNS servers addresses (not required if using DHCP) -NAMESERVER[0]="" - -# Define this if you want the mail addressed to the root user automatically -# be forwarded to someone else -MAIL_ADMIN="hugo" - -# Define to unix (mbox) or mbx -MAILBOX_FORMAT=unix - -# Alternate port for Sendmail (comment this line to use the standard port 25) -SENDMAIL_PORT="25" - -# Alternate port for Apache (comment this line to use the standard port 80) -HTTPD_PORT="80" -APACHE_USER="www" - -# Samba support -USE_SAMBA="no" diff --git a/config/sysinfos.default b/config/sysinfos.default new file mode 100644 index 0000000..877ec2b --- /dev/null +++ b/config/sysinfos.default @@ -0,0 +1,99 @@ +#!/bin/bash + +# This file contains the default configuration options. These options can be +# overriden in sysinfos. + +# Define this when cross-compiling to the desired target architecture. Other +# possible values are: +# arm926t - ARM 926T little endian +# x86 (i686) +# x86_64 (AMD Athlon 64) +HVL_TARGET="x86" + +# Installation type: server, ltsp-server or workstation. +INST_TYPE="workstation" + +# Used for setting machine-specific option in CFLAGS and CPPFLAGS +MARCH_FLAGS="-march=native -fomit-frame-pointer" + +# This is the number of make jobs that can be executed simultaneously. +# Normally, a value of 2 per processor gives good results. +MAKEJOBS=2 + +# Destination path where to install new Linux-HV system. This is usually where +# you have mounted your new LFS partition, but it can also be any directory. +# This is relevant only for stage 0 and 1. +LFS="/mnt/hvlinux" +LFS_PARTITION="/dev/sdb7" +BOOT_PARTITION="/dev/sdb1" +SWAP_PARTITION="/dev/sdb2" + +# New user to create +REGUSER="" + +# Define this if you want the mail addressed to the root user automatically be +# forwarded to someone else. +MAIL_ADMIN="" + +# X.org driver (comment to build all drivers) +#XORG_VIDEO_DRIVER="intel" + +# Removable media drives. Comment if your system doesn't have one (default yes) +DVDROM="yes" + +# Sound card support: yes or no +SOUND_CARD="yes" + +# Keyboard mapping (example: us, cf) +KEYBOARD="us" + +# General network settings +INTERFACES="eth0 eth1" +MACHINE_NAME="server" +DOMAIN="mydomain.com" +LAN_NETWORK_MASK="192.168.0.0/24" + +# Network interface card #1 settings (INTERNET) +BOOTPROTO[0]="dhcp" # dhcp or static + +# Network interface card #2 settings (LAN) +# GATEWAY is optional, and is not required if using DHCP +BOOTPROTO[1]="static" +IP_ADDRESS[1]="192.168.0.1" +PREFIX_LENGTH[1]=24 +GATEWAY[0]="192.168.0.1" + +# DNS servers addresses (not required if using DHCP) +#NAMESERVER[0]="24.200.243.250" +#NAMESERVER[1]="24.201.245.106" +#NAMESERVER[2]="24.200.243.242" + +# Define to yes if you use a dynamic dns service. +USE_DYNAMIC_DNS="no" + +# Define to unix (mbox) or mbx +MAILBOX_FORMAT="unix" + +# Alternate port for Sendmail +SENDMAIL_PORT="25" + +# Alternate port for Apache +HTTPD_PORT="80" +APACHE_USER="www" + +# Samba support (default yes) +USE_SAMBA="yes" + +# Set to yes to have SANE support +SANE_SUPPORT="yes" + +# If your scanner is located onto a remote computer, define the following +# variable to the IP address of that remote computer. +SANE_SERVER="" + +# Define this if you want to use a remote CUPS print server +#CUPS_SERVER="server.mydomain.com" + +TIMEZONE="America/Montreal" + +DEFAULT_EDITOR="nano" diff --git a/config/sysinfos.hp-mini b/config/sysinfos.hp-mini new file mode 100644 index 0000000..b8586b6 --- /dev/null +++ b/config/sysinfos.hp-mini @@ -0,0 +1,39 @@ +#!/bin/bash + +# This file contains the informations specific to the target system onto which +# HV-Linux will be installed. + +INST_TYPE="workstation" +HVL_TARGET="x86" +MAKEJOBS=2 + +# Destination path where to install new Linux-HV system. This is usually where +# you have mounted your new LFS partition, but it can also be any directory. +# This is relevant only for stage 0 and 1. +LFS="/mnt/stockage/hvlinux-hp-mini" +LFS_PARTITION="/dev/sda3" +BOOT_PARTITION="/dev/sda1" + +# New user to create +REGUSER="hugo" + +# Define this if you want the mail addressed to the root user automatically be +# forwarded to someone else. +MAIL_ADMIN="hugo" + +XORG_VIDEO_DRIVER="intel" + +# Removable media drives. Comment if your system doesn't have one. +DVDROM="no" + +# General network settings +INTERFACES="eth0" +MACHINE_NAME="gresimuth" +DOMAIN="mongol.com" +LAN_NETWORK_MASK="192.168.1.0/24" # Utilise par sane in stage3 + +# Network interface card eth0 settings +BOOTPROTO[0]="dhcp" + +# Samba support +USE_SAMBA="no" diff --git a/config/sysinfos.server b/config/sysinfos.server deleted file mode 100644 index bc696f6..0000000 --- a/config/sysinfos.server +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/bash - -# This file contains the informations specific to the target system -# onto which Linux-HV will be installed - -# This is the number of make jobs that can be executed -# simultaneously. Normally, a value of 2 per processor -# gives good results. -MAKEJOBS=1 - -# Installation type: server, ltsp-server or workstation. -INST_TYPE="server" - -# New user to create -REGUSER="" - -# Destination path where to install new Linux-HV system. This is usually where -# you have mounted your new LFS partition, but it can also be any directory. -# This is relevant only for stage 0 and 1. -LFS="/mnt/hvlinux" - -# Destination partition where to install new Linux-HV system -LFS_PARTITION="/dev/hda10" - -# Boot partition (if applicable) -BOOT_PARTITION="/dev/hda1" - -# Swap partition (if applicable) -SWAP_PARTITION="/dev/hda5" - -# Define this when cross-compiling to the desired target -# architecture. Default is x86 32-bits architecture (i686). -# arm926t - ARM 926T little endian -# x86 (i686) -# x86_64 (AMD Athlon 64) -HVL_TARGET="x86_64" - -# Used for setting machine-specific option in CFLAGS and CPPFLAGS -MARCH_FLAGS="-march=k8" - -# Keyboard mapping (example: us) -KEYBOARD="us" - -# Sound card support: yes or no -SOUND_CARD="no" - -# Removable media drives -CDROM="/dev/hdc" -DVD="/dev/hdc" - -# Define this if you want to use a remote CUPS print server -#CUPS_SERVER="server.hugovil.com" - -TIMEZONE="America/Montreal" - -# General network settings -INTERFACES="eth0 eth1" -MACHINE_NAME="server" -DOMAIN="hugovil.com" -LAN_NETWORK_MASK="192.168.0.0/24" -# Define to yes if you have a dynamic address and you use a dynamic dns -# service. -USE_DYNAMIC_DNS="yes" - -# Network interface card #1 settings (INTERNET) -BOOTPROTO[0]="dhcp" -IP_ADDRESS[0]="" -# GATEWAY is not required if using DHCP -GATEWAY[0]="" - -# Network interface card #2 settings (LAN) -BOOTPROTO[1]="static" -IP_ADDRESS[1]="192.168.0.1" -PREFIX_LENGTH[1]=24 - -# DNS servers addresses (not required if using DHCP) -#NAMESERVER[0]="24.200.243.250" -#NAMESERVER[1]="24.201.245.106" -#NAMESERVER[2]="24.200.243.242" - -# Define this if you want the mail addressed to the root user automatically -# be forwarded to someone else -MAIL_ADMIN="hugo" - -# Define to unix (mbox) or mbx -MAILBOX_FORMAT=unix - -# Alternate port for Sendmail (comment this line to use the standard port 25) -SENDMAIL_PORT="25" - -# Alternate port for Apache (comment this line to use the standard port 80) -HTTPD_PORT="80" -APACHE_USER="www" - -# Samba support -USE_SAMBA="no" diff --git a/config/sysinfos.workstn b/config/sysinfos.workstn deleted file mode 100644 index f178f65..0000000 --- a/config/sysinfos.workstn +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/bash - -# This file contains the informations specific to the target system -# onto which Linux-HV will be installed - -# This is the number of make jobs that can be executed -# simultaneously. Normally, a value of 2 per processor -# gives good results. -MAKEJOBS=1 - -# Installation type: server, ltsp-server or workstation. -INST_TYPE="workstation" - -# New user to create -REGUSER="" - -# Destination path where to install new Linux-HV system. This is usually where -# you have mounted your new LFS partition, but it can also be any directory. -# This is relevant only for stage 0 and 1. -LFS="/mnt/hvlinux" - -# Destination partition where to install new Linux-HV system -LFS_PARTITION="/dev/hda10" - -# Boot partition (if applicable) -BOOT_PARTITION="/dev/hda1" - -# Swap partition (if applicable) -SWAP_PARTITION="/dev/hda5" - -# Define this when cross-compiling to the desired target -# architecture. Default is x86 32-bits architecture (i686). -# arm926t - ARM 926T little endian -# x86 (i686) -# x86_64 (AMD Athlon 64) -HVL_TARGET="x86_64" - -# Used for setting machine-specific option in CFLAGS and CPPFLAGS -MARCH_FLAGS="-march=k8" - -# Keyboard mapping (example: us) -KEYBOARD="us" - -# Sound card support: yes or no -SOUND_CARD="yes" - -# Removable media drives -CDROM="/dev/hdc" -DVD="/dev/hdc" - -#-------------------- -# SCANNER definitions -#-------------------- -# Set to yes to have SANE support -SANE_SUPPORT="no" -# Define to the driver name corresponding to your scanner, if you have one -# (see SANE documentation for drivers name). Comment out if you will be using -# a scanner on a remote computer. -SANE_DRIVER="" -# If your scanner is located onto a remote computer, define the following -# variable to the IP address of that remote computer. -SANE_SERVER="" - -# Define this if you want to use a remote CUPS print server -CUPS_SERVER="server.hugovil.com" - -# Samba support -USE_SAMBA="no" - -TIMEZONE="America/Montreal" - -# General network settings -INTERFACES="eth0" -MACHINE_NAME="workstation" -DOMAIN="hugovil.com" -LAN_NETWORK_MASK="192.168.0.0/24" -# Define to yes if you have a dynamic address and you use a dynamic dns -# service. -#USE_DYNAMIC_DNS="yes" - -# Network interface card #1 settings (LAN) -BOOTPROTO[0]="static" -IP_ADDRESS[0]="192.168.0.2" -PREFIX_LENGTH[0]="24" -# GATEWAY is not required if using DHCP -GATEWAY[0]="192.168.0.1" - -# DNS server addresses (not required if using DHCP) -NAMESERVER[0]="192.168.0.1" diff --git a/functions b/functions deleted file mode 100644 index 89230b9..0000000 --- a/functions +++ /dev/null @@ -1,1108 +0,0 @@ -#!/bin/bash -set -o errtrace # Let shell functions inherit ERR trap. -set -o errexit - -# Constants for return codes -EXIT_SUCCESS=0 -EXIT_WARNING=1 -EXIT_FAILURE=2 - -# Position the cursor at the start of the line -SET_CURSOR_START_LINE="\033[1G" -# NORMAL prints text in normal color -NORMAL="\033[0;39m" -# SUCCESS prints text in a green colour -SUCCESS="\033[1;32m" -# WARNING prints text in a yellow colour -WARNING="\033[1;33m" -# FAILURE prints text in a red colour -FAILURE="\033[1;31m" -# Brackets are blue -BRACKET="\033[1;34m" - -TAR_OPTS="-b8" - -# List of default archive extensions to try -MY_ARCH_EXT="tar.bz2 tar.gz tgz tar.Z zip" - -HV_FONTS_PATH="/usr/share/fonts" - -DEFAULT_EDITOR=nano - -DEFAULT_IPKG_SCRIPT="ipkg.def" - -source ./stage.def - -# It seems that when compiling bash-4.0, using -# "make -j 1" is causing problems... -if [ "x${MAKEJOBS}" = "x1" ]; then - HVMAKE="make" -else - HVMAKE="make -j ${MAKEJOBS}" -fi - -case "${HVL_TARGET}" in - arm*) - CLFS_BUILDFLAGS="-mabi=aapcs-linux -mfloat-abi=soft" - CLFS_TARGET="arm-linux-gnueabi" - CLFS_ARCH=$(echo ${CLFS_TARGET} | sed -e 's/-.*//' -e 's/arm.*/arm/g') - CLFS_ENDIAN=$(echo ${CLFS_ARCH} | sed -e 's/armeb/BIG/' -e 's/arm/LITTLE/') - if [ "${CLFS_ENDIAN}" = "LITTLE" ]; then - CLFS_NOT_ENDIAN="BIG" - else - CLFS_NOT_ENDIAN="LITTLE" - fi - ;; - "x86_64") - CLFS_BUILDFLAGS="-m64" - CLFS_TARGET="${HVL_TARGET}-unknown-linux-gnu" - CLFS_ARCH=${HVL_TARGET} - ;; - "x86") - # No special flags - CLFS_BUILDFLAGS="" - CLFS_TARGET="i686-unknown-linux-gnu" - CLFS_ARCH=${HVL_TARGET} - ;; - *) - echo "Unsupported target architecture: ${HVL_TARGET}" - return ${EXIT_FAILURE} - ;; -esac - -CLFS_HOST="$(echo $MACHTYPE | \ - sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")" - -export CLFS_BUILDFLAGS CLFS_TARGET CLFS_ARCH CLFS_HOST CLFS_ENDIAN CLFS_NOT_ENDIAN - -if [ -z "${LFS_STAGE}" ]; then - echo "LFS_STAGE is undefined (see stage.def)" - return ${EXIT_FAILURE} -fi - -if [ "x${LFS_STAGE}" != "xstage0" -a "x${LFS_STAGE}" != "xstage1" ] ;then - LFS="" -fi - -CLFS=${LFS} - -# Create log directory and log file for current stage if necessary -# This should be done automatically... -init_log_file() -{ - # Scripts directory - export SCRDIR=$(pwd) - - 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" - - mkdir -p ${LFS_LOG_DIR} && - if [ ! -f ${LFS_LOG_FILE} ]; then - touch ${LFS_LOG_FILE} || exit 1 - fi -} - -# Extracting the version number from a complete package name. -# Arg. #1: Complete package name with version (ex: firefox-3.5.5.source will output 3.5.5) -get_pkg_ver() -{ - # Checking for correct number of arguments - if [ $# -ne 1 ]; then - echo "${FUNCNAME}(), wrong number of arguments: ${*}" - return 1 - fi - - echo ${1} | sed "s!.*-\([0-9].*\)!\1!g" -} - -# Extracting the base version number from a complete package name. -# Arg. #1: Complete package name with version (ex: gcc-3.4.4 will output 3.4) -get_pkg_ver_base() -{ - # Checking for correct number of arguments - if [ $# -ne 1 ]; then - echo "${FUNCNAME}(), wrong number of arguments: ${*}" - return 1 - fi - - echo ${1} | sed "s!^.*-\([0-9]*\.[0-9]*\).*!\1!g" -} - -# Extracting the base version number from a complete package name. -# Arg. #1: Complete package name with version (ex: gcc-3.4.4 will output 3) -get_pkg_ver_major() -{ - # Checking for correct number of arguments - if [ $# -ne 1 ]; then - echo "${FUNCNAME}(), wrong number of arguments: ${*}" - return 1 - fi - - echo ${1} | sed "s!^.*-\([0-9]*\)\..*!\1!g" -} - -# Extracting the name from a complete package name. -# Arg. #1: Complete package name with version (ex: gcc-3.4.4 will output gcc) -get_pkg_name() -{ - # Checking for correct number of arguments - if [ $# -ne 1 ]; then - echo "${FUNCNAME}(), wrong number of arguments: ${*}" - return 1 - fi - - # SED do not support non-greedy regexp: - # We want to match any characters preceeding a dash followed by a number - # (shortest match -> non-greedy) - echo ${1} | sed "s!\([^-][^0-9]*\)-[0-9].*!\1!" -} - -# Saves the content of CFLAGS and CXXFLAGS environment variables. -save_flags() -{ - export OLDCFLAGS=${CFLAGS} - export OLDCXXFLAGS=${CXXFLAGS} - - return ${EXIT_SUCCESS} -} - -# Saves the content of CFLAGS and CXXFLAGS environment variables, and then -# set them to empty strings. -save_flags_no_optimizations() -{ - export OLDCFLAGS=${CFLAGS} - export OLDCXXFLAGS=${CXXFLAGS} - export CFLAGS="" - export CXXFLAGS="" - - return ${EXIT_SUCCESS} -} - -# Restores the previous values of CFLAGS and CXXFLAGS environment variables. These -# must have been saved first using save_flags(). -restore_flags() -{ - export CFLAGS=${OLDCFLAGS} - export CXXFLAGS=${OLDCXXFLAGS} - - return ${EXIT_SUCCESS} -} - -# Create symbolic links for start/stop scripts in /etc/rc.d -# -# Arg #1: script name -# Arg #2: start number -# Arg #3: stop number -# Arg #4: level -static_bootscript_add() -{ - local SCRIPTNAME=${1} - local START=${2} - local STOP=${3} - local RCLEVEL=${4} - - local START_LEVELS="" - local STOP_LEVELS="" - - if [ "x${RCLEVEL}" = "xsysinit" ]; then - START_LEVELS="sysinit" - STOP_LEVELS="0 6" - elif [ "x${RCLEVEL}" = "x3" ]; then - START_LEVELS="3 4 5" - STOP_LEVELS="0 1 2 6" - else - echo "${FUNCNAME}(), invalid level argument : ${*}" - return 1 - fi - - # Making sure bootscript has correct permissions - chmod -v 740 ${LFS}/etc/rc.d/init.d/${SCRIPTNAME} - - # Removing any old links - for level in sysinit 0 1 2 3 4 5 6; do - cd ${LFS}/etc/rc.d/rc${level}.d - rm -v -f $(find . -name "???${SCRIPTNAME}") - done - - if [ ${START} -ne 0 ]; then - # Creating new start links - for level in ${START_LEVELS}; do - cd ${LFS}/etc/rc.d/rc${level}.d - ln -v -s ../init.d/${SCRIPTNAME} S${START}${SCRIPTNAME} - done - fi - - if [ ${STOP} -ne 0 ]; then - # Creating new stop links - for level in ${STOP_LEVELS}; do - cd ${LFS}/etc/rc.d/rc${level}.d - ln -v -s ../init.d/${SCRIPTNAME} K${STOP}${SCRIPTNAME} - done - fi -} - -# Create symbolic links for start/stop scripts in /etc/rc.d -# -# Arg #1: level -# Arg #2: script name -# Arg #3: start number -# Arg #4: stop number -bootscript_add_manual() -{ - local RCLEVEL=${1} - local SCRIPTNAME=${2} - local START=${3} - local STOP=${4} - - # Making sure bootscript has correct permissions - chmod 740 ${LFS}/etc/rc.d/init.d/${SCRIPTNAME} - - # Removing any old links - cd ${LFS}/etc/rc.d/rc${RCLEVEL}.d - rm -v -f $(find . -name "???${SCRIPTNAME}") - - if [ ${START} -ne 0 ]; then - # Creating new start link - cd ${LFS}/etc/rc.d/rc${RCLEVEL}.d - ln -v -s ../init.d/${SCRIPTNAME} S${START}${SCRIPTNAME} - fi - - if [ ${STOP} -ne 0 ]; then - # Creating new stop link - cd ${LFS}/etc/rc.d/rc${RCLEVEL}.d - ln -v -s ../init.d/${SCRIPTNAME} K${STOP}${SCRIPTNAME} - fi -} - -# Create symbolic links for start/stop scripts in /etc/rc.d -# -# Arg #1: script name -# Arg #2: start number -# Arg #3: stop number -bootscript_add_rc3() -{ - static_bootscript_add ${*} 3 -} - -# Create symbolic links for start/stop scripts in /etc/rc.d -# -# Arg #1: script name -# Arg #2: start number -# Arg #3: stop number -bootscript_add_rcsysinit() -{ - static_bootscript_add ${*} sysinit -} - -# Add "export" before the variable name -# -# Arg #1: variable name -# Arg #2: filename where the variable is located -var_export() -{ - VARIABLE=${1} - FILE=${2} - - # Checking for correct number of arguments - if [ $# -ne 2 ]; then - echo "${FUNCNAME}(), wrong number of arguments: ${*}" - return 1 - fi - - # Checking if file exists - if [ ! -f ${FILE} ]; then - echo "${FUNCNAME}(), file not found: ${FILE}" - return 1 - fi - - # Checking if variable exists - if ! grep "${VARIABLE}=" ${FILE} 1> /dev/null 2>&1; then - echo "${FUNCNAME}(), variable not found: ${VARIABLE}" - return 1 - fi - - # Checking if variable is already exported when it is defined - if grep "${VARIABLE}=" ${FILE} | grep "export " 1> /dev/null 2>&1; then - echo "${FUNCNAME}(), variable already exported in definition: ${VARIABLE}" - return 0 - fi - - # Checking if variable is already exported, in - # a "export VARIABLE1 VARIABLE2..." statement - if grep "export " ${FILE} | grep " ${VARIABLE}" 1> /dev/null 2>&1; then - echo "${FUNCNAME}(), variable already exported in export list: ${VARIABLE}" - return 0 - fi - - sed -i "s!\(^${VARIABLE}=.*\)!export \1!" ${FILE} -} - -# Adding a new environment variable to a file. -# -# Arg #1: variable name -# Arg #2: filename where the variable is located -# Arg #3: new variable value -# Arg #4: separator string (usually a " " or ":") -var_add() -{ - VARIABLE=${1} - FILE=${2} - VALUE="${3}" - SEP="${4}" - - # Checking for correct number of arguments - if [ $# -ne 4 ]; then - echo "${FUNCNAME}(), wrong number of arguments: ${*}" - return 1 - fi - - # Checking if file exists - if [ ! -f ${FILE} ]; then - echo "${FUNCNAME}(), file not found: ${FILE}" - return 1 - fi - - # Checking if variable exists - if ! grep "${VARIABLE}=" ${FILE} 1> /dev/null 2>&1; then - echo "${VARIABLE}=\"${VALUE}\"" >> ${FILE} - return $? - fi - - # Checking if variable contains the new value - if grep "${VARIABLE}=" ${FILE} | grep "${VALUE}" 1> /dev/null 2>&1; then - echo "${FUNCNAME}(), variable ${VARIABLE} already contains value: ${VALUE}" - return 0 - fi - - # Adding new value to variable (case where no export before) - # We search for the variable name starting at the beginning of the line - # For example, this ensures that if the variable name is PATH, then - # PATH=... matches but not MANPATH=... - if grep "^${VARIABLE}=\"" ${FILE} 1> /dev/null 2>&1; then - # Variable value is enclosed by double-quotes - sed -i "s!\(^${VARIABLE}=\".*\)\(\"\)!\1${SEP}${VALUE}\"!" ${FILE} - else - # Variable value is NOT enclosed by double-quotes - sed -i "s!\(^${VARIABLE}=.*\)!\1${SEP}${VALUE}!" ${FILE} - fi - - # Adding new value to variable (case with export before) - # We search for the variable name starting after an export statement, - # at the beginning of a line. - # For example, this ensures that if the variable name is PATH, then - # PATH=... matches but not MANPATH=... - if grep "^export ${VARIABLE}=\"" ${FILE} 1> /dev/null 2>&1; then - # Variable value is enclosed by double-quotes - sed -i "s!\(^export ${VARIABLE}=\".*\)\(\"\)!\1${SEP}${VALUE}\"!" ${FILE} - else - # Variable value is NOT enclosed by double-quotes - sed -i "s!\(^export ${VARIABLE}=.*\)!\1${SEP}${VALUE}!" ${FILE} - fi - - return $? -} - -# Adding a new path environment variable to a file. -# -# Arg #1: variable name -# Arg #2: filename where the variable is located -# Arg #3: new variable value -var_add_path() -{ - var_add ${1} ${2} "${3}" ":" 1>> ${LFS_LOG_FILE} 2>&1 -} - -# Adding a new string environment variable to a file. -# -# Arg #1: variable name -# Arg #2: filename where the variable is located -# Arg #3: new variable value -var_add_str() -{ - var_add ${1} ${2} "${3}" " " -} - -# Adding a new string to a file. -# -# Arg #1: string -# Arg #2: filename where the variable is located -string_add() -{ - STRING="${1}" - FILE=${2} - - # Checking for correct number of arguments - if [ $# -ne 2 ]; then - echo "${FUNCNAME}(), wrong number of arguments: ${*}" - return 1 - fi - - # Checking if file exists - if [ ! -f ${FILE} ]; then - echo "${FUNCNAME}(), file not found: ${FILE}" - return 1 - fi - - # Checking if string exists - if grep "${STRING}" ${FILE} 1> /dev/null 2>&1; then - echo "${FUNCNAME}(), string already defined: ${STRING}" - return 0 - fi - - echo "${STRING}" >> ${FILE} -} - -# Adding a new environment variable to a shadow password suite file (login.defs) -# -# Arg #1: variable name -# Arg #2: filename where the variable is located -# Arg #3: new variable value -var_add_shadow() -{ - VARIABLE=${1} - FILE=${2} - VALUE="${3}" - - # Checking for correct number of arguments - if [ $# -ne 3 ]; then - echo "${FUNCNAME}(), wrong number of arguments: ${*}" - return 1 - fi - - # Checking if file exists - if [ ! -f ${FILE} ]; then - echo "${FUNCNAME}(), file not found: ${FILE}" - return 1 - fi - - # Checking if variable contains the new value - if egrep "^${VARIABLE}" ${FILE} | grep "${VALUE}" 1> /dev/null 2>&1; then - echo "${FUNCNAME}(), variable ${VARIABLE} already contains value: ${VALUE}" - return 0 - fi - - # Adding new value to variable - # We search for the variable name starting at the beginning of the line - # For example, this ensures that if the variable name is PATH, then - # PATH... matches but not MANPATH... - sed -i "s!\(^${VARIABLE}.*\)!\1:${VALUE}!" ${FILE} -} - -# Adding a new group, checking if it already exist before. -# Arguments: same arguments as for standard groupadd command. -hv_groupadd() -{ - arguments=${*} - - # The last argument is the group name - while [ $# -ne 0 ]; do - groupname=${*} - shift - done - - if ! cat /etc/group | egrep "^${groupname}:" 1> /dev/null 2>&1; then - groupadd ${arguments} - fi -} - -# Adding a new user, checking if it already exist before -# Arguments: same arguments as for standard useradd command. -hv_useradd() -{ - arguments="${*}" - - # The last argument is the user name - while [ $# -ne 0 ]; do - username=${*} - shift - done - - if ! cat /etc/passwd | egrep "^${username}:" 1> /dev/null 2>&1; then - useradd ${arguments} - fi -} - -# Applying patch -# First argument is the name of the patch -# Second argument is the package name (target dir in $LFS_TMP) -apply_patch() -{ - local PATCH_FILE=${1} - local TARGET_DIR=${2} - - if [ -z "${PATCH_FILE}" ]; then - echo - echo "apply_patch(): no patch specified." - return ${EXIT_FAILURE} - fi - - if [ ! -f ${LFS_PKG_DIR}/${PATCH_FILE} ]; then - echo - echo "${FUNCNAME}(): patch file '${PATCH_FILE}' not found." - return ${EXIT_FAILURE} - fi - - echo "Applying patch: ${PATCH_FILE}" - patch -Np1 -d ${LFS_TMP}/${TARGET_DIR} -i ${LFS_PKG_DIR}/${PATCH_FILE} -} - -# Applying any patch(es) found for the current package. -# Will work only if patches have the same base name as -# the package, followed by a dash: -# ${1}-*.patch -# -# 1st argument: Package name -# 2: optional target directory. -apply_patches() -{ - PACKAGE=${1} - local TARGET_DIR=${PACKAGE} - - # Checking for correct number of arguments - if [ $# -gt 2 ]; then - echo "${FUNCNAME}(), wrong number of arguments: ${*}" - echo "Usage: ${FUNCNAME} PACKAGE-NAME" - exit ${EXIT_FAILURE} - fi - - if [ $# -eq 2 ]; then - TARGET_DIR=${2} - else - TARGET_DIR=${PACKAGE} - fi - - # Checking if we can find at least one patch. - if ls ${LFS_PKG_DIR}/${1}-*.patch 1> /dev/null 2>&1; then - cd ${LFS_PKG_DIR} - for patch in ${1}-*.patch; do - apply_patch ${patch} ${TARGET_DIR} - done - fi - - return $? -} - -# Obtain the name of the base directory for the decompressed package. -# First argument: package name -static_decompressed_dirname() -{ - local PACKAGE=${1} - - for arch_ext in ${MY_ARCH_EXT}; do - if [ ! -f ${LFS_PKG_DIR}/${PACKAGE}.${arch_ext} ]; then - # Try next archive extension. - continue; - fi - - case ${arch_ext} in - tar.bz2|tar.gz|tgz|tar.Z) - # Remove optional "./" leading component with sed - # and extract base directory name with awk. - # tar 1.23 reports an error when using pipes, so - # remove error message with "2> /dev/null" - local DIRNAME=$(tar ${TAR_OPTS} -tf ${LFS_PKG_DIR}/${PACKAGE}.tar.bz2 2> /dev/null | head -n1 | sed 's!^\./!!' | awk -F \/ '{print $1}') - echo ${DIRNAME} - ;; - zip) - # TODO - echo ${PACKAGE} - ;; - esac - - return $? - done - - # Failure or file not found - echo "${FUNCNAME}(): Missing source package for \"${PACKAGE}\"" > /dev/stderr - return ${EXIT_FAILURE} -} - -# Decompression of a package -# First argument: package name -# Second argument: directory where decompressing (optional, defaults to LFS_TMP) -decompress_package() -{ - # Checking for correct number of arguments - if [ $# -eq 1 ]; then - local TOPDIR=${LFS_TMP} - elif [ $# -eq 2 ]; then - local TOPDIR=${2} - else - echo "${FUNCNAME}(): Incorrect number of arguments (must be 1 or 2)" > /dev/stderr - return ${EXIT_FAILURE} - fi - - local PACKAGE=${1} - - for arch_ext in ${MY_ARCH_EXT}; do - if [ ! -f ${LFS_PKG_DIR}/${PACKAGE}.${arch_ext} ]; then - # Try next archive extension. - continue; - fi - - if [ -d ${TOPDIR}/${PACKAGE} ]; then - # Removing old source directory (if any) - rm -rf ${TOPDIR}/${PACKAGE} - fi - - # Decompressing package - case ${arch_ext} in - tar.bz2) - tar -C ${TOPDIR} ${TAR_OPTS} -jxf \ - ${LFS_PKG_DIR}/${PACKAGE}.${arch_ext} - ;; - tar.gz|tgz|tar.Z) - tar -C ${TOPDIR} ${TAR_OPTS} -zxf \ - ${LFS_PKG_DIR}/${PACKAGE}.${arch_ext} - ;; - zip) - unzip -qq -d ${TOPDIR} ${LFS_PKG_DIR}/${PACKAGE}.${arch_ext} - ;; - esac - - return $? - done - - # Failure or file not found - echo "${FUNCNAME}(): Missing source package for \"${PACKAGE}\"" > /dev/stderr - return ${EXIT_FAILURE} -} - -hvtrap_setup() -{ - # Setting ERR trap does implicit `set -o errexit'. - trap hvtrap_err ERR - trap hvtrap_int INT -} - -hvtrap_err() -{ - echo - echo "*** An error occured during ${LFS_STAGE}" - exit 1 -} - -hvtrap_int() -{ - echo - echo "*** Installation interrupted during ${LFS_STAGE}" - exit 1 -} - -ipkg_trap_setup() -{ - exec 6>&1 # Save current "value" of stdout. - trap ipkg_trap_handler INT TERM EXIT ERR -} - -ipkg_trap_end() -{ - trap - INT TERM EXIT ERR - - # Restore global trap - hvtrap_setup -} - -ipkg_trap_handler() -{ - exec 1>&6 6>&- # Restore stdout and close file descriptor #6. - print_status failure - - ipkg_trap_end - exit 1 -} - -ipkg_display_build_infos() -{ - echo "hvlinux: configure options:" - for opt in ${CONFIGURE_OPTS}; do - echo " ${opt}" - done - echo "hvlinux: environment variables:" - echo " HOST: ${CLFS_HOST}" - echo " TARGET: ${CLFS_TARGET}" - echo " BUILD64: ${BUILD64}" - echo " CFLAGS: ${CFLAGS}" - echo " CPPFLAGS: ${CPPFLAGS}" - echo " CXXFLAGS: ${CFLAGS}" - echo " LDFLAGS: ${LDFLAGS}" - echo " RANLIB: ${RANLIB}" - echo " CC: ${CC}" - echo " CXX: ${CXX}" - echo " AR: ${AR}" - echo " AS: ${AS}" - echo " PATH: ${PATH}" -} - -# Installation of a package -# 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 (default) -# acnb Standard autoconf package, build in source dir -# noac No autoconf (configure) -# gnome -# xorg -# pm -# -s Name of script to source (default is from name of package) -ipkg() -{ - START_TIME=$(echo `date +%s`) - - unset ALT_SCRIPT_NAME - export IPKG_MODE="ac" - export HVLABEL="" # Global variable - - while getopts "hl:m:s:" 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 - ALT_SCRIPT_NAME=${OPTARG} - ;; - ?) - echo "${FUNCNAME}(): Invalid option: ${OPTARG}." - return 1 - ;; - esac - done - shift `expr "${OPTIND}" - 1` - - unset OPTSTRING - unset OPTIND - unset OPTARG - - export PACKAGE=${1} - - # Checking for correct number of arguments - if [ $# -lt 1 ]; then - echo - echo "${FUNCNAME}(): Missing argument" - echo " command was: \"${FUNCNAME}() $*\"" - exit ${EXIT_FAILURE} - fi - - shift - export CONFIGURE_OPTS=${*} - - if [ -z "${HVLABEL}" ]; then - # Default label = package name and version - HVLABEL=${PACKAGE} - fi - - PACKAGE_LOG=${LFS_LOG_DIR}/${HVLABEL}.log - - # Checking if package was previously successfully installed - if grep "^${HVLABEL} successfully installed" ${LFS_LOG_FILE} \ - 1> /dev/null 2>&1; then - return $EXIT_SUCCESS - fi - - # Displaying label - MSGSTRING="Installing ${HVLABEL}" - display_checkbox_msg ${MSGSTRING} - - ipkg_trap_setup - - echo "------------------------" 1>> ${LFS_LOG_FILE} - echo "${MSGSTRING}" 1>> ${LFS_LOG_FILE} - - exec 7>&1 # Save current "value" of stdout. - # All output from commands in this block sent to file $LFS_LOG_FILE. - exec >> ${LFS_LOG_FILE} 2>&1 - ipkg_display_build_infos - exec 1>&7 7>&- # Restore stdout and close file descriptor #7. - - # All output from commands in this block sent to file $PACKAGE_LOG. - exec > ${PACKAGE_LOG} 2>&1 - - # Sourcing standard ac script. - source ${SCRDIR}/../functions-ipkg - source ${SCRDIR}/${DEFAULT_IPKG_SCRIPT} - ipkg_script ${ALT_SCRIPT_NAME} - - # Make sure we are at a known location - cd ${SCRDIR} - - exec 1>&6 # Restore stdout. - - # Writing success string to the end of the log file - echo "${HVLABEL} successfully installed" 1>> ${LFS_LOG_FILE} - - # Displaying build time after the package name - print_status success - - ipkg_trap_end - - return $EXIT_SUCCESS -} - -# Display the action name, run a command, log its output and display it's -# status. Write to install log file when successfully completed so it -# won't be called again after a successfull installation. - -# First argument: "once" -> script is run only once -# "mult" -> script can be run more than once -# Second argument: Message to display during script -# Third argument: script name (will be label) -rscr() -{ - START_TIME=$(echo `date +%s`) - - # Checking for correct number of arguments - if [ $# -lt 3 ]; then - echo "${FUNCNAME}(): Missing argument(s)" - exit ${EXIT_FAILURE} - fi - - SCRMODE=${1} - MSGSTRING=${2} - SCRIPT=${3} - HVLABEL=${SCRIPT} - shift - shift - SCRIPT_ARGS=${*} - - # Make sure we are at a known location - cd ${SCRDIR} - - # Checking script mode: - if [ "x${SCRMODE}" != "xonce" -a "x${SCRMODE}" != "xmult" ]; then - echo "${FUNCNAME}(): First argument invalid, must be \"once\" or \"mult\" (\"${SCRMODE}\" given)" - exit ${EXIT_FAILURE} - fi - - # Checking if script is valid and executable - if [ ! -x ${SCRDIR}/${SCRIPT} ]; then - echo "${FUNCNAME}(): script not found: ${SCRIPT}" - exit ${EXIT_FAILURE} - fi - - PACKAGE_LOG=${LFS_LOG_DIR}/${HVLABEL}.log - - if [ "x${SCRMODE}" = "xonce" ]; then - # Checking if package was previously successfully installed - if grep "^${HVLABEL} successfully installed" ${LFS_LOG_FILE} 1> /dev/null 2>&1; then - return $EXIT_SUCCESS - fi - fi - - display_checkbox_msg ${MSGSTRING} - - ipkg_trap_setup - - echo "------------------------" 1>> ${LFS_LOG_FILE} - echo ${HVLABEL} 1>> ${LFS_LOG_FILE} - - # Executing script - ${SCRDIR}/${SCRIPT} ${SCRIPT_ARGS} 1>> ${PACKAGE_LOG} 2>&1 - - if [ "x${SCRMODE}" = "xonce" ]; then - # Writing success string to the end of the log file - echo "${HVLABEL} successfully installed" 1>> ${LFS_LOG_FILE} - fi - - # Displaying build time after the package name - print_status success - - ipkg_trap_end - - return $EXIT_SUCCESS -} - -rcmd_trap_setup() -{ - exec 6>&1 # Save current "value" of stdout. - trap rcmd_trap_handler INT TERM EXIT ERR -} - -rcmd_trap_end() -{ - trap - INT TERM EXIT ERR - - # We do not restore global trap -} - -rcmd_trap_handler() -{ - exec 1>&6 6>&- # Restore stdout to fd #6, where it had been saved, - # and close file descriptor #6. - print_status failure - - rcmd_trap_end - if [ -n "${RCMD_NO_EXIT}" ]; then - return ${EXIT_FAILURE} - else - exit ${EXIT_FAILURE} - fi -} - -# Run command, no log -# First argument: Message to display during script -# Second argument: command + arguments -rcmd() -{ - START_TIME=$(echo `date +%s`) - - # Checking for correct number of arguments - if [ $# -lt 2 ]; then - echo "${FUNCNAME}(): Missing argument(s)" - exit ${EXIT_FAILURE} - fi - - local MSGSTRING=${1} - local CMD=${2} - shift - local CMD_WITH_ARGS=${*} - - display_checkbox_msg ${MSGSTRING} - - rcmd_trap_setup - - echo ${CMD_WITH_ARGS} 1>> ${LFS_LOG_FILE} - - # Executing command - ${CMD_WITH_ARGS} 1>> ${LFS_LOG_FILE} 2>&1 - - if [ $? -ne 0 ]; then - if [ -n "${RCMD_NO_EXIT}" ]; then - return ${EXIT_FAILURE} - else - exit ${EXIT_FAILURE} - fi - fi - - # Displaying build time after the package name - print_status success - - rcmd_trap_end - - return $EXIT_SUCCESS -} - -get_total_build_time() -{ - INFILE=${1} - - # Checking for correct number of arguments - if [ $# -ne 1 ]; then - echo "${FUNCNAME}(), wrong number of arguments: ${*}" - echo "Usage: ${FUNCNAME} LOGFILE" - exit ${EXIT_FAILURE} - fi - - TIMES=$(cat ${INFILE} | grep "Build time:" | sed "s!Build time: \(.*\)h!\1!g") - - for time in ${TIMES}; do - HOURS=$(( $HOURS + $(echo ${time} | sed "s!^\([0-9]*\)\..*!\1!g") )) - - # The first SED command extracts the minutes (fractions of an hour). - # The second SED command removed the leading zero, if applicable. - MIN=$(( $MIN + $(echo ${time} | sed "s!.*\.\([0-9][0-9]\)!\1!g" | sed "s!^0\([0-9]\)!\1!g" ) )) - done - - HOURS=$(( ${HOURS} + ( ${MIN} / 100 ) )) - MIN=$(( ${MIN} % 100 )) - - echo "${HOURS}.${MIN}" -} - -# Global variable: START_TIME -display_build_time() -{ - END_TIME=$(echo `date +%s`) - - HOURS=$(( ( ${END_TIME} - ${START_TIME} ) / 3600 )) - echo -n " ("${HOURS}"." - echo -n " Build time: ${HOURS}." 1>> ${LFS_LOG_FILE} - - # Time is inferior to 1 hour... - MINUTES=$(( ( ( ${END_TIME} - ${START_TIME} ) % 3600 ) / 36 )) - - if [ ${MINUTES} -lt 10 ]; then - echo -n "0" - echo -n "0" 1>> ${LFS_LOG_FILE} - fi - - if [ ${MINUTES} -eq 0 ]; then - echo -n "1" - echo -n "1" 1>> ${LFS_LOG_FILE} - else - echo -n ${MINUTES} - echo -n ${MINUTES} 1>> ${LFS_LOG_FILE} - fi - - echo -n "h)" - echo "h" 1>> ${LFS_LOG_FILE} -} - -# Global variable: MSGSTRING -display_checkbox_msg() -{ - echo -en "${BRACKET}[ ${BRACKET}]${NORMAL} ${MSGSTRING}" -} - -# The print_status prints a coloured "X" letter inside the checkbox to the left -# of the screen (the checkbox is already displayed, and the cursor must have -# been saved to where to put the mark). -# 1st arg: status: success, warning or failure -# Global variables: MSGSTRING and START_TIME -print_status() -{ - if [ $# -ne 1 ]; then - # If no parameters are given to the print_status function, print usage - # information. - echo "Usage: ${FUNCNAME}() {success|warning|failure} [STRING] [TIME]" - return ${EXIT_FAILURE} - fi - - local COLOR="" - - case "${1}" in - success) - COLOR=$SUCCESS - ;; - warning) - COLOR=$WARNING - ;; - failure) - COLOR=$FAILURE - ;; - *) - echo "Usage: ${FUNCNAME}() {success|warning|failure}" - return ${EXIT_FAILURE} - ;; - esac - - # Reposition cursor at start of line - echo -en "${SET_CURSOR_START_LINE}" - # Display colored 'X' - echo -en "${BRACKET}[${COLOR}X${BRACKET}]${NORMAL} ${MSGSTRING}" - - if [ "x${MSGSTRING}" != "x" ]; then - display_build_time - fi - - echo -} diff --git a/stage1/create-config-files b/stage1/create-config-files index 36596ba..b56c3e8 100755 --- a/stage1/create-config-files +++ b/stage1/create-config-files @@ -19,9 +19,8 @@ if [ -n "${SWAP_PARTITION}" ]; then fi echo "${LFS_PARTITION} / reiserfs defaults,noatime 0 0" >> ${LFS}/etc/fstab -if [ -n "${CDROM}" ]; then +if [ "x${DVDROM}" = "xyes" ]; then cat >> ${LFS}/etc/fstab << "EOF" -/dev/cdrom /media/cdrom auto ro,noauto,users 0 0 /dev/dvd /media/dvd auto ro,noauto,users 0 0 EOF fi -- 2.20.1