usbmount/0000755000000000000000000000000011620003575007617 5ustar usbmount/README0000644000000000000000000002272511617775142010523 0ustar ======== USBmount ======== The USBmount package automatically mount USB mass storage devices (e.g., USB pen drives or HDs in USB enclosures) when they are plugged in. 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 plugged provides a model name, a symbolic link at /var/run/usbmount/MODELNAME pointing to the mountpoint is automatically created. When the device is not present anymore in the system (e.g., after it has been unplugged), usbmount deletes the symbolic links that were created. The script that does the (un)mounting is called by the udev daemon. Therefore, USBmount requires a 2.6 (or newer) kernel. USBmount is intended as a lightweight solution which is independent of a desktop environment. Users which would like an icon to appear when an USB device is plugged in should use other alternatives. The comments in the configuration file /etc/usbmount/usbmount.conf describe how to configure the package. Generic Comments about Flash Drives =================================== Users should be aware that, independently of the filesystem used by the mass storage device, *ANY* filesystem that resides in flash memory will become unreadable after some time. This unfortunate situation is intrinsic to the storage medium and better quality flash drives perform a "wear levelling" operation, distributing the load of operations across the whole device. [*] Filesystems using flash memory and mounted with the "sync" option can degrade earlier due to the fact that the sync mount option forces the operating system to write data more frequently to the device than if it were mounted without the sync option. So, why mount filesystems with the sync option then? The reason is to keep the written data on the drive reflecting what the user thinks is on the flash drive, and, more importantly, to avoid the problem of the user unplugging the device before it is finished receiving data that the kernel has on the memory of the computer and that is meant to be written to the device. If you don't like the sync option with your filesystems, then you can remove it from the configuration file of usbmount and use your devices with better performance and longer life time. *BUT* you should always make sure that you use the "sync" command (on a shell) to ensure that there is no writes pending for the device in question, so that you don't loose any data when you unplug the device from the computer. [*] You can see if your flash drives support wear levelling by seeing the technical specifications of your specific drives in the manufacturer's site (e.g., the manufacturer Kingston provides such information regarding its drives and others quite probably do that too). Of course, usbmount doesn't only work with flash drives. Common hard drives put into enclosures are perfectly used with usbmount and usbmount, despite its name, can mount drives connected via Firewire ports, provided that the kernel has support for it (most distribution kernels, including the ones shipped with Debian and Ubuntu do). Technical Considerations ======================== Control of Filesystems Mounted by USBmount ------------------------------------------ You can choose which filesystems you want usbmount to automatically handle by listing the filesystem types provided by the operating system in the configuration variable FILESYSTEMS. Recommendations for vfat Filesystems ------------------------------------ The vfat filesystem is one of the most commonly used filesystems in pen drives. Unfortunately, due to its age, it is very poor regarding features and, in particular, it doesn't feature the most basic access control present in Unix systems, namely: permissions on files. Linux works around this by creating "virtual" permissions and restrictions based on who mounted the filesystem. As usbmount is used, the user assigned to the vfat filesystem is, by default, root. For a more flexible configuration, some useful options for vfat filesystems are to specify explicitly who the user and permissions are. Please, read the manpage of the mount command to get details. An example is to specify "-fstype=vfat,gid=floppy,dmask=0007,fmask=0117" in the FS_MOUNTOPTIONS variable of the configuration file. The particular options specified in the example mean that members of the floppy group can read from and write to the medium, but nobody else can access it. Troubleshooting USBmount ------------------------ No software is free of problems and the situation isn't different with USBmount. To ease the troubleshooting of problems, you may try to check the following: * Do you have HAL running? Any GNOME or KDE daemon automounting devices? * Let's suppose that the partition containing the filesystem that you want USBmount to automatically handle is /dev/sda1 (your case may, quite possibly, vary). Then, check the result of the following command: udevadm test --action=add /sys/class/block/sda1 The command above just gives diagnostics of what USBmount would do with the device, but it doesn't actually mount or interfere with the device. It is intended for debugging purposes. Be careful that it generates *a lot* of output. Many screens, depending on the device. * Under the same assumptions as the above, another good diagnostic tool is the following: udevadm info -a -p $(udevadm info -q path -n /dev/sdb1) Hook Scripts ------------ After a device or partition has been mounted, the command 'run-parts /etc/usbmount/mount.d' is executed. This runs all scripts in /etc/usbmount/mount.d which adhere to a certain naming convention; see the run-parts manual page for details. The following environment variables are available to the scripts (in addition to those set in /etc/usbmount/usbmount.conf and by the hotplug and udev systems): UM_DEVICE - filename of the device node UM_MOUNTPOINT - mointpoint UM_FILESYSTEM - filesystem type UM_MOUNTOPTIONS - mount options that have been passed to the mount command UM_VENDOR - vendor of the device (empty if unknown) UM_MODEL - model name of the device (empty if unknown) Likewise, the command 'run-parts /etc/usbmount/umount.d' is executed after a device or partition has been unmounted. The scripts can make use of the environment variables UM_DEVICE, UM_MOUNTPOINT and UM_FILESYSTEM. Note that vendor and model name are no longer easily available when the device has been removed. If you need this information in an unmount hook script, write it to a file in a mount hook script and read it back in the unmount hook script. Safely unmounting filesystems ============================= As it is not possible for the system to detect when the device should be unmounted (such information is only present when the device has already been unplugged, which is too late for some clean ups, like flushing unwritten buffers to disk and marking the filesystem as clean), the user should manually unmount the device that were automatically mounted. This situation is similar to those in graphical desktop environments where the user has to click on an icon and inform the system that it wants to remove the device from the computer. A recommended solution for this problem is to use the pumount command (provided by the pmount package), which acts as a wrapper around the regular mount command and lets regular users (i.e., not root) to unmount the filesystems, conveniently. Warning: carelessly removing the device/filesystem without unounting it first can (and does) lead to massive filesystem corruption and should only be performed if you know exactly what you are doing. The Special Case of FUSE Filesystems ------------------------------------ Many users use removeable drives with NTFS filesystems and the user-space filesystem NTFS-3g, since it provides more flexiblity than the native module present in the Linux kernel. Such users have difficulty when unmounting the filesystems, since they are present in the system /etc/mtab with a filesystem type of fuseblk, not with ntfs (or ntfs-3g) as one might expect. For such filesystems, it may be convenient to: * add "ntfs-3g" to /etc/usbmount/usbmount.conf's variable FILESYSTEMS (for mounting purposes) * add "fuseblk" to /etc/usb/usbmount.conf's variable FILESYSTEMS (for unmounting purposes). Similar comments may apply to other FUSE-managed filesystems. In general, if you need a FUSE filesystem, it may be a good idea to add the name of that filesystem to the FILESYSTEMS variable as well as making sure that the special "fuseblk" filesystem is contained in that list. This subsection is an adaptation of descriptions made by Thomas Jancar and Jan Schulz. Remounting filesystems without physical removal =============================================== usbmount operates (read: "mounts or unmounts filesystems") based on events issued by the Linux kernel/udev. As a consequence, if you happen to unmount a filesystem and want to mount it again, you have basically two choices: 1 - unplug and plug the device, which may not be desired, for a number of reasons. 2 - make the kernel/udev generate another event so that usbmount knows that it has some work to do. The latter can be accomplished by the use of the command udevadm trigger --action=add /dev/sdd2 where /dev/sdd2 should be substituted with the proper partition. This command is likely needed to be run with superuser privileges. Triggering kernel events is also a way to get a particular filesystem mounted after a coldboot. usbmount/debian/0000755000000000000000000000000011620004751011036 5ustar usbmount/debian/rules0000755000000000000000000000003511617775142012133 0ustar #!/usr/bin/make -f %: dh $@ usbmount/debian/docs0000644000000000000000000000000711617775142011725 0ustar README usbmount/debian/source/0000755000000000000000000000000011617775142012355 5ustar usbmount/debian/source/format0000644000000000000000000000001511617775142013564 0ustar 3.0 (native) usbmount/debian/postrm0000644000000000000000000000125511617775142012327 0ustar #!/bin/sh set -e # If the package is removed, purged or installation is aborted, try to # remove the default mountpoints. # # Failure to do so is not considered fatal, because they may be in use by # the system administrator or some other daemon on the system. if [ "$1" = remove -o "$1" = abort-install -o "$1" = purge ]; 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 # During purge, also remove the /etc/udev/rules.d/z60_usbmount.rules symlink # if it exists. if [ "$1" = purge -a -h /etc/udev/rules.d/z60_usbmount.rules ]; then rm -f /etc/udev/rules.d/z60_usbmount.rules fi #DEBHELPER# exit 0 usbmount/debian/NEWS0000644000000000000000000000356011620003742011540 0ustar usbmount (0.0.17) unstable; urgency=low Starting with version 0.0.17, usbmount *WILL* recognize and automount devices with the vfat filesystem, as those are supported by the Linux kernel with the "sync" mount option since Linux 2.6.12. [0] Users should be aware that independently of the filesystem used by the mass storage device, *ANY* filesystem that resides in flash memory will become unreadable after some time. This unfortunate situation is intrinsic to the storage medium and better quality flash drives perform a "wear levelling" operation, distributing the load of operations across the whole device. Filesystems using flash memory and mounted with the sync option can degrade earlier due to the fact that the sync mount option forces the operating system to write data more frequently to the device than if it were mounted without the sync option. So, why mount filesystems with the sync option then? The reason is to keep the written data on the drive reflecting what the user thinks is on the flash drive, and, more importantly, to avoid the problem of the user unplugging the device before it is finished receiving data that the kernel has on the memory of the computer and that is meant to be written to the device. If you don't like the sync option with your filesystems, then you can remove it from the configuration file of usbmount and use your devices with better performance and longer life time. *BUT* you should always make sure that you use the "sync" command (on a shell) to ensure that there is no writes pending for the device in question, so that you don't lose any data when you unplug the device from the computer. [0] http://git.kernel.org/?p=linux/kernel/git/torvalds/old-2.6-bkcvs.git;a=commit;h=3e261a474262b622709d4851a1f26123e61ab13c -- Rogério Brito Thu, 30 Apr 2009 20:01:29 -0300 usbmount/debian/preinst0000644000000000000000000000052711617775142012470 0ustar #!/bin/sh set -e # If the package is installed, try to create the default mountpoints. # Failure to do so is not considered fatal. if [ "$1" = install ]; 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 #DEBHELPER# exit 0 usbmount/debian/install0000644000000000000000000000026211620003121012415 0ustar 00_create_model_symlink etc/usbmount/mount.d 00_remove_model_symlink etc/usbmount/umount.d usbmount usr/share/usbmount usbmount.conf etc/usbmount usbmount.rules lib/udev/rules.d usbmount/debian/control0000644000000000000000000000263311620003405012440 0ustar Source: usbmount Section: admin Priority: extra Standards-Version: 3.9.2 Build-Depends: debhelper (>= 8) Maintainer: Rogério Brito DM-Upload-Allowed: yes Vcs-Git: git://git.debian.org/usbmount/usbmount.git Vcs-Browser: http://git.debian.org/?p=usbmount/usbmount.git Homepage: http://usbmount.alioth.debian.org/ Package: usbmount Architecture: all Depends: lockfile-progs, udev, util-linux (>> 2.16), ${misc:Depends} Recommends: pmount 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. If the device provides a model name, a symbolic link /var/run/usbmount/MODELNAME pointing to the mountpoint is automatically created. . The script that does the mounting is called by the udev daemon. Therefore, USBmount requires a 2.6 (or newer) Linux kernel. . Firewire devices are also supported by USBmount. . USBmount is intended as a lightweight solution which is independent of a desktop environment. Users which would like an icon to appear when an USB device is plugged in should use the pmount and hal packages instead. usbmount/debian/compat0000644000000000000000000000000211617775142012253 0ustar 8 usbmount/debian/prerm0000644000000000000000000000025111617775142012123 0ustar #!/bin/sh set -e # Remove contents of /var/run/usbmount before the package is removed. if [ "$1" = remove ]; then rm -f /var/run/usbmount/* fi #DEBHELPER# exit 0 usbmount/debian/copyright0000644000000000000000000000135711620003121012765 0ustar Format: http://dep.debian.net/deps/dep5/ Upstream-Name: usbmount Upstream-Contact: Martin Dickopp , Rogério Brito Source: git://git.debian.org/usbmount/usbmount.git Files: * Copyright: 2004-2007, Martin Dickopp 2008-2011, Rogério Brito License: BSD-2 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. usbmount/debian/changelog0000644000000000000000000003643011620004751012716 0ustar usbmount (0.0.22) unstable; urgency=low * [f6f3d8d] Add very important README/documentation file. Closes: #593232. * [57cdf9b] Make the description of remounting a partition more detailed. * [a939ffd] Update copyright file to DEP5 (candidate) format. * [82e9c7c] debian/copyright: Validate the transition to DEP-5 format. * [0b1ec98] debian/{compat,control}: update debhelper compatibility to 8. * [354692c] debian/postrm: include removal of mountpoints in purge * [e8d3b35] debian/pre{inst,rm}: use internal test command of the shell. * [fbd26e6] debian/changelog: include list of changes generated by git-dch * [917da84] usbmount: say what was trying to be mounted in error messages * [a63b109] usbmount: Make regular expression more robust. Thanks to gregor herrmann, Niels Boehm, and Yegor Yefremov. Closes: #636991. * [879beb6] debian/control: Use wrap-and-sort to normalize the fields. * [12d0f12] debian/control: Update Standard-Version to 3.9.2 (no changes). * [e73cf7a] usbmount: Fix spelling errors. Tks Yuri D'Elia. Closes: #630317. * [8899b3f] debian/NEWS: Fix spelling errors. Tks John Foerch. Closes: #637113. -- Rogério Brito Mon, 08 Aug 2011 13:02:25 -0300 usbmount (0.0.21) unstable; urgency=low * [e499931] Add better documentation to the configuration file. * [0884ff6] Transition from cdbs to dh(7). * [ce9dc83] Make mounting by UUID more robust. Thanks to Jidanni. Closes: #587066. * [e57343e] Make some log messages slightly more descriptive * [b5549ec] Document better the situation with FUSE filesystems. Closes: #587311. * [06559af] Include description on how to remount filesystems. Closes: #568962. * [c6317b7] Verify that the package satisfies the Debian Policy v3.9.1. * [81e9c09] Point the source of the program to the git repository. * [06f365d] Put the rules file under /lib/udev/rules.d. * [1d0a16f] Remove some of the symlink dance * [7fa5d2a] Update comment to make it reflect what the code says. -- Rogério Brito Tue, 03 Aug 2010 12:14:56 -0400 usbmount (0.0.20) unstable; urgency=low * The "jidanni QA" release. * [28109ae9] Update changelog in preparation for new release. * [5e418982] Change character classes :space: -> :blank: and anchor grep's regexp. * [d60466c8] Include comments regarding unmounting the filesystems safely. * [48788d01] Eliminate confusing extra empty line in usbmount.conf (Closes: #568959) * [edd2eb4f] Describe dealing with FUSE mounted filesystems (Closes: #570405) * [aac8a8e2] Update the VCS-* from SVN to GIT * [cee7f5fc] Convert to format 3.0 (native) * [120fbcca] Reformat debian/NEWS to kill lintian warnings * [072cfd6c] Update the copyright years. * [e3824bb7] Don't use UUID's hiding under a comment. Closes: #576778. * [ebcf8f68] Log some error conditions. Closes: #576767. * [46323216] The package complies with Policy 3.8.4. No changes necessary. -- Rogério Brito Sat, 24 Apr 2010 23:26:05 -0300 usbmount (0.0.19.1) unstable; urgency=low * The "Oh, oh, oh" release. * Hotfix a bug discovered by Gregor Herrmann. Closes: #562496. * Change space character classes to blank, as suggested by Cristian Ionescu-Idbohrn. -- Rogério Brito Fri, 25 Dec 2009 00:39:37 -0200 usbmount (0.0.19) unstable; urgency=low * The "Ho, Ho, Ho" release. * new strategy in usbmount, potentially less complicated. * usbmount: + simplify the usbmount script. + strive for legibility. + avoid use of awk. + make fewer calls to blkid. + various code cleanups (Many, many thanks to Cristian Ionescu-Idbohrn). + log unexpected actions. + removes unecessary delay. + much more to come. * include dependency on util-linux (>> 2.16). * include recommends on pmount. -- Rogério Brito Thu, 24 Dec 2009 12:58:46 -0200 usbmount (0.0.18) unstable; urgency=low * usbmount: + migrate from vol_id to blkid; patch adapted from gregoa. (Closes: #548627) + support mounting by UUID; patch adapted from Patrick Schoenfeld. (Closes: #551757) + include extra debugging points. * usbmount.rules: + update rules for new naming scheme of recent kernels/udev combo. * debian/NEWS: + really include the file (Closes: #548785). * debian/control: + update standards version to 3.8.3 (no changes necessary). + reorder fields. + remove uploaders; Rafael is welcome any time he wants to. * debian/copyright: + fix my e-mail address. + consolidate entries. -- Rogério Brito Wed, 21 Oct 2009 02:14:18 -0200 usbmount (0.0.17.1) unstable; urgency=low * usbmount: + revert patch from #403209 (seems to introduce race conditions) (Closes: #535238) * usbmount.conf: + include ext4 so that it can be mounted automatically. + add MOUNTOPTIONS nodiratime. Closes: #539386. (Tks Jari Aalto) * debian/control: + include comment (allowed by policy). + update standards version to 3.8.2 (no changes necessary). -- Rogério Brito Tue, 18 Aug 2009 08:45:55 -0300 usbmount (0.0.17) unstable; urgency=low * The "More Documentation, Please" release. * debian/NEWS: create an intructive documentation file. * debian/README: + include more verbose instructive documentation. Closes: #502583. + remove outdated information on vfat filesystms. + mention that the package supports Firewire devices too. + restructure the document a little. + include brief instructions on troubleshooting usbmount behaviour. * debian/{preinst,postrm}: remove legacy code. * debian/control: + include misc-depends on usbmount binary. + update standards version to 3.8.1. + mention that firewire is supported too in the long description. * usbmount: + respect entries already in /etc/fstab. Closes: #350633. (Tks Joachim Breitner) + use fine grained locking for devices. Closes: #403209. (Tks Richard Atterer) * usbmount.conf: + comment heavily. Closes: #337483. (Tks January Weiner, Jari Eskelinen) + include vfat and hfsplus filesystems to be automounted. -- Rogério Brito Thu, 30 Apr 2009 19:52:59 -0300 usbmount (0.0.16) unstable; urgency=low * debian/control: include Vcs-* fields with modifications. * usbmount.conf: option to disable usbmount. (Closes: #380809) * usbmount.conf: recreate /var/run/usbmount if non-existent. (Closes: #345364) (Tks Armin Berres for the inspiration above) * usbmount.rules: add support for firewire devices too. (Closes: #502687) -- Rogério Brito Sun, 19 Oct 2008 07:35:56 -0200 usbmount (0.0.15.1) unstable; urgency=low * debian/control: actually include the DM-Upload-Allowed field. * debian/compat: upgraded it to 5, since even stable has it. * debian/control: updated build-dependency on debhelper >= 5. * debian/control: eliminated the versioned dependency on udev, since stable has it for a long time. -- Rogério Brito Tue, 30 Sep 2008 11:04:19 -0300 usbmount (0.0.15) unstable; urgency=low * New maintainer (Closes: #408621). * debian/control: updated with my e-mail address. * debian/control: add Homepage field. (removed lintian warning) * debian/control: included DM-Upload-Allowed field. I am a DM now. * debian/control: upgraded Standards-Version to 3.8.0. (lintian warning). * debian/copyright: made machine-parseable format. (removed lintian warning) * More changes to come... -- Rogério Brito Fri, 26 Sep 2008 15:58:33 -0300 usbmount (0.0.14.1) unstable; urgency=low [Rafael Laboissiere] * debian/control: - Bumped Standards-Version to 3.7.2 (no changes needed) - Moved debhelper and cdbs from Build-Depends-Indep to Build-Depends, complying with section 7.6 of the Debian Policy. [Martin Dickopp] * Acknowledge NMU (closes: #361351, #365225). * Orphaning package, setting maintainer to Debian QA Group. -- Martin Dickopp Sat, 27 Jan 2007 12:42:44 +0100 usbmount (0.0.14-0.1) unstable; urgency=low * Non-Maintainer Upload * Change path of vol_id of udev to the new location in /lib/udev. Thanks to Eric Evans for the patch (Closes: #361351) - Minimum udev dependency now 0.084-2, first version to ship vol_id in that location * Fix udev rule syntax, patch by Eric Evans (Closes: #365225) -- Jeroen van Wolffelaar Sun, 30 Apr 2006 23:45:57 +0000 usbmount (0.0.14) unstable; urgency=low * Upload sponsored by Rafael Laboissiere. * Make sure that /etc/dev.d/block/usbmount.dev is removed when the package is purged. -- Martin Dickopp Sun, 10 Jul 2005 22:17:00 +0200 usbmount (0.0.13) unstable; urgency=medium * Upload sponsored by Rafael Laboissiere. * Adapt to udev changes: 'udev_volume_id' has been renamed to 'vol_id' and its output has changed (closes: #317022). Depend on udev (>= 0.060-1). Without this change, usbmount doesn't work at all with udev 0.060, therefore urgency=medium. * New section about the vfat filesystem type added to the README file (closes: #316758). * /etc/dev.d is obsolete. Remove /etc/dev.d/block/usbmount.dev; the usbmount script is now called by the new file /etc/udev/usbmount.rules. Create symlink /etc/udev/rules.d/z60_usbmount.rules to this file if usbmount is freshly installed or updated from a version before 0.0.13. -- Martin Dickopp Fri, 8 Jul 2005 19:22:10 +0200 usbmount (0.0.12) unstable; urgency=low * Upload sponsored by Rafael Laboissiere. * debian/control: update 'Standards-Version' to 3.6.2. No changes to the package necessary. * Search additional files in the /sys filesystem for vendor and model name (closes: #315192). -- Martin Dickopp Fri, 1 Jul 2005 19:11:44 +0200 usbmount (0.0.11) unstable; urgency=low * Upload sponsored by Rafael Laboissiere. * If a device is not readable, wait up to 20 seconds for it to become so (closes: #305672). Some devices apparently need a few seconds initialization time before they can be accessed. Thanks to Peter Stelmachovic for his help with debugging this issue. -- Martin Dickopp Mon, 2 May 2005 14:19:15 +0200 usbmount (0.0.10) unstable; urgency=low * Upload sponsored by Rafael Laboissiere. * When a partition (as opposed to a partition-less device) is mounted, an underscore and the partition number are appended to the model name symlink. * The model name symlink now includes the vendor if known. * Acquire lock before 'udev_volume_id' is called. This causes the partitions (on a device with more than one partition) to be mounted in the right order. * Fixed typos in log messages. * Run hook scripts when a device or partition is mounted or unmounted (closes: #303562). Describe how to use this feature in the README file. * Moved /etc/usbmount.conf to /etc/usbmount/usbmount.conf. * Moved deletion of mount points in /media from prerm to postrm. Delete them not only when the package is removed, but also when installing is aborted. * Moved creation and deletion of model name symlinks to hook scripts. -- Martin Dickopp Tue, 12 Apr 2005 17:45:51 +0200 usbmount (0.0.9) unstable; urgency=low * Upload sponsored by Rafael Laboissiere. * When a device is removed, make sure that only the corresponding model symlink in /var/run/usbmount is removed (closes: #303376). * Include directory /var/run/usbmount in package instead of creating it in postinst (closes: #303434). * Move creation of mount points in /media from 'postinst configure' to 'preinst install'. This ensures that the mount points are created if the package is removed (but not purged) and then reinstalled. -- Martin Dickopp Wed, 6 Apr 2005 23:54:53 +0200 usbmount (0.0.8) unstable; urgency=low * Upload sponsored by Rafael Laboissiere (closes: #298526). * Filesystem type specific mount options can be specified. * Use locking to serialize concurrent mount attempts. This ensures that different mount points are chosen if a device contains more than one mountable partition. * Make sure that /var/run/usbmount is removed on package removal. * More detailed package description and README file. -- Martin Dickopp Sun, 3 Apr 2005 23:40:25 +0200 usbmount (0.0.7) unstable; urgency=low Rafael Laboissiere: * 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. Martin Dickopp: * Built as a Debian-native package again. * Default configuration does not mount vfat filesystems any more. * Put warning in configuration file that sync-mounting is not fully implemented for vfat filesystem. * Package description refers to new location of the homepage (http://usbmount.alioth.debian.org/). -- Martin Dickopp Wed, 9 Mar 2005 14:10:34 +0100 usbmount (0.0.6-1) unstable; urgency=low * New upstream release: - Changed maintainer's email address from to . - Create symlink in /var/run/usbmount instead of /var/usbmount. If the directory /var/run/usbmount does not exist, it is created when a device is plugged in. * Updated package description to mention that symlinks in /var/run/usbmount are created. * Removed instructions for 'reportbug' to send bug reports to the upstream maintainer instead of the Debian BTS. -- Martin Dickopp Tue, 8 Mar 2005 17:19:05 +0100 usbmount (0.0.5-1) unstable; urgency=low * debian/control: - Added myself to Uploaders field - Start Description with lower-case letter - Added Homepage link -- Rafael Laboissiere Tue, 8 Mar 2005 13:48:00 +0100 usbmount (0.0.5) unstable; urgency=low * Create symlinks (model names) in /var/usbmount. -- Martin Dickopp 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 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 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 Tue, 26 Oct 2004 23:04:04 +0200 usbmount (0.0.1) unstable; urgency=low * Initial package. -- Martin Dickopp Tue, 26 Oct 2004 17:32:54 +0200 usbmount/usbmount.conf0000644000000000000000000000535411617775142012365 0ustar # Configuration file for the usbmount package, which mounts removable # storage devices when they are plugged in and unmounts them when they # are removed. # Change to zero to disable usbmount ENABLED=1 # Mountpoints: These directories are eligible as mointpoints for # removable 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: removable storage devices are only mounted if they # contain a filesystem type which is in this list. FILESYSTEMS="vfat ext2 ext3 ext4 hfsplus" ############################################################################# # WARNING! # # # # The "sync" option may not be a good choice to use with flash drives, as # # it forces a greater amount of writing operating on the drive. This makes # # the writing speed considerably lower and also leads to a faster wear out # # of the disk. # # # # If you omit it, don't forget to use the command "sync" to synchronize the # # data on your disk before removing the drive or you may experience data # # loss. # # # # It is highly recommended that you use the pumount command (as a regular # # user) before unplugging the device. It makes calling the "sync" command # # and mounting with the sync option unnecessary---this is similar to other # # operating system's "safely disconnect the device" option. # ############################################################################# # Mount options: Options passed to the mount command with the -o flag. # See the warning above regarding removing "sync" from the options. MOUNTOPTIONS="sync,noexec,nodev,noatime,nodiratime" # Filesystem type specific mount options: This variable contains a space # separated list of strings, each which the form "-fstype=TYPE,OPTIONS". # # If a filesystem with a type listed here is mounted, the corresponding # options are appended to those specificed in the MOUNTOPTIONS variable. # # For example, "-fstype=vfat,gid=floppy,dmask=0007,fmask=0117" would add # the options "gid=floppy,dmask=0007,fmask=0117" when a vfat filesystem # is mounted. FS_MOUNTOPTIONS="" # If set to "yes", more information will be logged via the syslog # facility. VERBOSE=no usbmount/usbmount0000755000000000000000000001511711620003575011426 0ustar #!/bin/sh # This script mounts USB mass storage devices when they are plugged in # and unmounts them when they are removed. # Copyright © 2004, 2005 Martin Dickopp # Copyright © 2008, 2009, 2010 Rogério Theodoro de Brito # # 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 ###################################################################### # Auxiliary functions # Log a string via the syslog facility. log() { if [ $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 [ "$1" != "$v" ] || return 0 done return 1 } ###################################################################### # Main program # Default values for configuration variables. ENABLED=1 MOUNTPOINTS= FILESYSTEMS= MOUNTOPTIONS= FS_MOUNTOPTIONS= VERBOSE=no if [ -r /etc/usbmount/usbmount.conf ]; then . /etc/usbmount/usbmount.conf log debug "loaded usbmount configurations" fi if [ "${ENABLED:-1}" -eq 0 ]; then log info "usbmount is disabled, see /etc/usbmount/usbmount.conf" exit 0 fi if [ ! -x /sbin/blkid ]; then log err "cannot execute /sbin/blkid" exit 1 fi # Per Policy 9.3.2, directories under /var/run have to be created # after every reboot. if [ ! -e /var/run/usbmount ]; then mkdir -p /var/run/usbmount log debug "creating /var/run/usbmount directory" fi umask 022 if [ "$1" = add ]; then # Acquire lock. log debug "trying to acquire lock /var/run/usbmount/.mount.lock" lockfile-create --retry 3 /var/run/usbmount/.mount || \ { log err "cannot acquire lock /var/run/usbmount/.mount.lock"; exit 1; } trap '( lockfile-remove /var/run/usbmount/.mount )' 0 log debug "acquired lock /var/run/usbmount/.mount.lock" # Grab device information from device and "divide it" # FIXME: improvement: implement mounting by label (notice that labels # can contain spaces, which makes things a little bit less comfortable). DEVINFO=$(/sbin/blkid -p $DEVNAME) FSTYPE=$(echo "$DEVINFO" | sed 's/.*[[:blank:]]TYPE="\([^"]*\)".*/\1/g; s/[[:blank:]]*//g;') UUID=$(echo "$DEVINFO" | sed 's/.*[[:blank:]]UUID="\([^"]*\)".*/\1/g; s/[[:blank:]]*//g;') USAGE=$(echo "$DEVINFO" | sed 's/.*[[:blank:]]USAGE="\([^"]*\)".*/\1/g; s/[[:blank:]]*//g;') if ! echo $USAGE | egrep -q "(filesystem|disklabel)"; then log info "$DEVNAME does not contain a filesystem or disklabel" exit 1 fi # Try to use specifications in /etc/fstab first. if egrep -q "^[[:blank:]]*$DEVNAME" /etc/fstab; then log info "executing command: mount $DEVNAME" mount $DEVNAME || log err "mount by DEVNAME with $DEVNAME wasn't successful; return code $?" elif grep -q "^[[:blank:]]*UUID=$UUID" /etc/fstab; then log info "executing command: mount -U $UUID" mount -U $UUID || log err "mount by UUID with $UUID wasn't successful; return code $?" else log debug "$DEVNAME contains filesystem type $FSTYPE" fstype=$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 [ -d "$v" ] && ! grep -q "^[^ ][^ ]* *$v " /proc/mounts; then mountpoint="$v" log debug "mountpoint $mountpoint is available for $DEVNAME" break fi done if [ -n "$mountpoint" ]; then # Determine mount options. options= for v in $FS_MOUNTOPTIONS; do if expr "$v" : "-fstype=$fstype,."; then options="$(echo "$v" | sed 's/^[^,]*,//')" break fi done if [ -n "$MOUNTOPTIONS" ]; then options="$MOUNTOPTIONS${options:+,$options}" fi # Mount the filesystem. log info "executing command: mount -t$fstype ${options:+-o$options} $DEVNAME $mountpoint" mount "-t$fstype" "${options:+-o$options}" "$DEVNAME" "$mountpoint" # Determine vendor and model. vendor= if [ -r "/sys$DEVPATH/device/vendor" ]; then vendor="`cat \"/sys$DEVPATH/device/vendor\"`" elif [ -r "/sys$DEVPATH/../device/vendor" ]; then vendor="`cat \"/sys$DEVPATH/../device/vendor\"`" elif [ -r "/sys$DEVPATH/device/../manufacturer" ]; then vendor="`cat \"/sys$DEVPATH/device/../manufacturer\"`" elif [ -r "/sys$DEVPATH/../device/../manufacturer" ]; then vendor="`cat \"/sys$DEVPATH/../device/../manufacturer\"`" fi vendor="$(echo "$vendor" | sed 's/^[[:blank:]]\+//; s/[[:blank:]]\+$//')" model= if [ -r "/sys$DEVPATH/device/model" ]; then model="`cat \"/sys$DEVPATH/device/model\"`" elif [ -r "/sys$DEVPATH/../device/model" ]; then model="`cat \"/sys$DEVPATH/../device/model\"`" elif [ -r "/sys$DEVPATH/device/../product" ]; then model="`cat \"/sys$DEVPATH/device/../product\"`" elif [ -r "/sys$DEVPATH/../device/../product" ]; then model="`cat \"/sys$DEVPATH/../device/../product\"`" fi model="$(echo "$model" | sed 's/^[[:blank:]]\+//; s/[[:blank:]]\+$//')" # Run hook scripts; ignore errors. export UM_DEVICE="$DEVNAME" export UM_MOUNTPOINT="$mountpoint" export UM_FILESYSTEM="$fstype" export UM_MOUNTOPTIONS="$options" export UM_VENDOR="$vendor" export UM_MODEL="$model" log info "executing command: run-parts /etc/usbmount/mount.d" run-parts /etc/usbmount/mount.d || : else # No suitable mount point found. log warning "no mountpoint found for $DEVNAME" exit 1 fi fi fi elif [ "$1" = remove ]; then # A block or partition device has been removed. # Test if it is mounted. while read device mountpoint fstype remainder; do if [ "$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" # Run hook scripts; ignore errors. export UM_DEVICE="$DEVNAME" export UM_MOUNTPOINT="$mountpoint" export UM_FILESYSTEM="$fstype" log info "executing command: run-parts /etc/usbmount/umount.d" run-parts /etc/usbmount/umount.d || : fi break fi done < /proc/mounts else log err "unexpected: action '$1'" exit 1 fi log debug "usbmount execution finished" usbmount/00_remove_model_symlink0000755000000000000000000000130611617775142014303 0ustar #!/bin/sh # This script removes the model name symlink in /var/run/usbmount. # Copyright (C) 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 ls /var/run/usbmount | while read name; do if test "`readlink \"/var/run/usbmount/$name\" || :`" = "$UM_MOUNTPOINT"; then rm -f "/var/run/usbmount/$name" break fi done exit 0 usbmount/00_create_model_symlink0000755000000000000000000000264711617775142014262 0ustar #!/bin/sh # This script creates the model name symlink in /var/run/usbmount. # Copyright (C) 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 # Replace spaces with underscores, remove special characters in vendor # and model name. UM_VENDOR=`echo "$UM_VENDOR" | sed 's/ /_/g; s/[^0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._-]//g'` UM_MODEL=`echo "$UM_MODEL" | sed 's/ /_/g; s/[^0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._-]//g'` # Exit if both vendor and model name are empty. test -n "$UM_VENDOR" || test -n "$UM_MODEL" || exit 0 # Build symlink name. if test -n "$UM_VENDOR" && test -n "$UM_MODEL"; then name="${UM_VENDOR}_$UM_MODEL" else name="$UM_VENDOR$UM_MODEL" fi # Append partition number, if any, to the symlink name. partition=`echo "$UM_DEVICE" | sed 's/^.*[^0123456789]\([0123456789]*\)/\1/'` if test -n "$partition"; then name="${name}_$partition" fi # If the symlink does not yet exist, create it. test -e "/var/run/usbmount/$name" || ln -sf "$UM_MOUNTPOINT" "/var/run/usbmount/$name" exit 0 usbmount/usbmount.rules0000644000000000000000000000071311617775142012564 0ustar # Rules for USBmount -*- conf -*- KERNEL=="sd*", DRIVERS=="sbp2", ACTION=="add", RUN+="/usr/share/usbmount/usbmount add" KERNEL=="sd*", SUBSYSTEMS=="usb", ACTION=="add", RUN+="/usr/share/usbmount/usbmount add" KERNEL=="ub*", SUBSYSTEMS=="usb", ACTION=="add", RUN+="/usr/share/usbmount/usbmount add" KERNEL=="sd*", ACTION=="remove", RUN+="/usr/share/usbmount/usbmount remove" KERNEL=="ub*", ACTION=="remove", RUN+="/usr/share/usbmount/usbmount remove"