install.sh: expand @cfg_name@ in processed scripts
[girocco.git] / toolbox / girocco-config.sh
blobaf5f302439be4b81ba3e09213e3d34fd3cb1670b
1 #!/bin/sh
3 # Girocco "global" git config convenience tool
4 # Usage: girocco-config.sh <git config args>
5 # The purpose of this tool is simply to provide a convenient wrapper
6 # for adjusting the config values in the $chroot/etc/girocco/.gitconfig file.
7 # Directory permissions need to be manipulated before and after and it's
8 # clumsy to have to provide the longish --file=... argument.
9 # Hence this script. it's semantically just an alias for running:
10 # git config --file="$Girocco::Config::chroot/etc/girocco/.gitconfig" "$@"
12 set -e
14 . @basedir@/shlib.sh
16 trap 'chmod a-w "$cfg_chroot/etc/girocco"' EXIT
17 trap 'exit 129' HUP
18 trap 'exit 130' INT
19 trap 'exit 131' QUIT
20 trap 'exit 134' ABRT
21 trap 'exit 141' PIPE
22 trap 'exit 142' ALRM
23 trap 'exit 143' TERM
25 ec=
26 chmod u+w "$cfg_chroot/etc/girocco"
27 git config --file="$cfg_chroot/etc/girocco/.gitconfig" "$@" && ec=0 || ec=$?
28 chmod a-w "$cfg_chroot/etc/girocco"
29 trap - EXIT
30 exit ${ec:-1}