From: gobo72 Date: Tue, 1 Mar 2011 04:10:55 +0000 (+0000) Subject: Changé fonction rcmd pour régler bug avec fpkg X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=fb687a8c2dc6ac58f8be02dda9b3f04cc9d10f28;p=hvlinux.git Changé fonction rcmd pour régler bug avec fpkg --- diff --git a/functions b/functions index ecd34f0..8052648 100644 --- a/functions +++ b/functions @@ -841,7 +841,7 @@ ipkg() # Checking if package was previously successfully installed if grep "^${HVLABEL} successfully installed" ${LFS_LOG_FILE} \ - 1> /dev/null 2>&1; then + 1> /dev/null 2>&1; then return $EXIT_SUCCESS fi @@ -972,17 +972,21 @@ rcmd_trap_end() { trap - INT TERM EXIT ERR - # Restore global trap - #####hvtrap_setup + # We do not restore global trap } rcmd_trap_handler() { - exec 1>&6 6>&- # Restore stdout and close file descriptor #6. + 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 - ###exit 1 + rcmd_trap_end + if [ -n "${RCMD_NO_EXIT}" ]; then + return ${EXIT_FAILURE} + else + exit ${EXIT_FAILURE} + fi } # Run command, no log @@ -1009,19 +1013,10 @@ rcmd() echo ${CMD_WITH_ARGS} 1>> ${LFS_LOG_FILE} - if [ -n "${RCMD_NO_EXIT}" ]; then - set +e - fi - # Executing command ${CMD_WITH_ARGS} 1>> ${LFS_LOG_FILE} 2>&1 - if [ -n "${RCMD_NO_EXIT}" ]; then - set -e - fi - if [ $? -ne 0 ]; then - print_status failure if [ -n "${RCMD_NO_EXIT}" ]; then return ${EXIT_FAILURE} else diff --git a/functions-update b/functions-update index d56e2bf..a72b304 100644 --- a/functions-update +++ b/functions-update @@ -235,9 +235,7 @@ static_getpkg() # so we can safely remove any file prior to trying to download it. rm -f ${LFS_PKG_DIR}/${PACK}.${arch_ext} - echo "Trying to fetch ${PACK}.${arch_ext}" - - ${WGETCMD} ${URL}/${PACK}.${arch_ext} + rcmd "Fetching ${PACK}.${arch_ext}" ${WGETCMD} ${URL}/${PACK}.${arch_ext} wget_status=$? # Append log to global log file @@ -261,8 +259,9 @@ static_getpkg() return 1 fi - # If we arrive here, it means we were able to successfully download the file. - if [ "x${arch_ext}" = "xtar.gz" -o "x${arch_ext}" = "xtgz" -o "x${arch_ext}" = "xtar.Z" ]; then + # If we are here, it means the file was successfully downloaded. + if [ "x${arch_ext}" = "xtar.gz" -o "x${arch_ext}" = "xtgz" \ + -o "x${arch_ext}" = "xtar.Z" ]; then gztobz2 ${LFS_PKG_DIR}/${PACK}.${arch_ext} fi return $? @@ -325,17 +324,12 @@ fpkg() local PACK=${1} local URL=${2} - local FETCH_STRING="Fetching ${PACK}" if [ -z "${SRC_FILENAME}" ]; then # Default source filename = name of package SRC_FILENAME=${PACK} fi - if [ -n "${FILE_EXT}" ]; then - FETCH_STRING="${FETCH_STRING}.${FILE_EXT}" - fi - if [ -z "${FILE_EXT}" -o \ "x${FILE_EXT}" = "xtar.gz" -o \ "x${FILE_EXT}" = "xtgz" -o \ @@ -364,7 +358,9 @@ fpkg() DEST_FILE=${DEST_DIR}/${PACK}.${FINAL_EXT} if [ ! -f ${DEST_FILE} ]; then - rcmd "${FETCH_STRING}" static_getpkg ${SRC_FILENAME} ${URL} ${FILE_EXT} + set +e + static_getpkg ${SRC_FILENAME} ${URL} ${FILE_EXT} + set -e # Move file if source filename is not equal to package name and/or destination # directory is not the default: