- # TODO: we probably want to NOT do real suspend if:
- # - cards don't unmount (running PNDs will break)
- # - while charging too, since it stops on suspend?
+ if ! grep -q 'mmc_core.removable=0' /proc/cmdline; then
+ # must unmount cards because they will be "ejected" on suspend
+ # (some filesystems may even deadlock if we don't do this due to bugs)
+ mounts="$(grep "/dev/mmcblk" /proc/mounts | awk '{print $1}' | xargs echo)"
+ for mnt in $mounts; do
+ if ! umount $mnt; then
+ show_message "Could not unmount $mnt, using partial suspend only"
+ return 1
+ fi
+ done
+ swaps="$(grep "/dev/mmcblk" /proc/swaps | awk '{print $1}' | xargs echo)"
+ for swp in $swaps; do
+ if ! swapoff $swp; then
+ show_message "Could not unmount $swp, using partial suspend only"
+ return 1
+ fi
+ done
+ else
+ if [ ! -e /etc/pandora/suspend-warned ]; then
+ show_message "Pandora will now suspend.\n\n\
+Please do not remove SD cards while pandora is suspended, doing so will corrupt them."
+ touch /etc/pandora/suspend-warned
+ fi
+ fi