/[gentoo-x86]/eclass/check-reqs.eclass
Gentoo

Diff of /eclass/check-reqs.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.6 Revision 1.7
1# Copyright 1999-2008 Gentoo Foundation 1# Copyright 1999-2008 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/check-reqs.eclass,v 1.6 2008/04/11 13:52:55 zlin Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/check-reqs.eclass,v 1.7 2010/08/22 21:18:03 halcy0n Exp $
4 4
5# @ECLASS: check-reqs.eclass 5# @ECLASS: check-reqs.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Bo ├śrsted Andresen <zlin@gentoo.org> 7# Bo ├śrsted Andresen <zlin@gentoo.org>
8# 8#
89 89
90 export CHECKREQS_NEED_SLEEP="" CHECKREQS_NEED_DIE="" 90 export CHECKREQS_NEED_SLEEP="" CHECKREQS_NEED_DIE=""
91 if [[ "$CHECKREQS_ACTION" != "ignore" ]] ; then 91 if [[ "$CHECKREQS_ACTION" != "ignore" ]] ; then
92 [[ -n "$CHECKREQS_MEMORY" ]] && check_build_memory 92 [[ -n "$CHECKREQS_MEMORY" ]] && check_build_memory
93 [[ -n "$CHECKREQS_DISK_BUILD" ]] && check_build_disk \ 93 [[ -n "$CHECKREQS_DISK_BUILD" ]] && check_build_disk \
94 "${T}" "\${T}" "${CHECKREQS_DISK_BUILD}" 94 "${T}" "${CHECKREQS_DISK_BUILD}"
95 [[ -n "$CHECKREQS_DISK_USR" ]] && check_build_disk \ 95 [[ -n "$CHECKREQS_DISK_USR" ]] && check_build_disk \
96 "${ROOT}/usr" "\${ROOT}/usr" "${CHECKREQS_DISK_USR}" 96 "${ROOT}/usr" "${CHECKREQS_DISK_USR}"
97 [[ -n "$CHECKREQS_DISK_VAR" ]] && check_build_disk \ 97 [[ -n "$CHECKREQS_DISK_VAR" ]] && check_build_disk \
98 "${ROOT}/var" "\${ROOT}/var" "${CHECKREQS_DISK_VAR}" 98 "${ROOT}/var" "${CHECKREQS_DISK_VAR}"
99 fi 99 fi
100 100
101 if [[ -n "${CHECKREQS_NEED_SLEEP}" ]] ; then 101 if [[ -n "${CHECKREQS_NEED_SLEEP}" ]] ; then
102 echo 102 echo
103 ewarn "Bad things may happen! You may abort the build by pressing ctrl+c in" 103 ewarn "Bad things may happen! You may abort the build by pressing ctrl+c in"
124 124
125 export CHECKREQS_NEED_SLEEP="" CHECKREQS_NEED_DIE="" 125 export CHECKREQS_NEED_SLEEP="" CHECKREQS_NEED_DIE=""
126 if [[ "$CHECKREQS_ACTION" != "ignore" ]] ; then 126 if [[ "$CHECKREQS_ACTION" != "ignore" ]] ; then
127 [[ -n "$CHECKREQS_MEMORY" ]] && check_build_memory 127 [[ -n "$CHECKREQS_MEMORY" ]] && check_build_memory
128 [[ -n "$CHECKREQS_DISK_BUILD" ]] && check_build_disk \ 128 [[ -n "$CHECKREQS_DISK_BUILD" ]] && check_build_disk \
129 "${T}" "\${T}" "${CHECKREQS_DISK_BUILD}" 129 "${T}" "${CHECKREQS_DISK_BUILD}"
130 [[ -n "$CHECKREQS_DISK_USR" ]] && check_build_disk \ 130 [[ -n "$CHECKREQS_DISK_USR" ]] && check_build_disk \
131 "${ROOT}/usr" "\${ROOT}/usr" "${CHECKREQS_DISK_USR}" 131 "${ROOT}/usr" "${CHECKREQS_DISK_USR}"
132 [[ -n "$CHECKREQS_DISK_VAR" ]] && check_build_disk \ 132 [[ -n "$CHECKREQS_DISK_VAR" ]] && check_build_disk \
133 "${ROOT}/var" "\${ROOT}/var" "${CHECKREQS_DISK_VAR}" 133 "${ROOT}/var" "${CHECKREQS_DISK_VAR}"
134 fi 134 fi
135 135
136 [[ -z "${CHECKREQS_NEED_SLEEP}" && -z "${CHECKREQS_NEED_DIE}" ]] 136 [[ -z "${CHECKREQS_NEED_SLEEP}" && -z "${CHECKREQS_NEED_DIE}" ]]
137} 137}
138 138
161 fi 161 fi
162} 162}
163 163
164# internal use only! 164# internal use only!
165check_build_disk() { 165check_build_disk() {
166 [[ -z "${3}" ]] && die "Usage: check_build_disk where name needed" 166 [[ -z "${2}" ]] && die "Usage: check_build_disk where name needed"
167 check_build_msg_begin "${3}" "MBytes" \ 167 check_build_msg_begin "${2}" "MBytes" \
168 "disk space at ${2}" 168 "disk space at ${1}"
169 actual_space=$(df -Pm ${1} 2>/dev/null | sed -n \ 169 actual_space=$(df -Pm ${1} 2>/dev/null | sed -n \
170 '$s/\(\S\+\s\+\)\{3\}\([0-9]\+\).*/\2/p' 2>/dev/null ) 170 '$s/\(\S\+\s\+\)\{3\}\([0-9]\+\).*/\2/p' 2>/dev/null )
171 if [[ "$?" == "0" && -n "${actual_space}" ]] ; then 171 if [[ "$?" == "0" && -n "${actual_space}" ]] ; then
172 if [[ ${actual_space} -lt ${3} ]] ; then 172 if [[ ${actual_space} -lt ${2} ]] ; then
173 eend 1 173 eend 1
174 check_build_msg_ick "${3}" "MBytes" \ 174 check_build_msg_ick "${2}" "MBytes" \
175 "disk space at ${2}" 175 "disk space at ${1}"
176 else 176 else
177 eend 0 177 eend 0
178 fi 178 fi
179 else 179 else
180 eend 1 180 eend 1

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.20