openpkg/etc.prereq.sh

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
parent 428
f880f219c566
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

michael@428 1 #!/bin/sh
michael@428 2 ##
michael@445 3 ## etc.prereq.sh -- Platform Prerequisite Checks
michael@428 4 ## Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
michael@428 5 ##
michael@428 6 ## This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
michael@428 7 ## All rights reserved. Licenses which grant limited permission to use,
michael@428 8 ## copy, modify and distribute this software are available from the
michael@428 9 ## OpenPKG GmbH.
michael@428 10 ##
michael@428 11 ## THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
michael@428 12 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
michael@428 13 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
michael@428 14 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
michael@428 15 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@428 16 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@428 17 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
michael@428 18 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
michael@428 19 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
michael@428 20 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
michael@428 21 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@428 22 ## SUCH DAMAGE.
michael@428 23 ##
michael@428 24 ## Usage: etc.prereq.sh source|binary
michael@428 25 ##
michael@428 26
michael@428 27 mode="$1"
michael@428 28
michael@428 29 # CHECK: determine platform ids
michael@428 30 platform_prod=`sh ./shtool platform -n -L -S "" -C "+" -F "%<ap>-%<sp>"`
michael@428 31 platform_tech=`sh ./shtool platform -n -L -S "" -C "+" -F "%<at>-%<st>"`
michael@428 32 echo "++ platform product: $platform_prod"
michael@428 33 echo "++ platform technology: $platform_tech"
michael@428 34
michael@428 35 #
michael@428 36 # CHECK: diskspace requirement
michael@428 37 #
michael@428 38 if [ ".$mode" = .source ]; then
michael@428 39 fs_path="${TMPDIR-/tmp}"
michael@428 40 fs_need=150000
michael@428 41 else
michael@428 42 fs_path="" # FIXME
michael@428 43 fs_need=0 # FIXME
michael@428 44 fi
michael@428 45 fs_free=""
michael@428 46 case "$platform_tech" in
michael@428 47 *-freebsd* | *-netbsd* | *-linux* | *-sunos* )
michael@428 48 fs_free=`cd $fs_path && /bin/df -k . | sed -n -e '$p' | sed -e 's;^[^ ]*;;' -e 's; *;;' | awk '{ print $3; }'`
michael@428 49 ;;
michael@428 50 esac
michael@428 51 if [ ".$fs_free" != . ]; then
michael@428 52 if [ $fs_free -lt $fs_need ]; then
michael@428 53 if [ ".$mode" = .source ]; then
michael@428 54 echo "ERROR: temporary directory \"$fs_path\" has to reside on a partition" 1>&2
michael@428 55 echo " with at least $fs_need KB of free disk space. Set \$TMPDIR to" 1>&2
michael@428 56 echo " a directory on a partition with enough free disk space, please." 1>&2
michael@428 57 else
michael@428 58 echo "ERROR: installation directory \"$fs_path\" has to reside on a partition" 1>&2
michael@428 59 echo " with at least $fs_need KB of free disk space. Make \"$fs_path\" a" 1>&2
michael@428 60 echo " symbolic link to a directory on a partition with enough free" 1>&2
michael@428 61 echo " disk space, please." 1>&2
michael@428 62 fi
michael@428 63 exit 1
michael@428 64 fi
michael@428 65 fi
michael@428 66
michael@428 67 #
michael@428 68 # CHECK: available vendor packages
michael@428 69 #
michael@428 70 # ...FIXME...
michael@428 71
michael@428 72 #
michael@428 73 # CHECK: available tools in $PATH
michael@428 74 #
michael@428 75 # ...FIXME...
michael@428 76
michael@428 77 #
michael@428 78 # CHECK: available devices /dev/random, etc.
michael@428 79 #
michael@428 80 # ...FIXME...
michael@428 81
michael@428 82 #
michael@428 83 # CHECK: consistency check for /prefix (symlink!)
michael@428 84 #
michael@428 85 # ...FIXME...
michael@428 86

mercurial