[Usbmount-commit] r2 - in trunk/usbmount: . debian debian/bug
Rafael Laboissiere
rafael@costa.debian.org
Wed, 16 Mar 2005 08:22:13 +0100
Author: rafael
Date: 2005-03-16 08:22:13 +0100 (Wed, 16 Mar 2005)
New Revision: 2
Added:
trunk/usbmount/README
trunk/usbmount/debian/
trunk/usbmount/debian/bug/
trunk/usbmount/debian/bug/control
trunk/usbmount/debian/bug/presubj
trunk/usbmount/debian/changelog
trunk/usbmount/debian/compat
trunk/usbmount/debian/control
trunk/usbmount/debian/copyright
trunk/usbmount/debian/dirs
trunk/usbmount/debian/install
trunk/usbmount/debian/postinst
trunk/usbmount/debian/prerm
trunk/usbmount/debian/rules
trunk/usbmount/usbmount
trunk/usbmount/usbmount.conf
trunk/usbmount/usbmount.dev
Log:
Release 0.0.5
Added: trunk/usbmount/README
===================================================================
--- trunk/usbmount/README 2005-03-16 07:21:17 UTC (rev 1)
+++ trunk/usbmount/README 2005-03-16 07:22:13 UTC (rev 2)
@@ -0,0 +1,15 @@
+usbmount
+--------
+
+The usbmount package automatically mounts USB mass storage devices
+(typically USB pens) when they are plugged in, and unmounts them when
+they are removed. The mountpoints (/media/usb[0-7] by default),
+filesystem types to consider, and mount options are configurable. When
+multiple devices are plugged in, the first available mountpoint is
+automatically selected.
+
+If the device provides a model name, a symlink /var/usbmount/MODELNAME
+pointing to the mountpoint is automatically created.
+
+The comments in the configuration file /etc/usbmount.conf describe how
+to configure the package.
Added: trunk/usbmount/debian/bug/control
===================================================================
--- trunk/usbmount/debian/bug/control 2005-03-16 07:21:17 UTC (rev 1)
+++ trunk/usbmount/debian/bug/control 2005-03-16 07:22:13 UTC (rev 2)
@@ -0,0 +1 @@
+Send-To: Martin Dickopp <martin-deb@zero-based.org>
Added: trunk/usbmount/debian/bug/presubj
===================================================================
--- trunk/usbmount/debian/bug/presubj 2005-03-16 07:21:17 UTC (rev 1)
+++ trunk/usbmount/debian/bug/presubj 2005-03-16 07:22:13 UTC (rev 2)
@@ -0,0 +1,7 @@
+Reporting bugs in the usbmount package
+======================================
+
+Bugs in the usbmount package should be reported to the maintainer,
+Martin Dickopp <martin-deb@zero-based.org>.
+
+If you continue, your bug report will be sent to this address.
Added: trunk/usbmount/debian/changelog
===================================================================
--- trunk/usbmount/debian/changelog 2005-03-16 07:21:17 UTC (rev 1)
+++ trunk/usbmount/debian/changelog 2005-03-16 07:22:13 UTC (rev 2)
@@ -0,0 +1,50 @@
+usbmount (0.0.5-1) unstable; urgency=low
+
+ * First upload of this package to the official Debian distribution
+ (closes: #298526)
+ * NMU in the behalf of the upstream maintainer, which is also the
+ effective maintainer of the Debian package.
+ * debian/control:
+ - Added myself to Uploaders field
+ - Start Description with lower-case letter
+ - Added Homepage link
+
+ -- Rafael Laboissiere <rafael@debian.org> Tue, 8 Mar 2005 13:48:00 +0100
+
+usbmount (0.0.5) unstable; urgency=low
+
+ * Create symlinks (model names) in /var/usbmount.
+
+ -- Martin Dickopp <martin-deb@zero-based.org> Wed, 23 Feb 2005 18:11:03 +0100
+
+usbmount (0.0.4) unstable; urgency=low
+
+ * Adapt to changes in udev_volume_id; depend on udev (>= 0.053-1).
+ * Redirect standard output and standard error to /dev/null; log via
+ syslog.
+ * More verbose logging can be turned on with a configuration variable.
+
+ -- Martin Dickopp <martin-deb@zero-based.org> Mon, 21 Feb 2005 11:32:55 +0100
+
+usbmount (0.0.3) unstable; urgency=low
+
+ * Create /media if it doesn't already exist.
+ * Include instructions for the reportbug program to send bug reports to
+ the maintainer instead of the Debian BTS.
+ * Move mounting and unmounting script to /usr/share/usbmount/usbmount.
+
+ -- Martin Dickopp <martin-deb@zero-based.org> Mon, 8 Nov 2004 19:03:12 +0100
+
+usbmount (0.0.2) unstable; urgency=low
+
+ * Don't kill any processes before unmounting; unmount lazily (-l option
+ to the umount command). Thanks to Martin F. Krafft for the suggestion.
+ * Build-Depends on debhelper >= 4.1.0 (required when cdbs is used).
+
+ -- Martin Dickopp <martin-deb@zero-based.org> Tue, 26 Oct 2004 23:04:04 +0200
+
+usbmount (0.0.1) unstable; urgency=low
+
+ * Initial package.
+
+ -- Martin Dickopp <martin-deb@zero-based.org> Tue, 26 Oct 2004 17:32:54 +0200
Added: trunk/usbmount/debian/compat
===================================================================
--- trunk/usbmount/debian/compat 2005-03-16 07:21:17 UTC (rev 1)
+++ trunk/usbmount/debian/compat 2005-03-16 07:22:13 UTC (rev 2)
@@ -0,0 +1 @@
+4
Added: trunk/usbmount/debian/control
===================================================================
--- trunk/usbmount/debian/control 2005-03-16 07:21:17 UTC (rev 1)
+++ trunk/usbmount/debian/control 2005-03-16 07:22:13 UTC (rev 2)
@@ -0,0 +1,22 @@
+Source: usbmount
+Section: admin
+Priority: extra
+Maintainer: Martin Dickopp <martin-deb@zero-based.org>
+Uploaders: Rafael Laboissiere <rafael@debian.org>
+Build-Depends-Indep: cdbs, debhelper (>= 4.1.0)
+Standards-Version: 3.6.1
+
+Package: usbmount
+Architecture: all
+Depends: udev (>= 0.053-1)
+Description: automatically mount and unmount USB mass storage devices
+ This package automatically mounts USB mass storage devices (typically
+ USB pens) when they are plugged in, and unmounts them when they are
+ removed. The mountpoints (/media/usb[0-7] by default), filesystem types
+ to consider, and mount options are configurable. When multiple devices
+ are plugged in, the first available mountpoint is automatically
+ selected.
+ .
+ The script that does the (un)mounting is called by the udev daemon.
+ .
+ Homepage: http://www.zero-based.org/debian/usbmount.html
\ No newline at end of file
Added: trunk/usbmount/debian/copyright
===================================================================
--- trunk/usbmount/debian/copyright 2005-03-16 07:21:17 UTC (rev 1)
+++ trunk/usbmount/debian/copyright 2005-03-16 07:22:13 UTC (rev 2)
@@ -0,0 +1,13 @@
+This package was written and debianized by Martin Dickopp
+<martin-deb@zero-based.org> on Tue, 26 Oct 2004 17:02:18 +0200.
+
+Copyright:
+
+ This package is free software; the copyright holder gives unlimited
+ permission to copy and/or distribute it, with or without
+ modifications, as long as this notice is preserved.
+
+ This package is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+ even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ PARTICULAR PURPOSE.
Added: trunk/usbmount/debian/dirs
===================================================================
--- trunk/usbmount/debian/dirs 2005-03-16 07:21:17 UTC (rev 1)
+++ trunk/usbmount/debian/dirs 2005-03-16 07:22:13 UTC (rev 2)
@@ -0,0 +1 @@
+var/usbmount
Added: trunk/usbmount/debian/install
===================================================================
--- trunk/usbmount/debian/install 2005-03-16 07:21:17 UTC (rev 1)
+++ trunk/usbmount/debian/install 2005-03-16 07:22:13 UTC (rev 2)
@@ -0,0 +1,4 @@
+usbmount usr/share/usbmount
+debian/bug/* usr/share/bug/usbmount
+usbmount.dev etc/dev.d/block
+usbmount.conf etc
Added: trunk/usbmount/debian/postinst
===================================================================
--- trunk/usbmount/debian/postinst 2005-03-16 07:21:17 UTC (rev 1)
+++ trunk/usbmount/debian/postinst 2005-03-16 07:22:13 UTC (rev 2)
@@ -0,0 +1,14 @@
+#!/bin/sh
+set -e
+
+# If the package is configured for the first time, try to create the
+# default mountpoints. Failure to do so is not considered fatal.
+if test "$1" = configure && test "$2" = ""; then
+ mkdir /media 2> /dev/null || :
+ for i in 0 1 2 3 4 5 6 7; do
+ mkdir /media/usb$i 2> /dev/null || :
+ done
+ ln -s usb0 /media/usb 2> /dev/null || :
+fi
+
+exit 0
Added: trunk/usbmount/debian/prerm
===================================================================
--- trunk/usbmount/debian/prerm 2005-03-16 07:21:17 UTC (rev 1)
+++ trunk/usbmount/debian/prerm 2005-03-16 07:22:13 UTC (rev 2)
@@ -0,0 +1,18 @@
+#!/bin/sh
+set -e
+
+# If the package is removed, try to remove the default mountpoints.
+# Failure to do so is not considered fatal.
+if test "$1" = remove; then
+ rm -f /media/usb 2> /dev/null || :
+ for i in 0 1 2 3 4 5 6 7; do
+ rmdir /media/usb$i 2> /dev/null || :
+ done
+fi
+
+# Remove any remaining symlinks in /var/usbmount.
+if test "$1" = remove; then
+ rm -f /var/usbmount/* 2> /dev/null || :
+fi
+
+exit 0
Added: trunk/usbmount/debian/rules
===================================================================
--- trunk/usbmount/debian/rules 2005-03-16 07:21:17 UTC (rev 1)
+++ trunk/usbmount/debian/rules 2005-03-16 07:22:13 UTC (rev 2)
@@ -0,0 +1,13 @@
+#!/usr/bin/make -f
+# Copyright (C) 2004 Martin Dickopp
+#
+# This file is free software; the copyright holder gives unlimited
+# permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+include /usr/share/cdbs/1/rules/debhelper.mk
Property changes on: trunk/usbmount/debian/rules
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/usbmount/usbmount
===================================================================
--- trunk/usbmount/usbmount 2005-03-16 07:21:17 UTC (rev 1)
+++ trunk/usbmount/usbmount 2005-03-16 07:22:13 UTC (rev 2)
@@ -0,0 +1,151 @@
+#!/bin/sh
+# This script mounts USB mass storage devices when they are plugged in
+# and unmounts them when they are removed.
+# Copyright (C) 2004, 2005 Martin Dickopp
+#
+# This file is free software; the copyright holder gives unlimited
+# permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+#
+set -e
+exec > /dev/null 2>&1
+
+
+# Log a string via the syslog facility.
+log()
+{
+ if test $1 != debug || expr "$VERBOSE" : "[yY]" > /dev/null; then
+ logger -p user.$1 -t "usbmount[$$]" -- "$2"
+ fi
+}
+
+# Test if the first parameter is in the list given by the second
+# parameter.
+in_list()
+{
+ for v in $2; do
+ test "$1" != "$v" || return 0
+ done
+ return 1
+}
+
+
+# Test if the configuration variables are set.
+test -n "$MOUNTPOINTS" || { log err "MOUNTPOINTS not set"; exit 1; }
+test -n "$FILESYSTEMS" || { log err "FILESYSTEMS not set"; exit 1; }
+test -n "$MOUNTOPTIONS" || { log err "MOUNTOPTIONS not set"; exit 1; }
+
+# Test if /sbin/udev_volume_id is executable.
+test -x /sbin/udev_volume_id \
+ || { log err "cannnot execute /sbin/udev_volume_id"; exit 1; }
+
+
+if test "$ACTION" = add; then
+
+ # A block or partition device has been added.
+ # Test if it is a USB device.
+ if readlink "/sys$DEVPATH/device" | grep -q /usb \
+ || readlink "/sys$DEVPATH/../device" | grep -q /usb; then
+ log debug "$DEVNAME is a USB device"
+
+ # Test if the device contains a filesystem. If it doesn't, no
+ # further action is required, but calling udev_volume_id has the
+ # side effect that the partition table is read and partition
+ # devices are created.
+ if /sbin/udev_volume_id "$DEVNAME" | egrep -q '^F:(filesystem|disklabel)$'; then
+ log debug "$DEVNAME containes a filesystem or disklabel"
+
+ fstype="`/sbin/udev_volume_id -t \"$DEVNAME\"`"
+ log debug "$DEVNAME containes filesystem type $fstype"
+
+ # Test if the filesystem type is in the list of filesystem
+ # types to mount.
+ if in_list "$fstype" "$FILESYSTEMS"; then
+ # Search an available mountpoint.
+ for v in $MOUNTPOINTS; do
+ if test -d "$v" \
+ && ! grep -q "^[^ ][^ ]* *$v " /proc/mounts; then
+ mountpoint="$v"
+ log debug "mountpoint $mountpoint is available for $DEVNAME"
+ break
+ fi
+ done
+ if test -n "$mountpoint"; then
+ # Mount the filesystem.
+ if test -n "$MOUNTOPTIONS"; then
+ options="-o $MOUNTOPTIONS"
+ else
+ options=
+ fi
+ log info "executing command: mount -t $fstype $options $DEVNAME $mountpoint"
+ mount -t "$fstype" $options "$DEVNAME" "$mountpoint"
+
+ # Create a symlink in /var/usbmount if the device
+ # has a model name.
+ model=
+ if test -r "/sys$DEVPATH/device/model"; then
+ model="`cat \"/sys$DEVPATH/device/model\"`"
+ elif test -r "/sys$DEVPATH/../device/model"; then
+ model="`cat \"/sys$DEVPATH/../device/model\"`"
+ fi
+ model="`echo \"$model\" | sed 's/^[ ]*//; s/[ ]*$//; s/[ ]/_/g; s/[^0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._-]//g'`"
+ if test "$model" != "" && ! test -r "/var/usbmount/$model"; then
+ log info "creating symlink /var/usbmount/$model -> $mountpoint"
+ ln -sf "$mountpoint" "/var/usbmount/$model"
+ fi
+ else
+ # No suitable mount point found.
+ log warning "no mountpoint found for $DEVNAME"
+ exit 1
+ fi
+ fi
+ fi
+ fi
+
+elif test "$ACTION" = remove; then
+
+ # A block or partition device has been removed.
+ # Test if it is mounted.
+ have_unmounted=no
+ while read device mountpoint fstype remainder; do
+ if test "$DEVNAME" = "$device"; then
+ # If the mountpoint and filesystem type are maintained by
+ # this script, unmount the filesystem.
+ if in_list "$mountpoint" "$MOUNTPOINTS" \
+ && in_list "$fstype" "$FILESYSTEMS"; then
+ log info "executing command: umount -l $mountpoint"
+ umount -l "$mountpoint"
+ have_unmounted=yes
+ fi
+ break
+ fi
+ done < /proc/mounts
+
+ # If a device has been unmounted, clean /var/usbmount.
+ if test $have_unmounted = yes; then
+ ls /var/usbmount | while read model; do
+ mounted=no
+ while read device mountpoint remainder; do
+ if test "`readlink $model`" = "$mountpoint"; then
+ mounted=yes
+ break
+ fi
+ done < /proc/mounts
+
+ # If a symlink pointes to a directory which is not mounted,
+ # remove it.
+ if test $mounted = no; then
+ log info "removing /var/usbmount/$model"
+ rm -f "/var/usbmount/$model"
+ fi
+ done
+ fi
+
+fi
+
+exit 0
Property changes on: trunk/usbmount/usbmount
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/usbmount/usbmount.conf
===================================================================
--- trunk/usbmount/usbmount.conf 2005-03-16 07:21:17 UTC (rev 1)
+++ trunk/usbmount/usbmount.conf 2005-03-16 07:22:13 UTC (rev 2)
@@ -0,0 +1,23 @@
+# Configuration file for the usbmount package, which mounts USB mass
+# storage devices when they are plugged in and unmounts them when they
+# are removed.
+
+# Mountpoints: These directories are eligible as mointpoints for USB
+# mass storage devices. A newly plugged in device is mounted on the
+# first directory in this list that exists and on which nothing is
+# mounted yet.
+MOUNTPOINTS="/media/usb0 /media/usb1 /media/usb2 /media/usb3
+ /media/usb4 /media/usb5 /media/usb6 /media/usb7"
+
+# Filesystem types: USB mass storage devices are only mounted if they
+# contain a filesystem type which is in this list.
+FILESYSTEMS="msdos vfat"
+
+# Mount options: Options passed to the mount command with the -o flag.
+# WARNING! Removing "sync" from the options is a very bad idea and
+# might result in severe data loss.
+MOUNTOPTIONS="sync,noexec,nodev,noatime,gid=floppy,dmask=0007,fmask=0117"
+
+# If set to "yes", more information will be logged via the syslog
+# facility.
+VERBOSE="no"
Added: trunk/usbmount/usbmount.dev
===================================================================
--- trunk/usbmount/usbmount.dev 2005-03-16 07:21:17 UTC (rev 1)
+++ trunk/usbmount/usbmount.dev 2005-03-16 07:22:13 UTC (rev 2)
@@ -0,0 +1,37 @@
+#!/bin/sh
+# This script mounts USB mass storage devices when they are plugged in
+# and unmounts them when they are removed.
+# Copyright (C) 2004 Martin Dickopp
+#
+# This file is free software; the copyright holder gives unlimited
+# permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+#
+set -e
+
+# Exit if the (un)mounting script is not executable.
+test -x /usr/share/usbmount/usbmount || exit 0
+
+# Default values for configuration variables.
+MOUNTPOINTS="/media/usb0 /media/usb1 /media/usb2 /media/usb3
+ /media/usb4 /media/usb5 /media/usb6 /media/usb7"
+FILESYSTEMS="msdos vfat"
+MOUNTOPTIONS="sync,noexec,nodev,noatime,gid=floppy,dmask=0007,fmask=0117"
+VERBOSE="no"
+
+# Read configuration file.
+if test -r /etc/usbmount.conf; then
+ . /etc/usbmount.conf
+fi
+
+# Execute (un)mounting script.
+export MOUNTPOINTS
+export FILESYSTEMS
+export MOUNTOPTIONS
+export VERBOSE
+exec /usr/share/usbmount/usbmount "$@"
Property changes on: trunk/usbmount/usbmount.dev
___________________________________________________________________
Name: svn:executable
+ *