michael@13: #!/bin/sh michael@13: ## michael@13: ## aux.prereq.sh -- Platform Pre-Requisite Checks michael@13: ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. michael@13: ## Copyright (c) 2000-2007 Ralf S. Engelschall michael@13: ## michael@13: ## Permission to use, copy, modify, and distribute this software for michael@13: ## any purpose with or without fee is hereby granted, provided that michael@13: ## the above copyright notice and this permission notice appear in all michael@13: ## copies. michael@13: ## michael@13: ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED michael@13: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF michael@13: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. michael@13: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR michael@13: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@13: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@13: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF michael@13: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND michael@13: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, michael@13: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT michael@13: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@13: ## SUCH DAMAGE. michael@13: ## michael@13: ## Usage: aux.prereq.sh source|binary michael@13: ## michael@13: michael@13: mode="$1" michael@13: michael@13: # CHECK: determine platform ids michael@13: platform_prod=`sh ./shtool platform -n -L -S "" -C "+" -F "%-%"` michael@13: platform_tech=`sh ./shtool platform -n -L -S "" -C "+" -F "%-%"` michael@13: echo "++ platform product: $platform_prod" michael@13: echo "++ platform technology: $platform_tech" michael@13: michael@13: # michael@13: # CHECK: diskspace requirement michael@13: # michael@13: if [ ".$mode" = .source ]; then michael@13: fs_path="${TMPDIR-/tmp}" michael@13: fs_need=150000 michael@13: else michael@13: fs_path="" # FIXME michael@13: fs_need=0 # FIXME michael@13: fi michael@13: fs_free="" michael@13: case "$platform_tech" in michael@13: *-freebsd* | *-linux* | *-sunos* ) michael@13: fs_free=`cd $fs_path && /bin/df -k . | sed -n -e '$p' | sed -e 's;^[^ ]*;;' -e 's; *;;' | awk '{ print $3; }'` michael@13: ;; michael@13: esac michael@13: if [ ".$fs_free" != . ]; then michael@13: if [ $fs_free -lt $fs_need ]; then michael@13: if [ ".$mode" = .source ]; then michael@13: echo "ERROR: temporary directory \"$fs_path\" has to reside on a partition" 1>&2 michael@13: echo " with at least $fs_need KB of free disk space. Set \$TMPDIR to" 1>&2 michael@13: echo " a directory on a partition with enough free disk space, please." 1>&2 michael@13: else michael@13: echo "ERROR: installation directory \"$fs_path\" has to reside on a partition" 1>&2 michael@13: echo " with at least $fs_need KB of free disk space. Make \"$fs_path\" a" 1>&2 michael@13: echo " symbolic link to a directory on a partition with enough free" 1>&2 michael@13: echo " disk space, please." 1>&2 michael@13: fi michael@13: exit 1 michael@13: fi michael@13: fi michael@13: michael@13: # michael@13: # CHECK: available vendor packages michael@13: # michael@13: # ...FIXME... michael@13: michael@13: # michael@13: # CHECK: available tools in $PATH michael@13: # michael@13: # ...FIXME... michael@13: michael@13: # michael@13: # CHECK: available devices /dev/random, etc. michael@13: # michael@13: # ...FIXME... michael@13: michael@13: # michael@13: # CHECK: consistency check for /prefix (symlink!) michael@13: # michael@13: # ...FIXME... michael@13: