28 lines
619 B
Bash
Executable File
28 lines
619 B
Bash
Executable File
#!/bin/sh
|
|
# Copyright © 2010 by Daniel Friesel <derf@chaosdorf.de>
|
|
# License: WTFPL:
|
|
# 0. You just DO WHAT THE FUCK YOU WANT TO.
|
|
#
|
|
# You probably need to run this check via sudo. For /etc,
|
|
# > nagios ALL=(root) NOPASSWD: /usr/local/lib/nagios/plugins/check_git_status /etc
|
|
# should do the job.
|
|
|
|
REPO="${1}"
|
|
|
|
if [ -z "${REPO}" -o ! -d "${REPO}" ]
|
|
then
|
|
echo 'No repo specified or no such repo';
|
|
exit 3
|
|
fi
|
|
|
|
cd "${REPO}" || exit 3
|
|
|
|
if [ -z "$(git ls-files --modified --deleted --others --exclude-standard)" ]
|
|
then
|
|
echo "No uncommited changes in ${REPO}"
|
|
exit 0
|
|
else
|
|
echo "Uncommited changes in ${REPO}"
|
|
exit 1
|
|
fi
|