feat: add some utils like tracking
This commit is contained in:
		
							parent
							
								
									8ba156a62b
								
							
						
					
					
						commit
						c2eedb304e
					
				
					 3 changed files with 28 additions and 8 deletions
				
			
		
							
								
								
									
										7
									
								
								skip_steps.sh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								skip_steps.sh
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,7 @@ | |||
| #!/bin/sh | ||||
| 
 | ||||
| mkdir .dotfiles &>/dev/null | ||||
| 
 | ||||
| for item in ${@:-update install_package_list run_system_scripts run_user_scripts link_home overlay}; do | ||||
|     echo "executed_step:$item" >> .dotfiles/pending_sync | ||||
| done | ||||
							
								
								
									
										27
									
								
								sync.sh
									
										
									
									
									
								
							
							
						
						
									
										27
									
								
								sync.sh
									
										
									
									
									
								
							|  | @ -99,21 +99,34 @@ __step_link_home() { | |||
|     for item in $(find ./home -type f); do | ||||
|         path=$(echo $item | sed "s/\.\/home//") | ||||
|         [ -z "$path" ] && continue | ||||
|         grep -q "$path" $trackingfile &> /dev/null && continue | ||||
|         path="$HOME$path" | ||||
|         mkdir -p $(dirname $path) &> /dev/null | ||||
|         ln $item $path && echo "$path" >> $trackingfile | ||||
|     done | ||||
| } | ||||
| 
 | ||||
| step() { | ||||
|     if ! grep -q "executed_step:$1" .dotfiles/pending_sync &> /dev/null; then | ||||
|         $(printf "__step_%s" "$1") | ||||
|         echo "executed_step:$1" >> .dotfiles/pending_sync | ||||
|     fi | ||||
| } | ||||
| 
 | ||||
| mkdir -p .dotfiles &> /dev/null | ||||
| touch .dotfiles/pending_sync | ||||
| 
 | ||||
| if [ -n "$1" ]; then | ||||
|     $(printf "__step_%s" "$1") | ||||
|     step $1 | ||||
| else | ||||
|     __step_update | ||||
|     __step_install_package_list | ||||
|     __step_run_system_scripts | ||||
|     __step_run_user_scripts | ||||
|     __step_link_home | ||||
|     __step_overlay | ||||
|     echo "started_sync:$(date)" >> .dotfiles/log | ||||
|     step update | ||||
|     step install_package_list | ||||
|     step run_system_scripts | ||||
|     step run_user_scripts | ||||
|     step link_home | ||||
|     step overlay | ||||
|     echo "finished_sync:$(date)" >> .dotfiles/log | ||||
| fi | ||||
| 
 | ||||
| unlink .dotfiles/pending_sync | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| #!/bin/sh | ||||
| 
 | ||||
| for linkfile in $@; do | ||||
| for linkfile in ${@:-$(find .dotfiles -type f -name *-links)}; do | ||||
|     echo "# processing linkfile $linkfile..." | ||||
|     for link in $(cat $linkfile); do | ||||
|         echo "# unlinking $link..." | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue