make sure source is available before deleting config
This commit is contained in:
parent
c9967f73c0
commit
c62f722899
|
@ -34,13 +34,18 @@
|
||||||
wantedBy = [ "default.target" ];
|
wantedBy = [ "default.target" ];
|
||||||
requiredBy = [ "network.target" ];
|
requiredBy = [ "network.target" ];
|
||||||
preStart = "echo \"\n\" >> /run/secrets/git_clone_key
|
preStart = "echo \"\n\" >> /run/secrets/git_clone_key
|
||||||
|
sleep 1
|
||||||
|
SSH_SUCCESS=1
|
||||||
|
${pkgs.openssh}/bin/ssh -q -i /run/secrets/git_clone_key forgejo@git.hamburg.ccc.de || SSH_SUCCESS=0
|
||||||
|
if [ $SSH_SUCCESS = 1 ]; then
|
||||||
rm -rf /var/lib/yate/*
|
rm -rf /var/lib/yate/*
|
||||||
rm -rf /var/lib/yate/.*
|
rm -rf /var/lib/yate/.*
|
||||||
${pkgs.git}/bin/git init /var/lib/yate
|
${pkgs.git}/bin/git init /var/lib/yate
|
||||||
${pkgs.git}/bin/git -C /var/lib/yate config --add safe.directory \"/var/lib/yate\"
|
${pkgs.git}/bin/git -C /var/lib/yate config --add safe.directory \"/var/lib/yate\"
|
||||||
${pkgs.git}/bin/git -C /var/lib/yate remote add origin forgejo@git.hamburg.ccc.de:echtnurich/yate-config.git
|
${pkgs.git}/bin/git -C /var/lib/yate remote add origin forgejo@git.hamburg.ccc.de:echtnurich/yate-config.git
|
||||||
env GIT_SSH_COMMAND=\"${pkgs.openssh}/bin/ssh -i /run/secrets/git_clone_key\" ${pkgs.git}/bin/git -C /var/lib/yate fetch --all
|
env GIT_SSH_COMMAND=\"${pkgs.openssh}/bin/ssh -i /run/secrets/git_clone_key\" ${pkgs.git}/bin/git -C /var/lib/yate fetch --all
|
||||||
${pkgs.git}/bin/git -C /var/lib/yate checkout --track -f origin/master";
|
${pkgs.git}/bin/git -C /var/lib/yate checkout --track -f origin/master
|
||||||
|
fi";
|
||||||
|
|
||||||
# ...
|
# ...
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue