periodic/security: minor fixes to 670.pkgsraudit
[dragonfly.git] / etc / periodic / security / 670.pkgsrcaudit
CommitLineData
4e0f4f9c
JL
1#!/bin/sh -
2#
3# Copyright (c) 2010 The DragonFly Project
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9# 1. Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer.
11# 2. Redistributions in binary form must reproduce the above copyright
12# notice, this list of conditions and the following disclaimer in the
13# documentation and/or other materials provided with the distribution.
14#
15# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25# SUCH DAMAGE.
26#
27
28# If there is a global system configuration file, suck it in.
29#
30if [ -r /etc/defaults/periodic.conf ]
31then
32 . /etc/defaults/periodic.conf
33 source_periodic_confs
34fi
35
fc9dd859 36PATH=$PATH:/usr/pkg/sbin
4e0f4f9c
JL
37pkgdb_dir=${pkgdb_dir:-/var/db/pkg}
38
39if pkg_info -K ${pkgdb_dir} -q -E '*'; then
40 case "$daily_status_pkgsrc_fetch_vulnerabilities" in
41 [Yy][Ee][Ss])
42 echo ""
43 echo 'Fetching package vulnerabilities database:'
0426ff00 44 pkg_admin -K ${pkgdb_dir} fetch-pkg-vulnerabilities -u
4e0f4f9c
JL
45 rc0=$?
46 ;;
47 *) rc0=0;
48 esac
49 case "$daily_status_pkgsrc_audit_enable" in
50 [Yy][Ee][Ss])
51 echo ""
52 echo 'Checking pkgsrc packages for vulnerabilities:'
53 pkg_admin -K ${pkgdb_dir} audit
54 rc1=$?
55 ;;
56 *) rc1=0;
57 esac
58 case "$daily_status_pkgsrc_check_signatures" in
59 [Yy][Ee][Ss])
60 echo ""
61 echo 'Checking pkgsrc file signatures:'
62 pkg_admin -K ${pkgdb_dir} check
63 rc2=$?
64 ;;
65 *) rc2=0
66 esac
67fi
68if [ $rc0 -gt 0 ] || [ $rc1 -gt 0 ] || [ $rc2 -gt 0 ]; then
69 rc=1
fc9dd859
JL
70else
71 rc=0
4e0f4f9c
JL
72fi
73exit "$rc"