install -o root -g root -m 0755 cron.auf-git-etc $(DESTDIR)/usr/sbin/
install -o root -g root -m 0755 -d $(DESTDIR)/etc/profile.d
install -o root -g root -m 0644 auf-git-etc.sh $(DESTDIR)/etc/profile.d/
- install -o root -g root -m 0755 -d $(DESTDIR)/etc/auf-git-etc
- install -o root -g root -m 0644 git.exclude $(DESTDIR)/etc/auf-git-etc/exclude
- install -o root -g root -m 0755 git.post-commit $(DESTDIR)/etc/auf-git-etc/post-commit
+ install -o root -g root -m 0750 -d $(DESTDIR)/etc/auf-git-etc
+ cp -a etc/* $(DESTDIR)/etc/auf-git-etc/
clean:
+++ /dev/null
-/etc/cron.d/auf-git-etc
-/etc/profile.d/auf-git-etc.sh
-/etc/auf-git-etc/exclude
-/etc/auf-git-etc/post-commit
set -e
-# XXX: debogage, à supprimer avant release
-echo "==> postinst($@) - `date`" >> /tmp/auf-git-etc.debug
-ls -la /etc/auf-git-etc >> /tmp/auf-git-etc.debug
-
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
echo "ATTENTION : un /.git existe mais ne pointe pas sur /var/lib/git/root !"
echo "ATTENTION : vous avez pris de l'avance, ce sera à vous de gérer ça... ;-)"
echo ""
+ else
+ # on gère la migration en conffiles
+ if [ ! -L /.git/info ]; then
+ for f in /etc/auf-git-etc/info/* ; do
+ mv -f ${f} ${f}.dpkg-dist
+ done
+ mv /.git/info/* /etc/auf-git-etc/info/
+ rmdir /.git/info
+ ln -s /etc/auf-git-etc/info /.git/
+ fi
+ if [ ! -L /.git/hooks ]; then
+ for f in /etc/auf-git-etc/hooks/* ; do
+ mv -f ${f} ${f}.dpkg-dist
+ done
+ mv /.git/hooks/* /etc/auf-git-etc/hooks/
+ rmdir /.git/hooks
+ ln -s /etc/auf-git-etc/hooks /.git/
+ fi
fi
# on vérifie la présence d'un existant
elif [ -d /var/lib/git/root ]; then
# on crée le dépôt GIT global à ce système
else
cd /
- git init-db
+ git init-db > /dev/null
# git >= 1.5
#git config status.relativePaths false
chmod 0700 /.git
mkdir -p /var/lib/git
mv /.git /var/lib/git/root
ln -s /var/lib/git/root /.git
- ln -s -f /etc/auf-git-etc/exclude /.git/info/
- ln -s -f /etc/auf-git-etc/post-commit /.git/hooks/
+ # déplacement des configurations par défaut dans /etc/auf-git-etc/
+ cd /.git
+ for d in info hooks ; do
+ for f in $d/* ; do
+ if [ -e /etc/auf-git-etc/${f} ]; then
+ rm -f -r ${f}
+ else
+ mv ${f} /etc/auf-git-etc/${f}
+ fi
+ done
+ rmdir $d
+ ln -s /etc/auf-git-etc/$d $d
+ done
+ # mise en route du suivi
+ cd /
git add etc usr/local
- git add boot/grub/menu.lst || true # absent des serveurs virtuels
- git add var/chroot/bind/etc || true # absent des serveurs non DNS
+ # on ignore les erreurs : absent des serveurs virtuels
+ git add boot/grub/menu.lst >& /dev/null || true
+ # on ignore les erreurs : absent des serveurs autres que DNS
+ git add var/chroot/bind/etc >& /dev/null || true
# TODO: ajouter -q quand on sera en git ≥ 1.5 (Debian "Lenny")
git commit -m "Mise en route du suivi de /etc et /usr/local." \
- --author "Installation auf-git-etc <root@apt.auf.org>"
+ --author "Installation auf-git-etc <root@apt.auf.org>" \
+ > /dev/null
fi
;;
+++ /dev/null
-#!/bin/sh
-# preinst script for test
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# XXX: debogage, à supprimer avant release
-echo "==> preinst($@) `date`" >> /tmp/auf-git-etc.debug
-ls -la /etc/auf-git-etc >> /tmp/auf-git-etc.debug
-
-# summary of how this script can be called:
-# * <new-preinst> `install'
-# * <new-preinst> `install' <old-version>
-# * <new-preinst> `upgrade' <old-version>
-# * <old-preinst> `abort-upgrade' <new-version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-
-
-case "$1" in
- install|upgrade)
- if [ "`readlink -f /.git`" = "/var/lib/git/root" ]; then
- # on gère la migration des exclude et post-commit en conffile
- if [ ! -L /.git/info/exclude ]; then
- mv -f /etc/auf-git-etc/exclude /etc/auf-git-etc/exclude.dpkg-dist
- mv /.git/info/exclude /etc/auf-git-etc/
- fi
- if [ ! -L /.git/hooks/post-commit ]; then
- mv -f /etc/auf-git-etc/post-commit /etc/auf-git-etc/post-commit.dpkg-dist
- mv /.git/hooks/post-commit /etc/auf-git-etc/
- fi
- fi
- ;;
-
- abort-upgrade)
- ;;
-
- *)
- echo "preinst 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
+#!/bin/sh
+recipients="root+git" # adresse pour l'envoi du mail
+# On modifie un peu la sortie de git show :
+# 1) on insère "git hostname - " devant le nom en From:
+# 2) on remplace "[PATCH]" par "git-commit:" dans le champ Subject:
+# 3) on ajoute un champ To:
+# 4) on ajoute un champ Content-Type:
+# 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 '3iTo: '"${recipients}" \
+ -e '4iContent-Type: text/plain; charset=utf-8' |
+ head -c 16k | /usr/sbin/sendmail ${recipients}
+exit 0
--- /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/krb5.keytab
+/etc/mtab
+/etc/adjtime
+/etc/ld.so.cache
+/etc/lvm/.cache
+/etc/lvm/archive
+/etc/blkid.tab*
+/etc/ppp/pap-secrets
+/etc/ppp/chap-secrets
+/etc/aliases.db
+/etc/postfix/*.db
+/etc/postfix/*/*.db
+/etc/samba/schannel_store.tdb
+# 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
+# Pareil pour la config de Bind en chroot
+!/var
+/var/*
+!/var/chroot
+/var/chroot/*
+!/var/chroot/bind
+/var/chroot/bind/*
+!/var/chroot/bind/etc
+/var/chroot/bind/etc/bind/rndc.key
+# Le /boot/grub/menu.lst peut être intéressant à suivre aussi
+!/boot
+/boot/*
+!/boot/grub
+/boot/grub/*
+!/boot/grub/menu.lst
+# quelques type fichiers à ne pas jamais considérer, globalement :
+htpasswd
+.htpasswd
+*.dpkg-old
+*.dpkg-new
+*.dpkg-dist
+*.ucf-old
+*.ucf-new
+*.ucf-dist
+.*.swp
+*~
+*#
+*-
+*.bak
+# toutes les clés, généralement type partie privée RSA/DSA
+*.key
+*-key.pem
+# on ne suit pas les log (dans /etc ?!)
+*.log
+++ /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/krb5.keytab
-/etc/mtab
-/etc/adjtime
-/etc/ld.so.cache
-/etc/lvm/.cache
-/etc/lvm/archive
-/etc/blkid.tab*
-/etc/ppp/pap-secrets
-/etc/ppp/chap-secrets
-/etc/aliases.db
-/etc/postfix/*.db
-/etc/postfix/*/*.db
-/etc/samba/schannel_store.tdb
-# 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
-# Pareil pour la config de Bind en chroot
-!/var
-/var/*
-!/var/chroot
-/var/chroot/*
-!/var/chroot/bind
-/var/chroot/bind/*
-!/var/chroot/bind/etc
-/var/chroot/bind/etc/bind/rndc.key
-# Le /boot/grub/menu.lst peut être intéressant à suivre aussi
-!/boot
-/boot/*
-!/boot/grub
-/boot/grub/*
-!/boot/grub/menu.lst
-# quelques type fichiers à ne pas jamais considérer, globalement :
-htpasswd
-.htpasswd
-*.dpkg-old
-*.dpkg-new
-*.dpkg-dist
-*.ucf-old
-*.ucf-new
-*.ucf-dist
-.*.swp
-*~
-*#
-*-
-*.bak
-# toutes les clés, généralement type partie privée RSA/DSA
-*.key
-*-key.pem
-# on ne suit pas les log (dans /etc ?!)
-*.log
+++ /dev/null
-#!/bin/sh
-recipients="root+git" # adresse pour l'envoi du mail
-# On modifie un peu la sortie de git show :
-# 1) on insère "git hostname - " devant le nom en From:
-# 2) on remplace "[PATCH]" par "git-commit:" dans le champ Subject:
-# 3) on ajoute un champ To:
-# 4) on ajoute un champ Content-Type:
-# 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 '3iTo: '"${recipients}" \
- -e '4iContent-Type: text/plain; charset=utf-8' |
- head -c 16k | /usr/sbin/sendmail ${recipients}
-exit 0