From af3c885cf9661932db2e8f1c406bd61c4eefb4b3 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sat, 23 Jan 2010 21:58:01 +0000 Subject: [PATCH] [package] base-files: try to activate hotplugged partitions as swap and fall back to lazy mount (#6517) SVN-Revision: 19300 --- package/base-files/files/etc/hotplug.d/block/10-mount | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/package/base-files/files/etc/hotplug.d/block/10-mount b/package/base-files/files/etc/hotplug.d/block/10-mount index b0104ddfd6..38968933fa 100644 --- a/package/base-files/files/etc/hotplug.d/block/10-mount +++ b/package/base-files/files/etc/hotplug.d/block/10-mount @@ -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 -- 2.30.2