summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuiz Souza <luiz@netgate.com>2018-09-29 20:04:41 -0300
committerLuiz Souza <luiz@netgate.com>2018-09-29 20:07:28 -0300
commitbd7524d6b955d42e37214b25b04708faec699c55 (patch)
tree9f0119a48d007d42a2e7ffa65cbfc6dcb7bd62b5
parent1d0ffd34da6d2e47f0d7b9b948fc354b4b870d34 (diff)
downloadFreeBSD-src-bd7524d6b955d42e37214b25b04708faec699c55.zip
FreeBSD-src-bd7524d6b955d42e37214b25b04708faec699c55.tar.gz
Fix a warning in growfs. gpart commit is supposed to be called on disk device.
(cherry picked from commit 33976174adbd3f9d8ba61b2dbe904adb4a16f4ae)
-rwxr-xr-xetc/rc.d/growfs21
1 files changed, 20 insertions, 1 deletions
diff --git a/etc/rc.d/growfs b/etc/rc.d/growfs
index d296050..33cfc5f 100755
--- a/etc/rc.d/growfs
+++ b/etc/rc.d/growfs
@@ -46,6 +46,20 @@ start_cmd="growfs_start"
stop_cmd=":"
rcvar="growfs_enable"
+growfs_get_diskdev ()
+{
+ sysctl -b kern.geom.conftxt |
+ while read line
+ do
+ local _type=$(echo ${line} | awk '{printf $2}')
+ local _dev=$(echo ${line} | awk '{printf $3}')
+ if [ "${_type}" = "DISK" -a -n "$(echo ${1} | grep ${_dev})" ]; then
+ echo -n ${_dev}
+ break
+ fi
+ done
+}
+
growfs_start ()
{
echo "Growing root partition to fill device"
@@ -67,6 +81,11 @@ growfs_start ()
search=$rawdev
fi
+ diskdev=$(growfs_get_diskdev ${search})
+ if [ -z "${diskdev" ]; then
+ diskdev=${rootdev}
+ fi
+
sysctl -b kern.geom.conftxt | awk '
{
lvl=$1
@@ -96,7 +115,7 @@ growfs_start ()
exit 0
}
}' dev="$search"
- gpart commit "$rootdev"
+ gpart commit "$diskdev"
growfs -y /dev/"$rootdev"
}
OpenPOWER on IntegriCloud