Created
October 17, 2014 08:39
-
-
Save anonymous/d12357711ad679fb4d06 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ chmod +x /etc/pm/sleep.d/10_mount_umount_disks-hibernate | |
$ cat /etc/pm/sleep.d/10_mount_umount_disks-hibernate | |
#!/bin/sh | |
# | |
# Action script ensure that shared disks are unmounted | |
# before a hibernate and re-mounted upon thaw. | |
# Allowing them to be used in a windows session. | |
# | |
# mount -t "ntfs" -o "uhelper=udisks2,nodev,nosuid,uid=1000,gid=1000,dmask=0077,fmask=0077" "/dev/sda9" "/Data" | |
PATH=/sbin:/usr/sbin:/bin:/usr/bin | |
_unmount_disks() | |
{ | |
rm /Data/ubuntu-*mount.ntfs | |
umount "/Data" || touch /Data/ubuntu-forced-unmount.ntfs && fusermount -uz "/Data" | |
return 0 | |
} | |
_remount_disks() | |
{ | |
mount /Data && rm /Data/ubuntu-*mount.ntfs || \ | |
ntfsfix /dev/sda9 && mount /Data && \ | |
rm /Data/ubuntu-*mount.ntfs && touch /Data/ubuntu-unclean-remount.ntfs | |
return 0 | |
} | |
case "${1}" in | |
hibernate) | |
_unmount_disks; | |
;; | |
thaw) | |
_remount_disks; | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment