summaryrefslogtreecommitdiff
path: root/security/audit-packages/files/download-vulnerability-list
blob: 78b64df8a1ded0f19c87473bb8d64e6a26ec1f53 (plain)
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
#! ${SH}
# $NetBSD: download-vulnerability-list,v 1.10 2001/12/17 18:08:21 wiz Exp $

if [ ! -e ${DISTDIR} ]; then
	echo "Creating ${DISTDIR}"
	/bin/mkdir -p ${DISTDIR} || (echo "Can't create ${DISTDIR}" 1>&2; exit 1)
fi

VUL_SOURCE="ftp://ftp.netbsd.org/pub/NetBSD/packages/distfiles/vulnerabilities"
NEW_VUL_LIST=${DISTDIR}/vulnerabilities.$$
EXIST_VUL_LIST=${DISTDIR}/vulnerabilities

${FETCH_CMD} -o ${NEW_VUL_LIST} ${VUL_SOURCE}
existsize=0
newsize=0
if [ -f ${EXIST_VUL_LIST} ]; then
	existsize=`/bin/ls -l ${EXIST_VUL_LIST} | ${AWK} '{ print $5 }'`
fi
if [ -f ${NEW_VUL_LIST} ]; then
	newsize=`/bin/ls -l ${NEW_VUL_LIST} | ${AWK} '{ print $5 }'`
fi
if [ $newsize -lt $existsize ]; then
	echo "New vulnerability list ($newsize bytes) is smaller than existing list ($existsize bytes)" 1>&2
	/bin/rm -f ${NEW_VUL_LIST}
	exit 1
fi

/bin/mv -f ${NEW_VUL_LIST} ${EXIST_VUL_LIST}

exit 0