2 # Filename: hg-snapshot-script
3 # Purpose: automatically track changed files using mercurial
4 # Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2 or any later version.
7 # Latest change: Mit Sep 26 22:46:32 CEST 2007 [mika]
8 ################################################################################
12 caller=$(ps axww | mawk '/aptitude|apt-get/ {for (i=5; i<=NF ; i++) printf ("%s ",$i); printf ("\n") }' | head -1)
14 hg addremove 1>/dev/null
17 if [ -z "$STATUS" ] ; then
18 echo "hg-snapshot-script: nothing to be done"
22 echo "hg-snapshot-script: found changed files:"
24 hg ci -m "snapshot from $LOGNAME before: $caller"
27 echo "hg-snapshot-script: found changed files:"
29 hg ci -m "snapshot from $LOGNAME after: $caller"
32 echo "hg-snapshot-script: found changed files:"
34 hg ci -m "snapshot from $LOGNAME on $(date '+%Y-%m-%d - %H:%M:%S')"
39 ## END OF FILE #################################################################