diff options
Diffstat (limited to 'sh')
-rwxr-xr-x | sh/cfg | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -1,5 +1,6 @@ #!/bin/sh +hostname="$(hostname)" umask 077 while getopts lsmM opt; do case $opt in @@ -11,7 +12,13 @@ while getopts lsmM opt; do l|s) work_tree_dir=/ meta_file="/etc/myconf/cfg${opt}_meta" - cmd="sudo -E git --git-dir=/etc/.cfg$opt/ --work-tree=/" + # ib cfgs use 10.0.0.1 as remote but its wg is in a netns, so need `ip netns exec ns0` + # note `sudo -E` seems needed for `gita -s`, but `cfg -s add` and then `cfg -s commit` seems no need `sudo -E` here and only sudo works fine, not sure why, need more test + if [ "$opt" = s ] && [ "$hostname" = xyzib ]; then + cmd="sudo -E ip netns exec ns0 git --git-dir=/etc/.cfg$opt/ --work-tree=/" + else + cmd="sudo -E git --git-dir=/etc/.cfg$opt/ --work-tree=/" + fi ;; m) sudo gitmetap "$cmd" "$work_tree_dir" "$meta_file" |