Update conditional checks and add yadm pre_commit hook
This commit is contained in:
		
							parent
							
								
									d3ba8c473d
								
							
						
					
					
						commit
						1251bb4eab
					
				
					 5 changed files with 45 additions and 9 deletions
				
			
		
							
								
								
									
										5
									
								
								.config/yadm/hooks/post_pull
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										5
									
								
								.config/yadm/hooks/post_pull
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| #!/usr/bin/env sh | ||||
| 
 | ||||
| echo "Running post pull script..." | ||||
| 
 | ||||
| autoinstall base | ||||
							
								
								
									
										1
									
								
								.config/yadm/hooks/pre_ci
									
										
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								.config/yadm/hooks/pre_ci
									
										
									
									
									
										Symbolic link
									
								
							|  | @ -0,0 +1 @@ | |||
| pre_commit | ||||
							
								
								
									
										30
									
								
								.config/yadm/hooks/pre_commit
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										30
									
								
								.config/yadm/hooks/pre_commit
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,30 @@ | |||
| #!/usr/bin/env sh | ||||
| 
 | ||||
| # Check encrypted files for newer versions | ||||
| files="$HOME/.config/yadm/encrypt" | ||||
| archive="$HOME/.local/share/yadm/archive" | ||||
| new_files=false | ||||
| 
 | ||||
| echo "Checking for newer versions of encrypted files..." | ||||
| while IFS= read -r file | ||||
| do | ||||
| 	if test "$HOME/$file" -nt "$archive" | ||||
| 	then | ||||
| 		echo "WARNING: ~/$file is newer than the archive!" | ||||
| 		new_files=true | ||||
| 	fi | ||||
| done < "$files" | ||||
| 
 | ||||
| if $new_files | ||||
| then | ||||
| 	echo "WARNING: There are newer versions of encrypted files!" | ||||
| 	echo "WARNING: Please consider re-encrypting them." | ||||
| 	printf "Continue? [y/N] " | ||||
| 	read -r answer | ||||
| 	if [ "$answer" = "n" ] || [ "$answer" = "N" ] | ||||
| 	then | ||||
| 		exit 1 | ||||
| 	fi | ||||
| else | ||||
| 	echo "All encrypted files are up to date." | ||||
| fi | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue