Fix config via git

This commit is contained in:
echtnurich 2024-08-05 20:58:09 +02:00
parent b4de5dbb53
commit 1ef4c1cd48
Signed by: echtnurich
SSH key fingerprint: SHA256:1eIkxME0VPeXC2WMl9Haus+q0SLFymSAWU7f6Z+A8Aw
3 changed files with 21 additions and 6 deletions

View file

@ -6,5 +6,7 @@
domain = "z9.ccchh.net"; domain = "z9.ccchh.net";
}; };
users.users.chaos.password = "yes";
system.stateVersion = "23.11"; system.stateVersion = "23.11";
} }

View file

@ -12,17 +12,22 @@
ExecStart = "${pkgs.yate}/bin/yate -c /etc/yate -e /etc/yate/share -Do"; ExecStart = "${pkgs.yate}/bin/yate -c /etc/yate -e /etc/yate/share -Do";
Type="simple"; Type="simple";
Restart="always"; Restart="always";
Group="yate-config";
StateDirectory = "yate";
StateDirectoryMode = "0775";
# ... # ...
}; };
wantedBy = [ "default.target" ]; wantedBy = [ "default.target" ];
requiredBy = [ "network.target" ]; requiredBy = [ "network.target" ];
preStart = "if mkdir -p /etc/yate preStart = "if ! [ -d \"/var/lib/yate/.git\" ]
then then
${pkgs.git}/bin/git -C /etc/yate clone forgejo@git.hamburg.ccc.de:echtnurich/yate-config.git ${pkgs.git}/bin/git init /var/lib/yate
${pkgs.git}/bin/git -C /etc/yate pull ${pkgs.git}/bin/git -C /var/lib/yate remote add origin forgejo@git.hamburg.ccc.de:echtnurich/yate-config.git
else ${pkgs.git}/bin/git -C /var/lib/yate pull -f --set-upstream
${pkgs.git}/bin/git -C /etc/yate checkout -f origin/main echo \"New repo set up.\"
fi"; fi
${pkgs.git}/bin/git -C /var/lib/yate fetch --all
${pkgs.git}/bin/git -C /var/lib/yate checkout --track -f origin/master";
# ... # ...
}; };
} }

View file

@ -10,4 +10,12 @@
# Just disable it for now. # Just disable it for now.
networking.firewall.enable = false; networking.firewall.enable = false;
users.groups.yate-config = {};
users.groups.yate-config.members = [ "colmema-deploy" "chaos" ];
environment.etc.yate.user = "root";
environment.etc.yate.group = "yate-config";
environment.etc.yate.mode = "0775";
environment.etc.yate.source = "/var/lib/yate";
} }