]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.sbin/periodic/etc/weekly/340.noid
Update our devicetree to 4.19 for arm and arm64
[FreeBSD/FreeBSD.git] / usr.sbin / periodic / etc / weekly / 340.noid
1 #!/bin/sh -
2 #
3 # $FreeBSD$
4 #
5
6 # If there is a global system configuration file, suck it in.
7 #
8 if [ -r /etc/defaults/periodic.conf ]
9 then
10     . /etc/defaults/periodic.conf
11     source_periodic_confs
12 fi
13
14 case "$weekly_noid_enable" in
15     [Yy][Ee][Ss])
16         echo ""
17         echo "Check for files with an unknown user or group:"
18
19         # Host should not test jailed subtrees as jails have their own
20         # databases of users and groups. Leave them for jailed invocations
21         # of this script.
22
23         exclude=''
24         if [ $(sysctl -n security.jail.jailed) = 0 ]; then
25             sep=:
26             OIFS="$IFS"
27             IFS="$sep"
28             for param in $(jail -f "`sysrc -n jail_conf`" -e "$sep" 2>/dev/null)
29             do
30                 case "$param" in
31                     path=*) exclude="$exclude -path ${param#path=} -prune -or"
32                 esac
33             done
34             IFS="$OIFS"
35         fi
36
37         rc=$(find -H ${weekly_noid_dirs:-/} \
38             \( $exclude ! -fstype local -prune -or -name \* \) -and \
39             \( -nogroup -o -nouser \) -print | sed 's/^/  /' |
40             tee /dev/stderr | wc -l)
41         [ $rc -gt 1 ] && rc=1
42         ;;
43
44     *)  rc=0;;
45 esac
46
47 exit $rc