Migration to gogs.zionetrix.net
Benjamin Renard

Benjamin Renard commited on 2018-03-20 13:27:53
Showing 2 changed files, with 7 additions and 133 deletions.

... ...
@@ -1,32 +1,9 @@
1
-Nagios plugin to check Git Repository status
2
-============================================
1
+Migration to gogs.zionetrix.net :
3 2
 
4
-Usage
5
------
3
+ - Projet URL : https://gogs.zionetrix.net/bn8/check_git_config
4
+ - Git URL : https://gogs.zionetrix.net/bn8/check_git_config.git
6 5
 
7
-  Usage : ./check_git_config -g [directory] [-c|-r remote] [-d]
8
-          -g [directory]	Specify Git root directory (default : /srv/common)
9
-          -c		Check Git remote state
10
-          -r [remote]	Specify Git remote to check (default : origin)
11
-          -d		Enable debug mode
12
-
13
-Copyright
14
----------
15
-
16
-Copyright (c) 2013 Benjamin Renard 
17
-
18
-License
19
--------
20
-
21
-This program is free software; you can redistribute it and/or
22
-modify it under the terms of the GNU General Public License version 2
23
-as published by the Free Software Foundation.
24
-
25
-This program is distributed in the hope that it will be useful,
26
-but WITHOUT ANY WARRANTY; without even the implied warranty of
27
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
28
-GNU General Public License for more details.
29
-
30
-You should have received a copy of the GNU General Public License
31
-along with this program; if not, write to the Free Software
32
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
6
+To migrate, use the following commands :
7
+  git checkout 9debafb905b939017c7c01fad20d97b34aad5e0b
8
+  git remote set-url origin https://gogs.zionetrix.net/bn8/check_git_config.git
9
+  git pull
... ...
@@ -1,103 +0,0 @@
1
-#!/bin/bash
2
-#
3
-# Nagios plugin to check Git repository status
4
-#
5
-# Author : Benjamin Renard <brenard@easter-eggs.com>
6
-# Date : Wed, 14 Mar 2012 14:45:55 +0000
7
-# Source : http://git.zionetrix.net/check_git_config
8
-#
9
-
10
-GIT_ROOT=/srv/common
11
-GIT_REMOTE=origin
12
-DEBUG=0
13
-CHECK_REMOTE=0
14
-
15
-function usage() {
16
-	echo "Usage : $0 -g [directory] [-c|-r remote] [-d]
17
-	-g [directory]	Specify Git root directory (default : $GIT_ROOT)
18
-	-c		Check Git remote state
19
-	-r [remote]	Specify Git remote to check (default : $GIT_REMOTE)
20
-	-d		Enable debug mode"
21
-}
22
-
23
-while getopts "g:r:cdh-:" OPTION
24
-do
25
-	case "$OPTION" in
26
-		c)
27
-			CHECK_REMOTE=1
28
-		;;
29
-		g)
30
-			GIT_ROOT="${OPTARG}"
31
-		;;
32
-		r)
33
-			CHECK_REMOTE=1
34
-			GIT_REMOTE="${OPTARG}"
35
-		;;
36
-		d)
37
-			DEBUG=1
38
-		;;
39
-		h)
40
-			usage
41
-			exit 0
42
-		;;
43
-		*)
44
-			echo "Invalid parameter -$OPTION"
45
-			echo
46
-			usage
47
-			exit 1
48
-		;;
49
-	esac
50
-done
51
-
52
-[ ! -d "$GIT_ROOT" ] && echo "UNKNOWN : Git root directory does not exists !" && exit 3
53
-[ ! -d "$GIT_ROOT/.git" ] && echo "UNKNOWN : Git root directory seem to not being a git repository." && exit 3
54
-
55
-cd $GIT_ROOT
56
-
57
-STATUS=$( git status -s )
58
-
59
-[ $DEBUG -eq 1 ] && echo -e "Status : $STATUS"
60
-
61
-if [ -n "$STATUS" ]
62
-then
63
-	echo "WARNING : Git config repo on $( hostname ) not clean"
64
-	exit 1
65
-elif [ $CHECK_REMOTE -eq 1 ]
66
-then
67
-	# Check remote exists
68
-	[ $DEBUG -eq 1 ] && echo -n "Check remote '$GIT_REMOTE' exist : "
69
-	git remote show "$GIT_REMOTE" > /dev/null 2>&1
70
-	res=$?
71
-	[ $DEBUG -eq 1 ] && echo "done. (Return $res)"
72
-
73
-	if [ $res -ne 0 ]
74
-	then
75
-		echo "UNKNOWN : Unkown remote '$GIT_REMOTE'"
76
-		exit 3
77
-	fi
78
-
79
-	[ $DEBUG -eq 1 ] && echo -n "Fecth : "
80
-	git fetch "$GIT_REMOTE" > /dev/null 2>&1
81
-	res=$?
82
-	[ $DEBUG -eq 1 ] && echo "done. (Return $res)"
83
-
84
-	if [ $res -ne 0 ]
85
-	then
86
-		echo "UNKNOWN : Error fetching remote"
87
-		exit 3
88
-	fi
89
-
90
-	HEAD="$( git show HEAD|grep ^commit )"
91
-	[ $DEBUG -eq 1 ] && echo "Local : $HEAD"
92
-
93
-	ORIGIN="$( git show origin|grep ^commit )"
94
-	[ $DEBUG -eq 1 ] && echo "Remote : $ORIGIN"
95
-	
96
-	if [ "$HEAD" != "$ORIGIN" ]
97
-	then
98
-		echo "CRITICAL : Git config not uptodate"
99
-		exit 2
100
-	fi
101
-fi
102
-echo "OK"
103
-exit 0
104 0