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