#!/bin/sh # Copyright (C) 2005 Krzysztof Kozlowski # License: GNU General Public License version 2 # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # version 2 as published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # # Homepage: http://www.kozik.net.pl # # Ostatnia zmiana: 30.03.2006 # # Umount cloop device # # usage () { echo "Usage: $(basename $0) mount_point" exit 127 } if [ $# -ne 1 ]; then usage fi CLOOP_DEV=`mount | grep $1 | cut -f 1 -d ' '` if [ "$CLOOP_DEV" != "" ]; then echo "Detaching cloop device: $CLOOP_DEV" umount "$1" if [ $? -eq 0 ]; then losetup -d $CLOOP_DEV exit $? else echo "Could not umount \"$1\"! Left device $CLOOP_DEV still attached." exit 1 fi else echo "Could not find associated cloop device with mountpoint \"$1\"!" exit 2 fi