summaryrefslogtreecommitdiff
path: root/sh/cfg
blob: 92a097e7ef326d703be977688a4ca1e9256891b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh

umask 077
while getopts lsmM opt; do
	case $opt in
		#c)		
		#	work_tree_dir="$HOME"
		#	meta_file="$XDG_CONFIG_HOME/myconf/cfg${opt}_meta"
		#	cmd="git --git-dir=$HOME/.cfg$opt/ --work-tree=$HOME"
		#	;;
		l|s)	
			work_tree_dir=/
			meta_file="/etc/myconf/cfg${opt}_meta"
			cmd="sudo -E git --git-dir=/etc/.cfg$opt/ --work-tree=/"
			;;
		m)		
			sudo gitmetap "$cmd" "$work_tree_dir" "$meta_file"
			$cmd diff
			exit
			;;
		M)	
			sudo gitmetar "$meta_file"
			exit
			;;
		\?)	exit 1;;
	esac
done
shift $((OPTIND-1))
$cmd "$@"