Package: usbmount Version: 0.0.22 Severity: normal File: /etc/usbmount/mount.d/00_create_model_symlink Tags: patch
Dear Rogério, If the computer is shut down while an USB device is mounted, the symlink in /var/run/usbmount/ becomes not removed and will prevent usbmount from creating a correct symlink the next time when this device is connected. So I added a routine to remove orphaned symlinks. I put it in /etc/usbmount/mount.d/00_create_model_symlink, just before the new symlink is created. In this way it is possible to attach a usb device that has been removed while the system was shut down already. The patch is attached below. Sincerely, Lars --- 8>< ---------------------------------------------------------------------- --- /etc/usbmount/mount.d/00_create_model_symlink 2011-08-08 17:01:54.000000000 +0200 +++ 00_create_model_symlink.remove 2015-03-15 12:13:36.421010775 +0100 @@ -1,6 +1,7 @@ #!/bin/sh # This script creates the model name symlink in /var/run/usbmount. # Copyright (C) 2005 Martin Dickopp +# Copyright (C) 2011 Lars Stollenwerk # # This file is free software; the copyright holder gives unlimited # permission to copy and/or distribute it, with or without @@ -34,6 +35,16 @@ name="${name}_$partition" fi +# Remove orphaned symlinks +if test -e "/var/run/usbmount/$name"; then + dest=`readlink "/var/run/usbmount/$name"` + if cut -s -d ' ' -f 2 /proc/mounts | fgrep "$dest" >/dev/null 2>&1; then + : + else + rm -f "/var/run/usbmount/$name" + fi +fi + # If the symlink does not yet exist, create it. test -e "/var/run/usbmount/$name" || ln -sf "$UM_MOUNTPOINT" "/var/run/usbmount/$name" --- 8>< ---------------------------------------------------------------------- -- System Information: Debian Release: 7.8 APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'stable') Architecture: i386 (i686) Kernel: Linux 3.2.0-4-686-pae (SMP w/2 CPU cores) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages usbmount depends on: ii lockfile-progs 0.1.17 ii udev 175-7.2 ii util-linux 2.20.1-5.3 Versions of packages usbmount recommends: ii pmount 0.9.23-2 usbmount suggests no packages. -- no debconf information -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org