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