#!/bin/bash
#
# Find filesystems and remount filesystems flagged with x-remount to ensure complete propagation of all options
#

MOUNTS=$(awk '$3=="none" && $4 ~ /(^|,)x-remount(,|$)/ { print $2}' </etc/fstab)

if [ -n "${MOUNTS}" ]; then
    for MOUNT in $MOUNTS; do
        echo mount -o remount ${MOUNT}
        mount -o remount ${MOUNT}
    done
fi
