* fix qemu for m68k by just using tcg-interpreter, too
[t2sde.git] / scripts / Check-System
blob03b95c65d117625370140cc551f11ed3f5c0714b
1 #!/usr/bin/env bash
3 # --- T2-COPYRIGHT-NOTE-BEGIN ---
4 # T2 SDE: scripts/Check-System
5 # Copyright (C) 2004 - 2023 The T2 SDE Project
6 # Copyright (C) 1998 - 2003 ROCK Linux Project
7 #
8 # This Copyright note is generated by scripts/Create-CopyPatch,
9 # more information can be found in the files COPYING and README.
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License version 2.
13 # --- T2-COPYRIGHT-NOTE-END ---
15 if [ "$1" ]; then
16 echo "Usage: $0"; exit 1
19 found_error=0
21 if [ $UID -ne 0 ]; then
22 echo "Paranoia Check: You are building as non-root!"
23 echo "This does not yet work for many configurations such as"
24 echo "whole system builds that require chroot()."
25 echo
28 if [ "`date '+%Y'`" -lt 1990 ]; then
29 echo "Paranoia Check: Your clock is not set!"
30 echo "Set you clock using the command: date MMDDhhmm[[CC]YY][.ss]"
31 echo
32 found_error=1
35 if [ -z "`type -p uname`" ]; then
36 echo "Paranoia Check: You have no uname install!"
37 echo "Install a uname program printing system information."
38 echo
39 found_error=1
42 if [ -z "`grep '^/' < /proc/swaps`" ]; then
43 echo "Paranoia Check: No active swap partition found!"
44 echo "That can cause the build scripts to stall your system!. Better"
45 echo "activate swap using the 'swapon' command and try again."
46 echo
47 #found_error=1
50 if [ -z "`type -p curl`" ]; then
51 echo "Paranoia Check: Program 'curl' not found!"
52 echo "The curl utility is needed for Downloading the package"
53 echo "source tars. Install the latest curl version."
54 echo
55 found_error=1
58 if [ -z "`type -p flex`" ]; then
59 echo "Paranoia Check: Program 'Flex' not found!"
60 echo "The Flex utility is needed for scanning"
61 echo "Install the latest Flex version."
62 echo
63 found_error=1
66 if [ -z "`type -p m4`" ]; then
67 echo "Paranoia Check: Program 'm4' not found!"
68 echo "The m4 utility is needed as a front"
69 echo "end for gcc. Install the latest m4 version."
70 echo
71 found_error=1
74 if [ -z "`type -p patch`" ]; then
75 echo "Paranoia Check: Program 'patch' not found!"
76 echo "The patch program is needed to work"
77 echo "with source files. Install the latest patch version."
78 echo
79 found_error=1
82 if [ -z "`type -p zstd`" ]; then
83 echo "Paranoia Check: Program 'zstd' not found!"
84 echo "The zstd utility is needed for extracting the package"
85 echo "source tars. Install the latest zstd version."
86 echo
87 found_error=1
90 if [ -z "`type -p makeinfo`" ]; then
91 echo "Paranoia Check: Program 'makeinfo' not found!"
92 echo "The makeinfo program is needed for translating Texinfo"
93 echo "documents. Please make sure that a current version of the"
94 echo "texinfo package (including makeinfo) is installed on your system."
95 echo
96 found_error=1
99 if [ -z "`type -p bison`" ]; then
100 echo "Paranoia Check: Program 'bison' not found!"
101 echo "The bison program is needed for compiling T2 targets."
102 echo "Please make sure that a current version of the"
103 echo "bison package is installed on your system."
104 echo
105 found_error=1
108 case $BASH_VERSION in
109 2.05b*) ;;
110 3.*) ;;
111 4.*) ;;
112 5.*) ;;
113 *) echo "The running bash version is not listed as supported version"
114 echo "You need to update 'bash' to at least version 2.05b."
115 echo
116 found_error=1
117 esac
119 x="`mktemp -p /tmp 2> /dev/null`"
120 if [ -z "$x" -o ! -f "$x" ]; then
121 echo "Paranoia Check: Program 'mktemp' not found or too old!"
122 echo "You need an 'mktemp' installed which does know about the -p"
123 echo "option. Install the latest mktemp version."
124 echo
125 found_error=1
126 else
127 rm -f "$x"
130 x="`mktemp`"; touch $x
131 if [ -z "`type -p sed`" ] || ! sed -i s/a/b/ $x
132 then
133 echo "Paranoia Check: Program 'sed' not found or too old!"
134 echo "You need a 'sed' installed which does know about the -i option"
135 echo "(GNU/sed since 2001-09-25). Install the latest sed version."
136 echo
137 found_error=1
139 rm -f $x 2> /dev/null
141 if [ -z "`type -p gawk`" ]; then
142 echo "Paranoia Check: Program 'gawk' not found!"
143 echo "The gawk program is needed for compiling T2 targets."
144 echo "Please make sure that a current version of the"
145 echo "gawk package is installed on your system."
146 echo
147 found_error=1
150 x=src/null
151 mkdir -p src
152 mknod $x c 1 3
153 if ! cat src/null; then
154 echo "Device nodes can not be created or are not functional on the"
155 echo "partition used for the build. Most probably the partitions is"
156 echo "mounted with the 'nodev' option."
157 echo
158 found_error=1
160 rm -f $x
162 if [[ `zstd - < /dev/null | file -` != *Zstandard* ]]; then
163 echo "The 'file' command does not recognize Zstd compression."
164 echo "Install the latest version of file."
165 echo
166 found_error=1
169 if [ $found_error -ne 0 ]; then
170 echo "Paranoia Check found errors -> not doing anything."
171 echo "You can disable the Paranoia Checks in the Config tool"
172 echo "on your own risk!"
173 echo
176 exit $found_error