+

Migration to gogs.zionetrix.net

Benjamin Renard [2018-03-20 13:27:53]
Migration to gogs.zionetrix.net
Filename
README
check_git_config
diff --git a/README b/README
index 8b8656c..cb754e2 100644
--- a/README
+++ b/README
@@ -1,32 +1,9 @@
-Nagios plugin to check Git Repository status
-============================================
+Migration to gogs.zionetrix.net :

-Usage
------
+ - Projet URL : https://gogs.zionetrix.net/bn8/check_git_config
+ - Git URL : https://gogs.zionetrix.net/bn8/check_git_config.git

-  Usage : ./check_git_config -g [directory] [-c|-r remote] [-d]
-          -g [directory]	Specify Git root directory (default : /srv/common)
-          -c		Check Git remote state
-          -r [remote]	Specify Git remote to check (default : origin)
-          -d		Enable debug mode
-
-Copyright
----------
-
-Copyright (c) 2013 Benjamin Renard
-
-License
--------
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+To migrate, use the following commands :
+  git checkout 9debafb905b939017c7c01fad20d97b34aad5e0b
+  git remote set-url origin https://gogs.zionetrix.net/bn8/check_git_config.git
+  git pull
diff --git a/check_git_config b/check_git_config
deleted file mode 100755
index 40d83f6..0000000
--- a/check_git_config
+++ /dev/null
@@ -1,103 +0,0 @@
-#!/bin/bash
-#
-# Nagios plugin to check Git repository status
-#
-# Author : Benjamin Renard <brenard@easter-eggs.com>
-# Date : Wed, 14 Mar 2012 14:45:55 +0000
-# Source : http://git.zionetrix.net/check_git_config
-#
-
-GIT_ROOT=/srv/common
-GIT_REMOTE=origin
-DEBUG=0
-CHECK_REMOTE=0
-
-function usage() {
-	echo "Usage : $0 -g [directory] [-c|-r remote] [-d]
-	-g [directory]	Specify Git root directory (default : $GIT_ROOT)
-	-c		Check Git remote state
-	-r [remote]	Specify Git remote to check (default : $GIT_REMOTE)
-	-d		Enable debug mode"
-}
-
-while getopts "g:r:cdh-:" OPTION
-do
-	case "$OPTION" in
-		c)
-			CHECK_REMOTE=1
-		;;
-		g)
-			GIT_ROOT="${OPTARG}"
-		;;
-		r)
-			CHECK_REMOTE=1
-			GIT_REMOTE="${OPTARG}"
-		;;
-		d)
-			DEBUG=1
-		;;
-		h)
-			usage
-			exit 0
-		;;
-		*)
-			echo "Invalid parameter -$OPTION"
-			echo
-			usage
-			exit 1
-		;;
-	esac
-done
-
-[ ! -d "$GIT_ROOT" ] && echo "UNKNOWN : Git root directory does not exists !" && exit 3
-[ ! -d "$GIT_ROOT/.git" ] && echo "UNKNOWN : Git root directory seem to not being a git repository." && exit 3
-
-cd $GIT_ROOT
-
-STATUS=$( git status -s )
-
-[ $DEBUG -eq 1 ] && echo -e "Status : $STATUS"
-
-if [ -n "$STATUS" ]
-then
-	echo "WARNING : Git config repo on $( hostname ) not clean"
-	exit 1
-elif [ $CHECK_REMOTE -eq 1 ]
-then
-	# Check remote exists
-	[ $DEBUG -eq 1 ] && echo -n "Check remote '$GIT_REMOTE' exist : "
-	git remote show "$GIT_REMOTE" > /dev/null 2>&1
-	res=$?
-	[ $DEBUG -eq 1 ] && echo "done. (Return $res)"
-
-	if [ $res -ne 0 ]
-	then
-		echo "UNKNOWN : Unkown remote '$GIT_REMOTE'"
-		exit 3
-	fi
-
-	[ $DEBUG -eq 1 ] && echo -n "Fecth : "
-	git fetch "$GIT_REMOTE" > /dev/null 2>&1
-	res=$?
-	[ $DEBUG -eq 1 ] && echo "done. (Return $res)"
-
-	if [ $res -ne 0 ]
-	then
-		echo "UNKNOWN : Error fetching remote"
-		exit 3
-	fi
-
-	HEAD="$( git show HEAD|grep ^commit )"
-	[ $DEBUG -eq 1 ] && echo "Local : $HEAD"
-
-	ORIGIN="$( git show origin|grep ^commit )"
-	[ $DEBUG -eq 1 ] && echo "Remote : $ORIGIN"
-
-	if [ "$HEAD" != "$ORIGIN" ]
-	then
-		echo "CRITICAL : Git config not uptodate"
-		exit 2
-	fi
-fi
-echo "OK"
-exit 0
ViewGit