Hide Windows partition in dual boot setups

From radmind

Jump to: navigation, search
#!/bin/sh
# post-apply script that creates an entry in /etc/fstab to stop automount of the
# windows partition in a dualboot setup.
# Install in /var/radmind/postapply

WINDOWS_VOLUME=/dev/disk0s3
FSTAB=/etc/fstab

PATH=/usr/sbin:${PATH}

if [ ! -s ${FSTAB} ]; then
   UUID=$(sudo diskutil info ${WINDOWS_VOLUME} | perl -ne 'print $1 if (m/UUID:\s+(\S+)/);');

   echo "#" >> ${FSTAB};
   echo "# Warning - this file should only be modified with vifs(8)" >> ${FSTAB};
   echo "#" >> ${FSTAB};
   echo "# Failure to do so is unsupported and may be destructive." >> ${FSTAB};
   echo "#" >> ${FSTAB};
   echo "# Hide the Windows partition (${WINDOWS_VOLUME})" >> ${FSTAB};
   echo "UUID=${UUID} none ntfs noowners,ro,noauto 0  0" >> ${FSTAB};

fi

exit 0
Personal tools