From 97b938a7a341fe0d45ba4f93ce9e785b2bdc182a Mon Sep 17 00:00:00 2001 From: gobo72 Date: Sat, 3 Jul 2010 23:48:54 +0000 Subject: [PATCH] -Replaced /bin/sh by /bin/bash to be able to use the source built-in keyword. -Better error handling by using trap function. --- packages-list | 6 +++--- stage0/stage0-install | 19 +++++++++++++------ stage1/bootscripts/checkfs | 2 +- stage1/bootscripts/cleanfs | 2 +- stage1/bootscripts/functions | 2 +- stage1/bootscripts/halt | 2 +- stage1/bootscripts/hostname | 2 +- stage1/bootscripts/initlog | 2 +- stage1/bootscripts/modules | 2 +- stage1/bootscripts/mountfs | 2 +- stage1/bootscripts/mountkernfs | 2 +- stage1/bootscripts/rc | 2 +- stage1/bootscripts/reboot | 2 +- stage1/bootscripts/sendsignals | 2 +- stage1/bootscripts/setclock | 2 +- stage1/bootscripts/swap | 2 +- stage1/bootscripts/udev | 2 +- stage1/cis-ac | 2 +- stage1/cis-bash | 2 +- stage1/cis-binutils | 2 +- stage1/cis-bootscripts | 2 +- stage1/cis-bzip2 | 2 +- stage1/cis-common | 2 +- stage1/cis-common2 | 2 +- stage1/cis-coreutils | 2 +- stage1/cis-e2fsprogs | 2 +- stage1/cis-findutils | 2 +- stage1/cis-flex | 2 +- stage1/cis-gcc | 2 +- stage1/cis-gettext | 2 +- stage1/cis-m4 | 2 +- stage1/cis-module-init-tools | 2 +- stage1/cis-post-install | 2 +- stage1/cis-pre-install | 2 +- stage1/cis-sysvinit | 2 +- stage1/cis-tar | 2 +- stage1/cis-texinfo | 2 +- stage1/cis-udev | 2 +- stage1/cis-util-linux-ng | 2 +- stage1/cis-zlib | 2 +- stage1/create-config-files | 6 +++--- stage1/create-directories | 2 +- stage1/create-groups | 2 +- stage1/create-logfiles | 2 +- stage1/create-symlinks | 2 +- stage1/create-users | 2 +- stage1/install-1 | 5 +++-- stage1/install-linux-minimal | 4 ++-- stage1/packages-update | 2 +- stage1/stage1-install | 22 +++++++++++++++------- sysinfos | 29 ++++++++++------------------- 51 files changed, 93 insertions(+), 86 deletions(-) diff --git a/packages-list b/packages-list index 43fa46b..cc0f91e 100644 --- a/packages-list +++ b/packages-list @@ -69,8 +69,8 @@ E2FSPROGS="e2fsprogs-1.41.9" EASYTAG="easytag-2.1" ED="ed-1.4" EGGDBUS="eggdbus-0.6" -EGLIBC="eglibc-2.10.1-20100304-r9381" -EGLIBC_PORTS="eglibc-ports-2.10.1-20100304-r9381" +EGLIBC="eglibc-2.10.1-20100305-r9381" +EGLIBC_PORTS="eglibc-ports-2.10.1-20100305-r9381" UCLIBC="uClibc-0.9.30.1" EMACS="emacs-23.1" ESOUND="esound-0.2.37" @@ -232,7 +232,7 @@ JAVA="jre-1.6.0_05" KBD="kbd-1.15" KERBEROS5="krb5-1.4.1" -KERNEL="linux-2.6.32.9" +KERNEL="linux-2.6.34" KVM="kvm-84" LAME="lame-398-2" diff --git a/stage0/stage0-install b/stage0/stage0-install index c358247..fe9b2f7 100755 --- a/stage0/stage0-install +++ b/stage0/stage0-install @@ -1,8 +1,20 @@ #!/bin/bash -set -o errexit 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 @@ -21,11 +33,6 @@ echo "Performing pre-install" # directory of the user. su - lfs -c "cd ${PWD}; ./install-1" -if [ $? -ne 0 ]; then - echo "*** An error occured during ${LFS_STAGE}" - exit 1 -fi - echo "Total build time: $(get_total_build_time ${LFS_LOG_FILE})h" exit 0 diff --git a/stage1/bootscripts/checkfs b/stage1/bootscripts/checkfs index e5eaeb7..3349806 100755 --- a/stage1/bootscripts/checkfs +++ b/stage1/bootscripts/checkfs @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # checkfs diff --git a/stage1/bootscripts/cleanfs b/stage1/bootscripts/cleanfs index 33168da..153f241 100755 --- a/stage1/bootscripts/cleanfs +++ b/stage1/bootscripts/cleanfs @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # cleanfs # Clean file system diff --git a/stage1/bootscripts/functions b/stage1/bootscripts/functions index f0eef13..3d8ffb5 100644 --- a/stage1/bootscripts/functions +++ b/stage1/bootscripts/functions @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # General shell functions diff --git a/stage1/bootscripts/halt b/stage1/bootscripts/halt index 575d648..03de43c 100755 --- a/stage1/bootscripts/halt +++ b/stage1/bootscripts/halt @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # halt diff --git a/stage1/bootscripts/hostname b/stage1/bootscripts/hostname index 84b1d34..bb32aba 100755 --- a/stage1/bootscripts/hostname +++ b/stage1/bootscripts/hostname @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # description: Set hostname at boot time. # Even if network connection is not desired, diff --git a/stage1/bootscripts/initlog b/stage1/bootscripts/initlog index d9ba2b1..71bc0da 100755 --- a/stage1/bootscripts/initlog +++ b/stage1/bootscripts/initlog @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # initlog diff --git a/stage1/bootscripts/modules b/stage1/bootscripts/modules index df5f195..8c870a9 100755 --- a/stage1/bootscripts/modules +++ b/stage1/bootscripts/modules @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # modules # Module auto-loading script diff --git a/stage1/bootscripts/mountfs b/stage1/bootscripts/mountfs index 15cde93..c7fd27e 100755 --- a/stage1/bootscripts/mountfs +++ b/stage1/bootscripts/mountfs @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # mountfs diff --git a/stage1/bootscripts/mountkernfs b/stage1/bootscripts/mountkernfs index 9c3fed5..6c377a6 100755 --- a/stage1/bootscripts/mountkernfs +++ b/stage1/bootscripts/mountkernfs @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # mountkernfs diff --git a/stage1/bootscripts/rc b/stage1/bootscripts/rc index 9e4087d..1d0a721 100755 --- a/stage1/bootscripts/rc +++ b/stage1/bootscripts/rc @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # rc diff --git a/stage1/bootscripts/reboot b/stage1/bootscripts/reboot index 2f6c3e5..21efce5 100755 --- a/stage1/bootscripts/reboot +++ b/stage1/bootscripts/reboot @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # reboot diff --git a/stage1/bootscripts/sendsignals b/stage1/bootscripts/sendsignals index 6bde3e3..c546fe5 100755 --- a/stage1/bootscripts/sendsignals +++ b/stage1/bootscripts/sendsignals @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # sendsignals diff --git a/stage1/bootscripts/setclock b/stage1/bootscripts/setclock index 2a00c66..cce76cd 100755 --- a/stage1/bootscripts/setclock +++ b/stage1/bootscripts/setclock @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # setclock diff --git a/stage1/bootscripts/swap b/stage1/bootscripts/swap index 083b980..9e47649 100755 --- a/stage1/bootscripts/swap +++ b/stage1/bootscripts/swap @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # swap diff --git a/stage1/bootscripts/udev b/stage1/bootscripts/udev index c29fbd0..705b160 100644 --- a/stage1/bootscripts/udev +++ b/stage1/bootscripts/udev @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # udev # Udev cold-plugging script diff --git a/stage1/cis-ac b/stage1/cis-ac index bf6a869..a0adcad 100755 --- a/stage1/cis-ac +++ b/stage1/cis-ac @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # First argument of this script is the package name. diff --git a/stage1/cis-bash b/stage1/cis-bash index 4aa5816..cac852b 100755 --- a/stage1/cis-bash +++ b/stage1/cis-bash @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # First argument of this script is the package name. diff --git a/stage1/cis-binutils b/stage1/cis-binutils index 904dcb0..a7306ae 100755 --- a/stage1/cis-binutils +++ b/stage1/cis-binutils @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # Reading system configuration informations, functions and package versions. diff --git a/stage1/cis-bootscripts b/stage1/cis-bootscripts index ac17b28..5c0def2 100755 --- a/stage1/cis-bootscripts +++ b/stage1/cis-bootscripts @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # Reading system configuration informations, functions and package versions. diff --git a/stage1/cis-bzip2 b/stage1/cis-bzip2 index 5b36c8d..619a739 100755 --- a/stage1/cis-bzip2 +++ b/stage1/cis-bzip2 @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # Reading system configuration informations, functions and package versions. diff --git a/stage1/cis-common b/stage1/cis-common index be4e6ec..394d28d 100755 --- a/stage1/cis-common +++ b/stage1/cis-common @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # First argument of this script is the package name. diff --git a/stage1/cis-common2 b/stage1/cis-common2 index 98b876f..de32d7a 100755 --- a/stage1/cis-common2 +++ b/stage1/cis-common2 @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # First argument of this script is the package name. diff --git a/stage1/cis-coreutils b/stage1/cis-coreutils index 67fc413..f7a0a27 100755 --- a/stage1/cis-coreutils +++ b/stage1/cis-coreutils @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # First argument of this script is the package name. diff --git a/stage1/cis-e2fsprogs b/stage1/cis-e2fsprogs index 71985fa..0532f02 100755 --- a/stage1/cis-e2fsprogs +++ b/stage1/cis-e2fsprogs @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # First argument of this script is the package name. diff --git a/stage1/cis-findutils b/stage1/cis-findutils index c3f887d..403df4e 100755 --- a/stage1/cis-findutils +++ b/stage1/cis-findutils @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # First argument of this script is the package name. diff --git a/stage1/cis-flex b/stage1/cis-flex index f5be27f..40886e1 100755 --- a/stage1/cis-flex +++ b/stage1/cis-flex @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # First argument of this script is the package name. diff --git a/stage1/cis-gcc b/stage1/cis-gcc index 49c7e4e..445bc89 100755 --- a/stage1/cis-gcc +++ b/stage1/cis-gcc @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # Reading system configuration informations, functions and package versions. diff --git a/stage1/cis-gettext b/stage1/cis-gettext index f7ddee3..c6e0149 100755 --- a/stage1/cis-gettext +++ b/stage1/cis-gettext @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # First argument of this script is the package name. diff --git a/stage1/cis-m4 b/stage1/cis-m4 index 6e364e7..92338db 100755 --- a/stage1/cis-m4 +++ b/stage1/cis-m4 @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # First argument of this script is the package name. diff --git a/stage1/cis-module-init-tools b/stage1/cis-module-init-tools index b84c5fd..c79add6 100755 --- a/stage1/cis-module-init-tools +++ b/stage1/cis-module-init-tools @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # First argument of this script is the package name. diff --git a/stage1/cis-post-install b/stage1/cis-post-install index b5bb52d..6f3fb4d 100755 --- a/stage1/cis-post-install +++ b/stage1/cis-post-install @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # Reading system configuration informations, functions and package versions. diff --git a/stage1/cis-pre-install b/stage1/cis-pre-install index 21d7ebd..13815b4 100755 --- a/stage1/cis-pre-install +++ b/stage1/cis-pre-install @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # Reading system configuration informations, functions and package versions. diff --git a/stage1/cis-sysvinit b/stage1/cis-sysvinit index 6ca42b9..319e885 100755 --- a/stage1/cis-sysvinit +++ b/stage1/cis-sysvinit @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # First argument of this script is the package name. diff --git a/stage1/cis-tar b/stage1/cis-tar index 7cf1879..4feb5c4 100755 --- a/stage1/cis-tar +++ b/stage1/cis-tar @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # First argument of this script is the package name. diff --git a/stage1/cis-texinfo b/stage1/cis-texinfo index 1e6fa90..ca87926 100755 --- a/stage1/cis-texinfo +++ b/stage1/cis-texinfo @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # First argument of this script is the package name. diff --git a/stage1/cis-udev b/stage1/cis-udev index d05e1b1..ff0c1b8 100755 --- a/stage1/cis-udev +++ b/stage1/cis-udev @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # First argument of this script is the package name. diff --git a/stage1/cis-util-linux-ng b/stage1/cis-util-linux-ng index 8d16906..f86916c 100755 --- a/stage1/cis-util-linux-ng +++ b/stage1/cis-util-linux-ng @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # First argument of this script is the package name. diff --git a/stage1/cis-zlib b/stage1/cis-zlib index f01fc25..b3bbb71 100755 --- a/stage1/cis-zlib +++ b/stage1/cis-zlib @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # First argument of this script is the package name diff --git a/stage1/create-config-files b/stage1/create-config-files index 1dad392..0bc590c 100755 --- a/stage1/create-config-files +++ b/stage1/create-config-files @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # Reading system configuration informations, functions and package versions. @@ -32,7 +32,7 @@ EOF echo "Creating basic /etc/profile and /etc/profile.d" install -v -m755 -d ${LFS}/etc/profile.d cat > ${LFS}/etc/profile << "EOF" -#!/bin/sh +#!/bin/bash # /etc/profile # System-wide environment and startup programs. @@ -88,7 +88,7 @@ sed -i -e "s!_DEFAULT_EDITOR_!${DEFAULT_EDITOR}!g" ${LFS}/etc/profile echo "Creating /etc/bashrc" cat > ${LFS}/etc/bashrc << "EOF" -#!/bin/sh +#!/bin/bash # /etc/bashrc diff --git a/stage1/create-directories b/stage1/create-directories index 43dcb78..f73edad 100755 --- a/stage1/create-directories +++ b/stage1/create-directories @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # Reading system configuration informations, functions and package versions. diff --git a/stage1/create-groups b/stage1/create-groups index e610968..981daef 100755 --- a/stage1/create-groups +++ b/stage1/create-groups @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # Reading system configuration informations, functions and package versions. diff --git a/stage1/create-logfiles b/stage1/create-logfiles index 4ab97e0..c0fb885 100755 --- a/stage1/create-logfiles +++ b/stage1/create-logfiles @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # Reading system configuration informations, functions and package versions. diff --git a/stage1/create-symlinks b/stage1/create-symlinks index cc91b57..bd44b95 100755 --- a/stage1/create-symlinks +++ b/stage1/create-symlinks @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # Reading system configuration informations, functions and package versions. diff --git a/stage1/create-users b/stage1/create-users index c02da2d..f405574 100755 --- a/stage1/create-users +++ b/stage1/create-users @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # Reading system configuration informations, functions and package versions. diff --git a/stage1/install-1 b/stage1/install-1 index 169d678..479496f 100755 --- a/stage1/install-1 +++ b/stage1/install-1 @@ -1,4 +1,5 @@ -#!/bin/sh +#!/bin/bash +set -o errexit source ~/.bashrc @@ -42,7 +43,7 @@ ipkg_ac ${CLOOG_PPL} "\ --with-ppl=/tools" ipkg_cust ${ZLIB} cis-zlib ipkg_cust ${BINUTILS} cis-binutils -ipkg_cust ${GCC_CORE} cis-gcc +ipkg_cust ${GCC} cis-gcc ipkg_ac ${NCURSES} "--with-shared --without-debug --without-ada --enable-overwrite --with-build-cc=gcc" ipkg_cust ${BASH} cis-bash ipkg_ac ${BISON} diff --git a/stage1/install-linux-minimal b/stage1/install-linux-minimal index 9aa5f82..f1d918f 100755 --- a/stage1/install-linux-minimal +++ b/stage1/install-linux-minimal @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit # Reading system configuration informations, functions and package versions. @@ -19,7 +19,7 @@ ${HVMAKE} mrproper VERSION=$(get_pkg_ver ${PACKAGE}) SCRIPT=${LFS}/usr/src/compile-kernel-minimal -echo "#!/bin/sh" > ${SCRIPT} +echo "#!/bin/bash" > ${SCRIPT} echo "KERNEL_VERSION=${VERSION}" >> ${SCRIPT} echo "KERNEL_NAME=clfs-\${KERNEL_VERSION}" >> ${SCRIPT} echo "DEST=${LFS}/boot" >> ${SCRIPT} diff --git a/stage1/packages-update b/stage1/packages-update index a4c47d8..9702fcf 100755 --- a/stage1/packages-update +++ b/stage1/packages-update @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash LFS_STAGE="stage1" USE_CLFS_PATCHES=1 diff --git a/stage1/stage1-install b/stage1/stage1-install index 6efcf2e..8e7d8d9 100755 --- a/stage1/stage1-install +++ b/stage1/stage1-install @@ -1,7 +1,20 @@ -#!/bin/sh +#!/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 @@ -19,15 +32,10 @@ rscr mult "Performing pre-install" cis-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" && +su - lfs -c "cd ${PWD}; ./install-1" rscr mult "Performing post-install" cis-post-install -if [ $? -ne 0 ]; then - echo "*** An error occured during ${LFS_STAGE}" - exit 1 -fi - echo "Total build time: $(get_total_build_time ${LFS_LOG_FILE})h" exit 0 diff --git a/sysinfos b/sysinfos index 87a09d2..0d752cd 100644 --- a/sysinfos +++ b/sysinfos @@ -9,13 +9,15 @@ MAKEJOBS=1 # Installation type: server, ltsp-server or workstation. -INST_TYPE="ltsp-server" +INST_TYPE="workstation" # New user to create REGUSER="hugo" -# Destination path where to install new Linux-HV system -LFS="" +# 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. +# After stage 1, this must be set to "". +LFS="/mnt/hvlinux-x86_64" # Destination partition where to install new Linux-HV system LFS_PARTITION="/dev/sda8" @@ -46,7 +48,6 @@ SOUND_CARD="yes" # Removable media drives CDROM="/dev/hdc" -DVD="/dev/hdc" # Set to yes to have SANE support SANE_SUPPORT="yes" @@ -60,31 +61,21 @@ SANE_SERVER="" TIMEZONE="America/Montreal" # General network settings -INTERFACES="eth0 eth1 eth2" +INTERFACES="eth0" # GATEWAY is not required if using DHCP GATEWAY="192.168.1.1" -MACHINE_NAME="server64" -DOMAIN="hugovil.com" -LAN_NETWORK_MASK="192.168.0.0/24" # Utilise par sane in stage3 +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) BOOTPROTO[0]="static" -IP_ADDRESS[0]="192.168.1.2" +IP_ADDRESS[0]="192.168.1.102" PREFIX_LENGTH[0]=24 -# Network interface card eth1 settings (LAN) -BOOTPROTO[1]="static" -IP_ADDRESS[1]="192.168.0.1" -PREFIX_LENGTH[1]=24 - -# Network interface card eth2 settings (MVPMC) -BOOTPROTO[2]="static" -IP_ADDRESS[2]="192.168.99.1" -PREFIX_LENGTH[2]=24 - # DNS servers addresses (not required if using DHCP) NAMESERVER[0]="192.168.1.1" -- 2.20.1