forked from ungleich-public/cdist
		
	handle resolv.conf
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								4547d2efa1
							
						
					
				
			
			
				commit
				
					
						ce82e32c59
					
				
			
		
					 1 changed files with 24 additions and 1 deletions
				
			
		|  | @ -1,6 +1,6 @@ | |||
| #!/bin/sh | ||||
| # | ||||
| # 2011 Steven Armstrong (steven-cdist at armstrong.cc) | ||||
| # 2011-2016 Steven Armstrong (steven-cdist at armstrong.cc) | ||||
| # | ||||
| # This file is part of cdist. | ||||
| # | ||||
|  | @ -25,6 +25,16 @@ remote_copy="$__type/files/remote/copy" | |||
| cdist_args="-v" | ||||
| [ "$__debug" = "yes" ] && cdist_args="$cdist_args -d" | ||||
| 
 | ||||
| 
 | ||||
| cat << DONE | ||||
| $__remote_exec $__target_host << EOSSH | ||||
| if [ ! -f "${chroot}/etc/resolv.conf" ]; then | ||||
|    touch "${chroot}/etc/resolv.conf" | ||||
| fi | ||||
| mount --bind -o ro /etc/resolv.conf "${chroot}/etc/resolv.conf" | ||||
| EOSSH | ||||
| DONE | ||||
| 
 | ||||
| cat << DONE | ||||
| cdist $cdist_args \ | ||||
|    config \ | ||||
|  | @ -32,3 +42,16 @@ cdist $cdist_args \ | |||
|    --remote-copy="$remote_copy $chroot" \ | ||||
|    $__target_host | ||||
| DONE | ||||
| 
 | ||||
| cat << DONE | ||||
| $__remote_exec $__target_host << EOSSH | ||||
| if mountpoint -q "${chroot}/etc/resolv.conf"; | ||||
|    umount "${chroot}/etc/resolv.conf" | ||||
| fi | ||||
| if [ -f "${chroot}/etc/resolv.conf" -a ! -s "${chroot}/etc/resolv.conf" ]; then | ||||
|    # file exists but is empty which means we created it or it's useless anyway | ||||
|    rm "${chroot}/etc/resolv.conf" | ||||
| fi | ||||
| 
 | ||||
| EOSSH | ||||
| DONE | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue