1 #!/bin/sh 2 # 3 # $NetBSD: resize_gpt,v 1.2 2020/05/24 18:43:39 jmcneill Exp $ 4 # 5 6 # PROVIDE: resize_gpt 7 # REQUIRE: fsck_root 8 # BEFORE: resize_root 9 10 $_rc_subr_loaded . /etc/rc.subr 11 12 name="resize_gpt" 13 rcvar=$name 14 start_cmd="resize_gpt_start" 15 stop_cmd=":" 16 17 resize_gpt_start() 18 { 19 ROOT_DEVICE=$(sysctl -n kern.root_device) 20 case ${ROOT_DEVICE} in 21 dk*) 22 ;; 23 *) 24 # Root device is not a wedge, bail out. 25 exit 0 26 ;; 27 esac 28 29 BLOCK_DEVICE=$(dkctl ${ROOT_DEVICE} getwedgeinfo | head -1 | sed 's/://' | awk '{ print $3; }') 30 31 gpt -H resizedisk -q ${BLOCK_DEVICE} 32 gpt -H resize -a 4m -i 2 -q ${BLOCK_DEVICE} 33 return 34 } 35 36 load_rc_config $name 37 run_rc_command "$1" 38