File: BUILD

package info (click to toggle)
inn 1.7.2-4.2
  • links: PTS
  • area: main
  • in suites: slink
  • size: 5,012 kB
  • ctags: 3,173
  • sloc: ansic: 35,576; perl: 7,652; sh: 4,013; makefile: 2,085; awk: 1,567; yacc: 685; tcl: 85; csh: 70
file content (308 lines) | stat: -rwxr-xr-x 7,574 bytes parent folder | download | duplicates (12)
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
#! /bin/sh
##  $Revision: 1.14 $
##  An interactive script to configure, build, and install InterNetNews.
##  Installation documentation can be found in the "Install.ms*" files;
##  please see the README!

UMASK=${INN_UMASK-027}
MAKE=${MAKE-make}

if [ ! -f config/config.data ] ; then
    X=`basename ${EDITOR-vi}`
    echo "You don't have a config.data file.  Do the following:" 1>&2
    echo '    cd config' 1>&2
    echo '    cp config.dist config.data' 1>&2
    echo "    $X config.data" 1>&2
    echo '    cd ..' 1>&2
    echo 'And start again.' 1>&2
    exit 1
fi

echo 'NOTE:  If you just type [RETURN] to any question, this script will'
echo '       assume you are being cautious, and default to whatever answer'
echo '       is "safer."  This usually means recompiling.'
echo ''
echo '       You cannot install over a running system; this script will'
echo '       remind you about this later.'

echo ''
if [ -f config/subst ] ; then
    if cmp -s config/subst config/subst.sh ; then
	TYPE="sh"
    else
	TYPE="c"
    fi
    echo "A ${TYPE} version of subst exists;"
    file config/subst
    echo '-- do you want to use it [y or n]?  ' | tr -d '\012'
    read reply
    reply=`echo "${reply}" | tr -d ' \011'`
    case "X${reply}" in
    X[yY]*)
	;;
    *)
	rm config/subst
	if [ -f config/subst ] ; then
	    echo 'Please remove config/subst and start again.' 1>&2
	    exit 1
	fi
	;;
    esac
fi

if [ ! -f config/subst ] ; then
    echo ''
    echo 'Use the /bin/sh version of subst, or the C version?'
    echo "Type sh, c, or x if you don't care:  " | tr -d '\012'
    read style
    reply=`echo "${reply}" | tr -d ' \011'`
    case "X${style}" in
    X[Cc]*)	WHAT=c		;;
    X[Ss][Hh]*)	WHAT=sh		;;
    *)		WHAT=subst	;;
    esac

    echo 'Building subst...'
    cd config ; ${MAKE} ${WHAT} ; cd ..
    if [ ! -f config/subst ] ; then
	echo "Can't build subst -- please investigate and fix." 1>&2
	exit 1
    fi
fi

echo ''
echo 'Have you already built the executables [y or n]?  ' | tr -d '\012'
read reply
reply=`echo "${reply}" | tr -d ' \011'`
case "X${reply}" in
X[yY]*)
    MUSTBUILD=false
    ;;
*)
    MUSTBUILD=true
    ;;
esac

if ${MUSTBUILD} ; then
    echo ''
    echo 'Configuring INN'
    cd config ; ${MAKE} quiet ; cd ..

    echo ''
    echo 'Building and linting the INN library.'
    echo 'Please examine the lint output.'
    cd lib ; ${MAKE} lint ; cd ..
    ${PAGER-more} lib/lint || cat lib/lint

    echo ''
    echo 'Continue with the build [y or n]?  ' | tr -d '\012'
    read reply
    reply=`echo "${reply}" | tr -d ' \011'`
    case "X${reply}" in
    X[yY]*)
	;;
    *)
	echo 'Fix any problems and start again.' 1>&2
	exit 1
	;;
    esac

    echo ''
    echo 'Run lint after each compile [y or n]?  ' | tr -d '\012'
    read reply
    reply=`echo "${reply}" | tr -d ' \011'`
    case "X${reply}" in
    X[yY]*)
	WHAT=lint
	echo ''
	echo 'Compiling and linting the INN programs.'
	;;
    *)
	WHAT=all
	echo ''
	echo 'Compiling the INN programs.'
	;;
    esac
    ${MAKE} ${WHAT} || {
	echo 'Could not build INN.  Fix any problems and start again.' 1>&2
	exit 1
    }

    if [ ${WHAT} = lint ] ; then
	echo ''
	echo 'Do you want to see the lint output [y or n]?  ' | tr -d '\012'
	read reply
	reply=`echo "${reply}" | tr -d ' \011'`
	case "X${reply}" in
	X[yY]*)
	    ${PAGER-more} */lint || cat */lint
	    ;;
	esac
    fi
fi

umask ${UMASK}
echo ''
echo 'Setting umask to' `umask`

echo ''
echo 'Do the spool, etc., directories exist [y or n]?  ' | tr -d '\012'
read reply
reply=`echo "${reply}" | tr -d ' \011'`
case "X${reply}" in
X[nN]*)
    echo 'Please su to root and run the "makedirs.sh" script'
    su
    ;;
esac

