mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	pkg/chrootarchive: provide TMPDIR for ApplyLayer
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
This commit is contained in:
		
							parent
							
								
									31d1d73303
								
							
						
					
					
						commit
						330171e1d9
					
				
					 1 changed files with 9 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -3,6 +3,7 @@ package chrootarchive
 | 
			
		|||
import (
 | 
			
		||||
	"flag"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"io/ioutil"
 | 
			
		||||
	"os"
 | 
			
		||||
	"runtime"
 | 
			
		||||
	"syscall"
 | 
			
		||||
| 
						 | 
				
			
			@ -21,9 +22,16 @@ func applyLayer() {
 | 
			
		|||
	if err := syscall.Chdir("/"); err != nil {
 | 
			
		||||
		fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
	if err := archive.ApplyLayer("/", os.Stdin); err != nil {
 | 
			
		||||
	tmpDir, err := ioutil.TempDir("/", "temp-docker-extract")
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
	os.Setenv("TMPDIR", tmpDir)
 | 
			
		||||
	if err := archive.ApplyLayer("/", os.Stdin); err != nil {
 | 
			
		||||
		os.RemoveAll(tmpDir)
 | 
			
		||||
		fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
	os.RemoveAll(tmpDir)
 | 
			
		||||
	os.Exit(0)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue