diff options
author | Xiao Pan <xyz@flylightning.xyz> | 2025-07-11 11:36:34 +0800 |
---|---|---|
committer | Xiao Pan <xyz@flylightning.xyz> | 2025-07-11 11:36:34 +0800 |
commit | 14b7db0c493ab863db826dac27137234cb1d2f16 (patch) | |
tree | 1137998361a55719a541b619d10505bb94804d5f /sh | |
parent | 424219312c02150c94b7983b6539fc3e7ac7a3c5 (diff) |
cfg: ib cfgs use 10.0.0.1 as remote need to be ran in a netns because wg is in that netns
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" |