From ffc7042af410ff0afa0f82f70077233f1b35f614 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 18 Sep 2009 10:01:15 -0600 Subject: [PATCH] Implement #3528 (Please install udev rules into /lib/udev/rules.d/) --- src/calibre/linux.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/calibre/linux.py b/src/calibre/linux.py index 73fbbc6e00..fd2903c94b 100644 --- a/src/calibre/linux.py +++ b/src/calibre/linux.py @@ -256,7 +256,13 @@ def setup_udev_rules(group_file, reload, fatal_errors): sys.stdout.flush() groups = open(group_file, 'rb').read() group = 'plugdev' if 'plugdev' in groups else 'usb' - udev = open_file('/etc/udev/rules.d/95-calibre.rules') + old_udev = '/etc/udev/rules.d/95-calibre.rules' + if os.path.exists(old_udev): + os.remove(old_udev) + if os.path.exists('/lib/udev/rules.d'): + udev = open_file('/lib/udev/rules.d/95-calibre.rules') + else: + udev = open_file(old_udev) manifest.append(udev.name) udev.write('''# Sony Reader PRS-500\n''' '''BUS=="usb", SYSFS{idProduct}=="029b", SYSFS{idVendor}=="054c", MODE="660", GROUP="%s"\n'''%(group,)