* updated bomber (21.12.1 -> 21.12.2), untested
[t2-trunk.git] / scripts / Check-System
blob0885cb731fde8b94ae61e422057c11e35c384bf2
1 #!/bin/bash
3 # --- T2-COPYRIGHT-NOTE-BEGIN ---
4 # This copyright note is auto-generated by scripts/Create-CopyPatch.
5 #
6 # T2 SDE: scripts/Check-System
7 # Copyright (C) 2004 - 2021 The T2 SDE Project
8 # Copyright (C) 1998 - 2003 ROCK Linux Project
9 #
10 # More information can be found in the files COPYING and README.
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; version 2 of the License. A copy of the
15 # GNU General Public License can be found in the file COPYING.
16 # --- T2-COPYRIGHT-NOTE-END ---
18 if [ "$1" ]; then
19 echo "Usage: $0"; exit 1
22 found_error=0
24 if [ $UID -ne 0 ]; then
25 echo "Paranoia Check: You are building as non-root!"
26 echo "This does not yet work for many configurations such as"
27 echo "whole system builds that require chroot()."
28 echo
31 if [ "`date '+%Y'`" -lt 1990 ]; then
32 echo "Paranoia Check: Your clock is not set!"
33 echo "Set you clock using the command: date MMDDhhmm[[CC]YY][.ss]"
34 echo
35 found_error=1
38 if [ -z "`type -p uname`" ]; then
39 echo "Paranoia Check: You have no uname install!"
40 echo "Install a uname program printing system information."
41 echo
42 found_error=1
45 if [ -z "`grep '^/' < /proc/swaps`" ]; then
46 echo "Paranoia Check: No active swap partition found!"
47 echo "That can cause the build scripts to stall your system!. Better"
48 echo "activate swap using the 'swapon' command and try again."
49 echo
50 #found_error=1
53 if [ -z "`type -p curl`" ]; then
54 echo "Paranoia Check: Program 'curl' not found!"
55 echo "The curl utility is needed for Downloading the package"
56 echo "source tars. Install the latest curl version."
57 echo
58 found_error=1
61 if [ -z "`type -p flex`" ]; then
62 echo "Paranoia Check: Program 'Flex' not found!"
63 echo "The Flex utility is needed for scanning"
64 echo "Install the latest Flex version."
65 echo
66 found_error=1
69 if [ -z "`type -p m4`" ]; then
70 echo "Paranoia Check: Program 'm4' not found!"
71 echo "The m4 utility is needed as a front"
72 echo "end for gcc. Install the latest m4 version."
73 echo
74 found_error=1
77 if [ -z "`type -p patch`" ]; then
78 echo "Paranoia Check: Program 'patch' not found!"
79 echo "The patch program is needed to work"
80 echo "with source files. Install the latest patch version."
81 echo
82 found_error=1
85 if [ -z "`type -p zstd`" ]; then
86 echo "Paranoia Check: Program 'zstd' not found!"
87 echo "The zstd utility is needed for extracting the package"
88 echo "source tars. Install the latest zstd version."
89 echo
90 found_error=1
93 if [ -z "`type -p makeinfo`" ]; then
94 echo "Paranoia Check: Program 'makeinfo' not found!"
95 echo "The makeinfo program is needed for translating Texinfo"
96 echo "documents. Please make sure that a current version of the"
97 echo "texinfo package (including makeinfo) is installed on your system."
98 echo
99 found_error=1
102 if [ -z "`type -p bison`" ]; then
103 echo "Paranoia Check: Program 'bison' not found!"
104 echo "The bison program is needed for compiling T2 targets."
105 echo "Please make sure that a current version of the"
106 echo "bison package is installed on your system."
107 echo
108 found_error=1
111 case $BASH_VERSION in
112 2.05b*) ;;
113 3.*) ;;
114 4.*) ;;
115 5.*) ;;
116 *) echo "The running bash version is not listed as supported version"
117 echo "You need to update 'bash' to at least version 2.05b."
118 echo
119 found_error=1
120 esac
122 x="`mktemp -p /tmp 2> /dev/null`"
123 if [ -z "$x" -o ! -f "$x" ]; then
124 echo "Paranoia Check: Program 'mktemp' not found or too old!"
125 echo "You need an 'mktemp' installed which does know about the -p"
126 echo "option. Install the latest mktemp version."
127 echo
128 found_error=1
129 else
130 rm -f "$x"
133 x="`mktemp`"; touch $x
134 if [ -z "`type -p sed`" ] || ! sed -i s/a/b/ $x
135 then
136 echo "Paranoia Check: Program 'sed' not found or too old!"
137 echo "You need a 'sed' installed which does know about the -i option"
138 echo "(GNU/sed since 2001-09-25). Install the latest sed version."
139 echo
140 found_error=1
142 rm -f $x 2> /dev/null
144 if [ -z "`type -p gawk`" ]; then
145 echo "Paranoia Check: Program 'gawk' not found!"
146 echo "The gawk program is needed for compiling T2 targets."
147 echo "Please make sure that a current version of the"
148 echo "gawk package is installed on your system."
149 echo
150 found_error=1
153 x=src/null
154 mkdir -p src
155 mknod $x c 1 3
156 if ! cat src/null; then
157 echo "Device nodes can not be created or are not functional on the"
158 echo "partition used for the build. Most probably the partitions is"
159 echo "mounted with the 'nodev' option."
160 echo
161 found_error=1
163 rm -f $x
165 if [[ `zstd - < /dev/null | file -` != *Zstandard* ]]; then
166 echo "The 'file' command does not recognize Zstd compression."
167 echo "Install the latest version of file."
168 echo
169 found_error=1
172 if [ $found_error -ne 0 ]; then
173 echo "Paranoia Check found errors -> not doing anything."
174 echo "You can disable the Paranoia Checks in the Config tool"
175 echo "on your own risk!"
176 echo
179 exit $found_error