[package] base-files: try to activate hotplugged partitions as swap and fall back...
authorjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Sat, 23 Jan 2010 21:58:01 +0000 (21:58 +0000)
committerjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Sat, 23 Jan 2010 21:58:01 +0000 (21:58 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@19300 3c298f89-4303-0410-b956-a3cf2f4a3e73

package/base-files/files/etc/hotplug.d/block/10-mount

index b0104ddfd60a11e6a7e525bf2ad14a0fc84bd1b1..38968933fa58df73aa84ccc7a279a7292f4036db 100644 (file)
@@ -1,6 +1,5 @@
 #!/bin/sh
-
-# Copyright (C) 2009 OpenWrt.org
+# Copyright (C) 2009-2010 OpenWrt.org
 
 blkdev=`dirname $DEVPATH`
 if [ `basename $blkdev` != "block" ]; then
@@ -8,8 +7,10 @@ if [ `basename $blkdev` != "block" ]; then
     device=`basename $DEVPATH`
     case "$ACTION" in
        add)
-               mkdir -p /mnt/$device
-               mount /dev/$device /mnt/$device
+               swapon /dev/$device >/dev/null 2>/dev/null || (
+                       mkdir -p /mnt/$device
+                       mount /dev/$device /mnt/$device
+               )
                ;;
        remove)
                umount /dev/$device