diff options
author | Evan Susarret <evansus@gmail.com> | 2013-04-24 06:18:21 -0300 |
---|---|---|
committer | Evan Susarret <evansus@gmail.com> | 2013-04-24 06:18:21 -0300 |
commit | 98304a9268ecfea6efde439575a06acb9f1dbe48 (patch) | |
tree | 24fb30d7540c99e0fa92487847d0f959a93fe402 /etc | |
parent | 3312d8afb71fd39e969730f91e38bf2eec34f957 (diff) | |
download | pfsense-98304a9268ecfea6efde439575a06acb9f1dbe48.zip pfsense-98304a9268ecfea6efde439575a06acb9f1dbe48.tar.gz |
ZFSROOT not hardcoded to zpool or dataset 'tank'
For ZFS root readonly case, the WHEREISROOT variable was grep-ing for 'tank', expecting a zpool with that name.
A workaround of naming a dataset 'tank', for example, 'sys/ROOT/tank' or 'sys/tank/pfSense' is compatible, however this shouldn't be hardcoded in.
My proposed change replaces WHEREISROOT with ZFSROOT using awk. I noticed awk is used elsewhere in this script. However it is still simple code that is not resilient against unexpected circumstances, let alone failure.
Diffstat (limited to 'etc')
-rwxr-xr-x | etc/rc | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -68,9 +68,9 @@ echo "Mounting filesystems..." # Handle ZFS read-only case if [ "$PLATFORM" = "pfSense" ]; then if [ -f /usr/bin/grep ]; then - WHEREISROOT=`/sbin/mount | /usr/bin/grep " / " | /usr/bin/grep "tank" | /usr/bin/cut -d' ' -f1` - if [ "$WHEREISROOT" != "" ]; then - /sbin/zfs set readonly=off $WHEREISROOT + ZFSROOT=`/sbin/mount | /usr/bin/grep " / " | /usr/bin/awk -F ' on ' '{print $1}'` + if [ "$ZFSROOT" != "" ]; then + echo /sbin/zfs set readonly=off $ZFSROOT fi fi fi |