report users and do basic ownership check before trying to delete repo
This commit is contained in:
		
					parent
					
						
							
								a2e67f746f
							
						
					
				
			
			
				commit
				
					
						6383cbb62f
					
				
			
		
					 1 changed files with 4 additions and 3 deletions
				
			
		|  | @ -55,12 +55,13 @@ | |||
|     wantedBy = [ "default.target" ]; | ||||
|     requires = [ "network-online.target" ]; | ||||
|     preStart = '' | ||||
|       echo \"\n\" >> /run/secrets/git_clone_key | ||||
|       id | ||||
|       echo "\n" >> /run/secrets/git_clone_key | ||||
|       sleep 5 | ||||
|       id | ||||
|       echo "$(stat -c '%U' /var/lib/yate/.git) owns /var/lib/yate/.git" | ||||
|       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 | ||||
|       if [[ $SSH_SUCCESS = 1 && $(stat -c '%U' /var/lib/yate/.git) == *yate* ]]; 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 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue