--- /dev/null
+all: build
+
+build:
+
+install: build
+ install -o root -g root -m 0644 auf-git-etc.sh $(DESTDIR)/etc/profile.d/
+
+clean:
+
+deb:
+ debuild
+
--- /dev/null
+Objectif :
+ Automatiser la configuration du suivi de /etc et /usr/local via git.
+
+Documentation :
+ http://wiki.auf.org/wikiteki/Git/SuiviDeConfiguration
+
+Responsable :
+ Progfou <jean-christophe.andre@auf.org>
+
--- /dev/null
+if [ -n "$PS1" ]; then
+ # on lance un git status sur l'utilisateur s'il est dans le groupe
+ # aufadmin ou bien si c'est root
+ if $(id -Gn | grep -qw aufadmin) || test $(id -u) -eq 0; then
+ (cd / ; sudo /usr/bin/git status -a)
+ fi
+ # les lignes suivantes tentent de configurer les variables GIT_*
+ # si les résultats ne sont pas bien "devinés", définir les bonnes
+ # valeurs dans .bash_profile (ou .profile pour root)
+ if test -z "$GIT_AUTHOR_NAME"; then
+ GIT_AUTHOR_NAME="$(getent passwd $(id -un)|cut -d: -f5|cut -d, -f1)"
+ fi
+ if test -z "$GIT_AUTHOR_EMAIL"; then
+ GIT_AUTHOR_EMAIL="$(id -un)@$(hostname -f)"
+ fi
+ if test -z "$GIT_COMMITTER_NAME"; then
+ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
+ fi
+ if test -z "$GIT_COMMITTER_EMAIL"; then
+ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
+ fi
+ export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL
+fi
--- /dev/null
+auf-git-etc (1.0) stable; urgency=low
+
+ * Premier jet.
+
+ -- Progfou <jean-christophe.andre@auf.org> Mon, 29 Sep 2008 00:47:35 +0700
+
--- /dev/null
+Source: auf-git-etc
+Section: auf
+Priority: optional
+Maintainer: Progfou <jean-christophe.andre@auf.org>
+Build-Depends: debhelper (>= 5)
+Standards-Version: 3.7.2
+
+Package: auf-git-etc
+Architecture: all
+Depends: git-core, ${misc:Depends}
+Suggests: tig
+Description: suivi de /etc et /usr/local via git
+ Ce paquet permet d'automatiser l'installation du suivi de /etc et
+ /usr/local via un dépôt GIT global (à la racine) sur un système.
+
--- /dev/null
+etc/profile.d
--- /dev/null
+README
+sample
--- /dev/null
+#!/bin/sh
+# postinst script for auf-git-etc
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postinst> `configure' <most-recently-configured-version>
+# * <old-postinst> `abort-upgrade' <new version>
+# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+# <new-version>
+# * <postinst> `abort-remove'
+# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+# <failed-install-package> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ configure)
+
+ # on crée au besoin le dépôt GIT global à ce système
+ if [ ! -d /var/lib/git/root ]; then
+ cd /
+ git init-db
+ chmod 0700 /.git
+ mkdir -p /var/lib/git
+ mv /.git /var/lib/git/root
+ cp -a /usr/share/doc/auf-git-etc-*/sample/exclude /.git/info/
+ cp -a /usr/share/doc/auf-git-etc-*/sample/post-commit /.git/hooks/
+ chmod 0755 /.git/hooks/post-commit
+ git add etc usr/local
+ git commit -m "Mise en route du suivi de /etc et /usr/local." \
+ --author "Installation auf-git-etc <root@apt.auf.org>"
+ fi
+ if [ ! -L /.git ]; then
+ ln -s /var/lib/git/root /.git
+ fi
+
+ # on conserve l'environnement GIT pendant un sudo
+ if ! grep -q "env_keep.*GIT" /etc/sudoers; then
+ sed -i '/^$/{s//Defaults env_keep += "GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL"\n/;:l;n;b l}' /etc/sudoers
+ fi
+
+ # on autorise le groupe aufadmin à demander le statut GIT
+ if ! grep -q '^%aufadmin.*git status' /etc/sudoers; then
+ echo '%aufadmin ALL=(ALL) NOPASSWD: /usr/bin/git status -a' >> /etc/sudoers
+ fi
+
+ # on ajoute de la souplesse dans /etc/profile
+ # XXX: c'est pas vraiment spécifique à ce paquet...
+ if ! grep -q '/etc/profile.d' /etc/profile; then
+ sed -i '/^PATH/r /proc/self/fd/0' /etc/profile << __EOF__
+
+if [ -d /etc/profile.d ]; then
+ for i in /etc/profile.d/*.sh; do
+ if [ -r $i ]; then
+ . $i
+ fi
+ done
+ unset i
+fi
+__EOF__
+ fi
+
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
--- /dev/null
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+
+
+configure: configure-stamp
+configure-stamp:
+ dh_testdir
+ # Add here commands to configure the package.
+
+ touch configure-stamp
+
+
+build: build-stamp
+
+build-stamp: configure-stamp
+ dh_testdir
+
+ # Add here commands to compile the package.
+ $(MAKE)
+ #docbook-to-man debian/auf-git-etc.sgml > auf-git-etc.1
+
+ touch $@
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp configure-stamp
+
+ # Add here commands to clean up after the build process.
+ -$(MAKE) clean
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/auf-git-etc.
+ $(MAKE) DESTDIR=$(CURDIR)/debian/auf-git-etc install
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs
+ dh_installdocs
+# dh_installexamples
+# dh_install
+# dh_installmenu
+# dh_installdebconf
+# dh_installlogrotate
+# dh_installemacsen
+# dh_installpam
+# dh_installmime
+# dh_python
+# dh_installinit
+# dh_installcron
+# dh_installinfo
+# dh_installman
+# dh_link
+# dh_strip
+ dh_compress
+ dh_fixperms
+# dh_perl
+# dh_makeshlibs
+ dh_installdeb
+# dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
+++ /dev/null
-Objectif :
- Automatiser la configuration du suivi de /etc via git.
-
-Documentation :
- http://wiki.auf.org/wikiteki/Git/SuiviDeConfiguration
-
-Responsable :
- Jean Christophe André
-
--- /dev/null
+# Le fichier /var/lib/git/root/info/exclude à modifier ou créer
+# Par défaut, on exclut tout sauf /etc
+/*
+!/etc
+# ... mais dans /etc on interdit certains fichiers :
+/etc/*shadow*
+/etc/ssh/ssh_host_*_key
+/etc/mtab
+/etc/adjtime
+/etc/ld.so.cache
+# On n'interdit pas non plus le parcours de /usr. Mais dans ce parcours,
+# on interdit tout sauf /usr/local. C'est la technique pour inclure /usr/local...
+!/usr
+/usr/*
+!/usr/local
+# quelques type fichiers à ne pas jamais considérer, globalement :
+*.dpkg-old
+*.dpkg-new
+*.dpkg-dist
+*.ucf-old
+*.ucf-new
+*.ucf-dist
+.*.swp
+*~
+*#
+*-
+*.bak
--- /dev/null
+#recipients="admins@XX.auf.org" # adresse pour l'envoi du mail
+recipients="root"
+# On modifie un peu la sortie de git show :
+# 1) on ajoute "From git hostname" devant le nom en From
+# 2) on retire le [PATCH] dans le sujet, replacé par git-commit:
+# 3) on ajoute un champ To:
+# et on envoie le tout via sendmail
+PATH=/usr/sbin:/usr/bin:/sbin:/bin
+git show --pretty=email |
+ sed -e '1,6s/^From: /From: git '`hostname -f`' - /'
+ -e '1,6s/^Subject: \[PATCH\]/Subject: git-commit:/'
+ -e '2iTo: '"${recipients}" |
+ head -c 16k | /usr/sbin/sendmail ${recipients}
+exit 0