echo ''
echo 'You are now ready to install the INN programs and config files.'
echo 'You CANNOT DO THIS if INN is running now -- you must shut down'
echo 'your news system first.'
echo 'Do you want to continue with the installation [y or n]?  ' | tr -d '\012'
read reply
reply=`echo "${reply}" | tr -d ' \011'`
case "X${reply}" in
X[yY]*)
    ;;
*)
    echo 'Fix any problems and start again.' 1>&2
    exit 1
esac

echo ''
echo 'Installing the INN programs.'
echo 'Part of this may fail if you do not have have write permission in'
echo 'all the destination directories.  This is often the case for innd'
echo 'and inndstart, for example.  If the following "make" fails, do this:'
echo '	echo ${MAKE} update | su'
echo 'and rerun this script.'
${MAKE} update || {
    echo 'Could not install INN.  Fix any problems and start again.' 1>&2
    exit 1
}

echo ''
echo 'Building the data files.'
cd site
${MAKE} all || {
    echo 'Fix any problems and start again.' 1>&2
    exit 1
}
cd ..

MORETODO=true
SUB='a subshell'
while ${MORETODO} ; do
    echo ''
    echo "Start ${SUB} to edit the config files [y or n]?  " | tr -d '\012'
    read reply
    reply=`echo "${reply}" | tr -d ' \011'`
    case "X${reply}" in
    X[yY]*)
	cd site
	${SHELL-/bin/sh}
	cd ..
	SUB='another shell'
	;;
    X[nN]*)
	MORETODO=false
	;;
    esac
done

echo ''
echo 'Installing the data files.'
cd site
${MAKE} install || {
    echo 'Could not install INN.  Fix any problems and start again.' 1>&2
    exit 1
}
cd ..

echo ''
echo 'Checking other data files.'
TEMP=${TMPDIR-/tmp}/inn$$
cat >${TEMP} <<\EOF
# =()<ACTIVEFILE=@<_PATH_ACTIVE>@>()=
ACTIVEFILE=/usr/lib/news/active
# =()<HISTORY=@<_PATH_HISTORY>@>()=
HISTORY=/usr/lib/news/history
# =()<NEWSBIN=@<_PATH_NEWSBIN>@>()=
NEWSBIN=/usr/lib/newsbin
# =()<NEWSLIB=@<_PATH_NEWSLIB>@>()=
NEWSLIB=/usr/lib/news
# =()<OWNERS="-o @<NEWSUSER>@ -g @<NEWSGROUP>@">()=
OWNERS="-o news -g news"
EOF
./config/subst -f config/config.data ${TEMP} >/dev/null
. ${TEMP}
rm ${TEMP}
PATH=${PATH}:${NEWSBIN} ; export PATH

##  Active file.
if [ ! -f ${ACTIVEFILE} ] ; then
    echo ''
    echo 'You have no active file; making one.'
    echo 'Make sure to create the new groups you want!'
    echo 'control 0000000000 0000000001 n' >${ACTIVEFILE}
    echo 'junk 0000000000 0000000001 n' >>${ACTIVEFILE}
else
    ${NEWSBIN}/makeactive -m -o >${ACTIVEFILE}.new || {
	echo 'Could not update your active file.' 1>&2
	echo "Please run ${NEWSBIN}/makeactive -mo by hand." 1>&2
	exit 1
    }
    { mv -f ${ACTIVEFILE} ${ACTIVEFILE}.old && mv ${ACTIVEFILE}.new ${ACTIVEFILE} ; } || {
	echo 'Could not update active file (to widen number columns).'
	echo "Please run ${NEWSBIN}/makeactive -mo by hand." 1>&2
	exit 1
    }
    sh ./installit.sh ${OWNERS} -m 0640 ${ACTIVEFILE} ${ACTIVEFILE}
fi

##  History file.
if [ ! -f ${HISTORY} ] ; then
    touch ${HISTORY}
    FLAGS="-r -i"
else
    echo ''
    echo 'Did you use DBZ in your old news system [y or n]?  ' | tr -d '\012'
    read reply
    reply=`echo "${reply}" | tr -d ' \011'`
    case "X${reply}" in
    X[yY]*)
	;;
    *)
	FLAGS="-i"
	echo 'Will rebuild full history file'
	cp /dev/null ${HISTORY}
	;;
    esac
fi

echo ''
echo 'Setting correct ownership of history file -- double-check when done.'
sh ./installit.sh ${OWNERS} -m 0664 ${HISTORY} ${HISTORY}
ls -l ${HISTORY}

echo ''
echo 'Rebuilding history.  This may take some time, so it is the last thing'
echo 'in the installation.'
HERE=`/bin/pwd`
HISTORYDIR=`echo ${HISTORY} | sed -e 's@\(.*\)/.*@\1@'`
cd ${HISTORYDIR}
${NEWSBIN}/makehistory ${FLAGS} || {
    echo 'Could not build history.' 1>&2
    echo "Please run ${NEWSBIN}/makehistory by hand." 1>&2
    exit 1
}
mv history.n.dir history.dir
mv history.n.pag history.pag

cd ${HERE}
sh ./installit.sh ${OWNERS} -m 0664 ${HISTORY}.dir ${HISTORY}.dir
sh ./installit.sh ${OWNERS} -m 0664 ${HISTORY}.pag ${HISTORY}.pag

exit 0