 9c839d789f
			
		
	
	
		9c839d789f
		
			
		
	
	
	
	
		
			
			Most of them are missing quotes, `` -> $(), and -o/-a usage in conditions. Also add few directives disabling checks where were too verbose.
		
			
				
	
	
		
			33 lines
		
	
	
		
			788 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			788 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/bin/sh
 | |
| 
 | |
| read -r disk_name
 | |
| 
 | |
| set -e
 | |
| 
 | |
| case $disk_name in
 | |
|     private)
 | |
|         # force some read to refresh device size
 | |
|         head /dev/xvdb > /dev/null
 | |
|         resize2fs /dev/xvdb
 | |
|         ;;
 | |
|     root)
 | |
|         # force some read to refresh device size
 | |
|         head /dev/xvda > /dev/null
 | |
|         new_size=$(cat /sys/block/xvda/size)
 | |
|         ro=$(/sys/block/xvda/ro)
 | |
|         if [ "$ro" -eq 1 ]; then
 | |
|             new_table="0 $new_size snapshot /dev/xvda /dev/xvdc2 N 16"
 | |
|         else
 | |
|             new_table="0 $new_size linear /dev/xvda 0"
 | |
|         fi
 | |
|         dmsetup load dmroot --table "$new_table"
 | |
|         dmsetup resume dmroot
 | |
|         resize2fs /dev/mapper/dmroot
 | |
|         ;;
 | |
|     *)
 | |
|         echo "Automatic resize of '$disk_name' not supported" >&2
 | |
|         exit 1
 | |
|         ;;
 | |
| esac
 | |
|         
 |