/usr/bin/auchk is in aufs-tools 1:3.2+20130722-1.1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
| 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 | #!/bin/sh -
# Copyright (C) 2005-2011 Junjiro R. Okajima
#
# This program, aufs is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
set -eu
#set -x
EEcho() # str
{
	echo $0: $@ 1>&2
}
f=/etc/default/aufs
. $f
Usage()
{
	cat <<- EOF
	$0 [OPTION] writable_branch '[...]'
	-q | --quiet:
	-w | --whiteout:
	-r | --real:
	-s | --skip:
	EOF
}
Pass() # title
{
	pass=$(($pass + 1))
	test $opt_q -ne 1 && EEcho \[Pass $pass\] $@
	true
}
Remove() # file
{
	if [ -d "$1" ]
	then
		if [ $opt_r -eq 1 ]
		then
			rm -fvr "$1" || :
		else
			rm -ir "$1" || :
		fi
	else
		rm -v "$1" || :
	fi
}
opt_q=0
opt_w=0
opt_r=0
opt_s=0
for i
do
	case $(getopt -o qwrs --long quiet,whiteout,real,skip -- $i | sed -e 's/^ *//' -e 's/ --$//' ) in
	-q|--quiet)	opt_q=1;;
	-w|--whiteout)	opt_w=1;;
	-r|--real)	opt_r=1;;
	-s|--skip)	opt_s=1;;
	--)		;;
	*)		break;;
	esac
	shift
done
for i
do
	test $opt_q -ne 1 && EEcho Checking "$i" for aufs
	cd "$i"
	case $(stat -f -c %T .) in
	aufs|UNKNOWN*${AUFS_SUPER_MAGIC_HEX}*)
		EEcho $i must not be aufs
		cd $OLDPWD
		continue
		;;
	esac
	########################################
	pass=0
	Pass Illegal whiteout
	find . -name '.wh.*' ! -name '.wh..wh.*' -printf '%h\0%f\0' |
	xargs -r0n2 |
	while read dir wh
	do
		#echo \""$dir"\" \""$wh"\"
		base=$(echo "$wh" | cut -c5-)
		test ! -e "$dir/$base" && continue
		ls -ld "$dir/$wh" "$dir/$base"
		if [ $opt_w -eq 1 ]
		then ans=w
		elif [ $opt_r -eq 1 ]
		then ans=r
		elif [ $opt_s -eq 1 ]
		then ans=s
		else
			read -p 'Which to remove [whiteout/real/skip]? ' ans \
				< /dev/tty > /dev/tty 2>&1
		fi
		case "$ans" in
		[wW]*)	Remove "$dir/$wh" || :;;
		[rR]*)	Remove "$dir/$base" || :;;
		*)	echo skipped;;
		esac
	done
	########################################
	Pass Remained pseudo-links
	did=0
	for plink in ${AUFS_WH_PLINKDIR}/*
	do
		test ! -e "$plink" && break
		if [ -d "$plink" ]
		then
			EEcho illegal "$plink"
			continue
		fi
		did=1
		#ls -l "$plink" || :
		find . -inum $(basename "$plink" | cut -f2 -d .) -ls || :
	done
	if [ $did -ne 0 ]
	then
		cat <<- EOF
		They will be maintained at remount or umount time,
		if you installed aufs helper scripts (See README
		in detail).
		If "$i" is not a writeble branch of CURRENTLY mounted
		aufs, you need to maintain them by yourself.
		EOF
	fi
	########################################
	Pass Remained temp files
	for tmp in ${AUFS_WH_ORPHDIR}/*
	do
		test ! -e "$tmp" && break
		if [ -d "$tmp" ]
		then
			EEcho illegal "$tmp"
			continue
		fi
		ls -l "$tmp" || :
		rm -i "$tmp" || :
	done
	# nothing to do for xinodir
	cd $OLDPWD
done
 |