propellor

propellor config for hosts.
git clone git://git.ricketyspace.net/propellor.git
Log | Files | Refs | LICENSE

post-merge-hook (1095B)


      1 #!/bin/sh
      2 #
      3 # git post-merge (and post-checkout) hook, used by propellor's author to
      4 # maintain a joeyconfig branch with some changes while being able to merge
      5 # between it and branches without the changes.
      6 #
      7 # Each time this hook is run, it checks if it's on a branch with
      8 # name ending in "config". If so, config.hs is pointed at $branch.hs
      9 # and privdata/relocate is written to make files in privdata/.$branch/ be
     10 # used.
     11 # 
     12 # Otherwise, config.hs is pointed at config-simple.hs, and
     13 # privdata/relocate is removed.
     14 
     15 set -e
     16 
     17 commit () {
     18 	if [ -n "$(git status --short privdata/relocate config.hs)" ]; then
     19 		git commit -m "$1"
     20 	fi
     21 }
     22 
     23 branch="$(git symbolic-ref --short HEAD)"
     24 case "$branch" in
     25 	"")
     26 		true
     27 		;;
     28 	*config)
     29 		ln -sf "$branch".hs config.hs
     30 		git add config.hs
     31 		echo ".$branch" > privdata/relocate
     32 		git add privdata/relocate
     33 		commit "setting up $branch after merge"
     34 		;;
     35 	*)
     36 		ln -sf config-simple.hs config.hs
     37 		git add config.hs
     38 		if [ -e privdata/relocate ]; then
     39 			rm -f privdata/relocate
     40 			git rm --quiet privdata/relocate
     41 		fi
     42 		commit "clean up after merge"
     43 		;;
     44 esac