File: checkit

package info (click to toggle)
lilo 1%3A24.2-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,592 kB
  • sloc: ansic: 13,304; asm: 10,403; perl: 1,291; sh: 1,035; makefile: 592
file content (110 lines) | stat: -rwxr-xr-x 2,391 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#! /bin/sh
#
#  checkit:    Test for correct versions of utilities
#  (see the end of the file for bypassing these checks)
#
#  Copyright 2005-2007 John Coffman
#  Copyright 2009-2010 Joachim Wiedorn
#  All rights reserved.
#
#  Licensed under the terms contained in the file 'COPYING'
#  in the source directory.
#


ret=0
rc=0

# min. version of BCC, AD86, LD86
bccmin="0.16.14"

# min. version of GCC, CPP
gccmin="3.3.5"

vers_min() {
	local M m p N n r

	rc=0
# get our version major, minor, rev
	M=`echo $1 | cut -d . -f 1`
	m=`echo $1 | cut -d . -f 2`
	p=`echo $1 | cut -d . -f 3`
	if [ -z "$p" ]; then p=0; fi
#echo vers_min1 $M $m $p
	N=`echo $2 | cut -d . -f 1`
	n=`echo $2 | cut -d . -f 2`
	r=`echo $2 | cut -d . -f 3`
#echo vers_min2 $N $n $r
	if [ "$M" -lt "$N" ]; then rc=1
	elif [ "$M" -gt "$N" ]; then rc=0
	elif [ "$m" -lt "$n" ]; then rc=1
	elif [ "$m" -gt "$n" ]; then rc=0
	elif [ -z "$r" ]; then rc=0
	elif [ "$p" -lt "$r" ]; then rc=1
	fi
#echo vers_min returns $rc
	return $rc
}

#echo
echo GCC version $gccmin or later is required
gcc -v 1>foo1 2>foo2
V=`cat foo1 foo2 | cut -d' ' -f1-3 | grep -i version | tr '-' ' ' | cut -d' ' -f 3`
rm -f foo1 foo2
if [ -z "$V" ]; then
	echo gcc is not present
	ret=1
else
	vers_min $V $gccmin
	echo gcc version $V
	if [ $rc = 0 ]; then echo OKAY; else echo ERROR; ret=1; fi
fi

echo
echo AS86 version $bccmin or later is required
as86 -v 1>foo1 2>foo2
A=`cat foo1 foo2 | grep version | cut -d " " -f 3`
rm -f foo1 foo2
if [ -z "$A" ]; then
	echo as86 is not present
	ret=1
else
	vers_min $A $bccmin
	echo as86 version $A
	if [ $rc = 0 ]; then echo OKAY; else echo ERROR; ret=1; fi
fi

echo
echo LD86 version $bccmin or later is required
ld86 -v 1>foo1 2>foo2
L=`cat foo1 foo2 | grep version | cut -d " " -f 3`
rm -f foo1 foo2
if [ -z "$L" ]; then
	echo ld86 is not present
	ret=1
else
	vers_min $L $bccmin
	echo ld86 version $L
	if [ $rc = 0 ]; then echo OKAY; else echo ERROR; ret=1; fi
fi

echo
echo BCC version $bccmin or later is recommended
bcc -v 1>foo1 2>foo2
B=`cat foo1 foo2 | grep version | cut -d " " -f 3`
rm -f foo1 foo2
if [ -z "$B" ]; then
	echo bcc is not present
	echo You will not be able to make floppy2, diag2.img, or lilo.com
else
	vers_min $B $bccmin
	echo bcc version $B
	if [ $rc = 0 ]; then echo OKAY; else echo ERROR; fi
fi
echo

#
# Uncomment the line below to bypass all the checks
#
#exit 0
exit $ret