finally fix pulling and refreshing the config in a stable way
This commit is contained in:
parent
d413dc071e
commit
a2e67f746f
1 changed files with 6 additions and 4 deletions
|
@ -56,20 +56,22 @@
|
|||
requires = [ "network-online.target" ];
|
||||
preStart = ''
|
||||
echo \"\n\" >> /run/secrets/git_clone_key
|
||||
id
|
||||
sleep 5
|
||||
SSH_SUCCESS=1
|
||||
${pkgs.openssh}/bin/ssh -q -i /run/secrets/git_clone_key forgejo@git.hamburg.ccc.de 2> /var/lib/yate/SSH_CHECK_LOG || SSH_SUCCESS=0
|
||||
if [ $SSH_SUCCESS = 1 ]; then
|
||||
rm -rf /var/lib/yate/*
|
||||
rm -rf /var/lib/yate/.*
|
||||
env GIT_SSH_COMMAND=\"${pkgs.openssh}/bin/ssh -i /run/secrets/git_clone_key\" ${pkgs.git}/bin/git clone forgejo@git.hamburg.ccc.de:CCCHH/yate-config.git /var/lib/yate
|
||||
${pkgs.git}/bin/git -C /var/lib/yate config --add safe.directory \"/var/lib/yate\"
|
||||
env GIT_SSH_COMMAND="${pkgs.openssh}/bin/ssh -i /run/secrets/git_clone_key" ${pkgs.git}/bin/git clone forgejo@git.hamburg.ccc.de:CCCHH/yate-config.git /var/lib/yate
|
||||
${pkgs.git}/bin/git -C /var/lib/yate config --add safe.directory "/var/lib/yate"
|
||||
fi
|
||||
'';
|
||||
reload= ''
|
||||
id
|
||||
${pkgs.git}/bin/git config --global --add safe.directory /var/lib/yate
|
||||
/usr/bin/env GIT_SSH_COMMAND=\\"${pkgs.openssh}/bin/ssh -i /run/secrets/git_clone_key\\" ${pkgs.git}/bin/git -C /var/lib/yate fetch --all
|
||||
/usr/bin/env GIT_SSH_COMMAND=\\"${pkgs.openssh}/bin/ssh -i /run/secrets/git_clone_key\\" ${pkgs.git}/bin/git -C /var/lib/yate reset --hard origin/main
|
||||
/usr/bin/env GIT_SSH_COMMAND="${pkgs.openssh}/bin/ssh -i /run/secrets/git_clone_key" ${pkgs.git}/bin/git -C /var/lib/yate fetch --all
|
||||
/usr/bin/env GIT_SSH_COMMAND="${pkgs.openssh}/bin/ssh -i /run/secrets/git_clone_key" ${pkgs.git}/bin/git -C /var/lib/yate reset --hard origin/master
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue