You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							42 lines
						
					
					
						
							1.2 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							42 lines
						
					
					
						
							1.2 KiB
						
					
					
				| #!/bin/sh | |
| umask 022 | |
| set -e | |
| 
 | |
| if [ "$(id -u)" != "0" ]; then | |
|     echo "Please run this script as root" 1>&2 | |
|     exit 1 | |
| fi | |
| 
 | |
| if [ ! "$rocket" ]; then | |
|     echo 'Please set the $rocket variable' 1>&2 | |
|     exit 1 | |
| fi | |
| 
 | |
| rocket="$(realpath "$rocket")" | |
| 
 | |
| mkdir -p "$rocket/dev" "$rocket/proc" "$rocket/sys" "$rocket/run" | |
| mount --bind /dev "$rocket/dev" 2> /dev/null || true | |
| mount --bind /dev/pts "$rocket/dev/pts" 2> /dev/null || true  # Bind-mounting this because not doing so breaks some things. | |
| mount -t proc proc "$rocket/proc" 2> /dev/null || true | |
| mount -t tmpfs tmpfs "$rocket/run" 2> /dev/null || true | |
| if [ -h "$rocket/dev/shm" ]; then | |
|     mkdir -p "$rocket/$(readlink "$rocket/dev/shm")" | |
| fi | |
| 
 | |
| mkdir -p "$rocket/etc" | |
| cp /etc/resolv.conf "$rocket/etc/resolv.conf" | |
| 
 | |
| # FORCE_UNSAFE_CONFIGURE is needed for building some packages as root | |
| chroot "$rocket" /tools/bin/env -i \ | |
|     HOME=/root \ | |
|     TERM="$TERM" \ | |
|     PS1="(buildenv) \u:\w \$ " \ | |
|     PATH=/bin:/sbin:/usr/bin:/usr/sbin:/tools/bin:/tools/sbin \ | |
|     MAKEFLAGS="$MAKEFLAGS" \ | |
|     FORCE_UNSAFE_CONFIGURE=1 \ | |
|     /tools/bin/ash -l | |
| 
 | |
| umount "$rocket/dev/pts" || true | |
| umount "$rocket/dev" || true | |
| umount "$rocket/proc" || true | |
| umount "$rocket/run" || true
 | |
| 
 |