summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorEvan Susarret <evansus@gmail.com>2013-04-24 06:18:21 -0300
committerEvan Susarret <evansus@gmail.com>2013-04-24 06:18:21 -0300
commit98304a9268ecfea6efde439575a06acb9f1dbe48 (patch)
tree24fb30d7540c99e0fa92487847d0f959a93fe402 /etc
parent3312d8afb71fd39e969730f91e38bf2eec34f957 (diff)
downloadpfsense-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-xetc/rc6
1 files changed, 3 insertions, 3 deletions
diff --git a/etc/rc b/etc/rc
index 70996d8..9546b73 100755
--- a/etc/rc
+++ b/etc/rc
@@ -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
OpenPOWER on IntegriCloud