Ask for block device, add steps loop, add 'wipe' and 'partition' steps
This commit is contained in:
		
							parent
							
								
									f1ba4f6ecb
								
							
						
					
					
						commit
						add83c13d3
					
				
							
								
								
									
										18
									
								
								install.sh
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								install.sh
									
									
									
									
									
								
							| @ -16,6 +16,13 @@ if [ "$answer" != "y" ]; then | |||||||
| 	exit 1 | 	exit 1 | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
|  | echo "=> Please enter the full path to the block device the installation should take place on: (e.g. /dev/sda)" | ||||||
|  | echo "   Make sure to choose a drive, not a partition." | ||||||
|  | echo "   Hint: here's a list of devices that may be the right:" | ||||||
|  | ls /dev/sd* /dev/mmc* 2>/dev/null | ||||||
|  | echo -n "Install to: " | ||||||
|  | read blockdevice | ||||||
|  | 
 | ||||||
| for check in checks/*.check | for check in checks/*.check | ||||||
| do | do | ||||||
| 	echo "=> Running check '$check'..." | 	echo "=> Running check '$check'..." | ||||||
| @ -26,3 +33,14 @@ do | |||||||
| 		exit | 		exit | ||||||
| 	fi | 	fi | ||||||
| done | done | ||||||
|  | 
 | ||||||
|  | for step in steps/*.step | ||||||
|  | do | ||||||
|  | 	echo "=> Running step '$step'..." | ||||||
|  | 	$($step) | ||||||
|  | 	return=$? | ||||||
|  | 	if [ "$return" -ne 0 ]; then | ||||||
|  | 		echo "=> Step failed. That is weird. Sorry. Check logs maybe." | ||||||
|  | 		exit | ||||||
|  | 	fi | ||||||
|  | done | ||||||
|  | |||||||
							
								
								
									
										12
									
								
								steps/10-wipe.step
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								steps/10-wipe.step
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,12 @@ | |||||||
|  | #!/bin/sh | ||||||
|  | 
 | ||||||
|  | echo "~> Going to wipe $blockdevice. You sure? (y/N) " | ||||||
|  | read answer | ||||||
|  | 
 | ||||||
|  | if [ "$answer" == "y" ]; then | ||||||
|  | 	echo "~> OK. Be patient now, that could take some time..." | ||||||
|  | 	dd if=/dev/zero of=$blockdevice status=progress | ||||||
|  | 	return $? | ||||||
|  | else | ||||||
|  | 	exit 1 | ||||||
|  | fi | ||||||
							
								
								
									
										15
									
								
								steps/20-partition.step
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								steps/20-partition.step
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,15 @@ | |||||||
|  | #!/bin/sh | ||||||
|  | 
 | ||||||
|  | echo "~> Setting up $blockdevice with:" | ||||||
|  | echo " * 300M EFI (FAT32) partition" | ||||||
|  | echo " * <full> crypted (LUKS) root (EXT4) partition" | ||||||
|  | 
 | ||||||
|  | echo "g\nn\n1\n2048\n+300M\nn\n2\n\n\np\nw" | ||||||
|  | 
 | ||||||
|  | if [ "$?" -eq 0 ]; then | ||||||
|  | 	echo "~> Seems to have worked. Yay!" | ||||||
|  | 	exit 0 | ||||||
|  | else | ||||||
|  | 	echo "~> Failed. :(" | ||||||
|  | 	exit 1 | ||||||
|  | fi | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user