~ubuntu-branches/ubuntu/raring/usb-modeswitch/raring

« back to all changes in this revision

Viewing changes to debian/patches/02_allow_override_from_etc.patch

  • Committer: Bazaar Package Importer
  • Author(s): Didier Raboud
  • Date: 2011-06-20 10:12:34 UTC
  • mfrom: (1.2.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20110620101234-ge7hcda8f8obdecu
Tags: 1.1.8-1
* New 1.1.8 upstream version:
  - Rewrite Debian's "override from /etc" code
    (Closes: #630081, thanks to Alex Hermann).
  - Fix boot-time switching regression
    (Closes: #629371, thanks to Christian Kastner).

* Drop patches obsoleted by 1.1.8:
  - 01_extract_to_var_lib_not_tmp
  - 02_allow_override_from_etc
* Drop device_reference.txt from docs as upstream dropped it.
* Bump Standards-Version to 3.9.2 without changes needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Description: Allow tarball database entries overriding from /etc/usb_modeswitch.d
2
 
Author: Didier Raboud <odyx@debian.org>
3
 
Forwarded: pending
4
 
Last-Update: 2011-03-16
5
 
--- a/usb_modeswitch.tcl
6
 
+++ b/usb_modeswitch.tcl
7
 
@@ -54,6 +54,9 @@
8
 
                Log "Error: no config database found in /usr/share or /etc. Exiting"
9
 
                SafeExit
10
 
        }
11
 
+} else {
12
 
+       # Overriding from this place
13
 
+       set settings(dbdir_etc) /etc/usb_modeswitch.d
14
 
 }
15
 
 set bindir /usr/sbin
16
 
 
17
 
@@ -567,6 +570,8 @@
18
 
                                return {}
19
 
                        }
20
 
                        set configList [split $configList \n]
21
 
+                       Log "Searching overriding entries named: $settings(dbdir_etc)/$config*"
22
 
+                       append configList [glob -nocomplain $settings(dbdir_etc)/$config*]
23
 
                        set configList [lsearch -glob -all -inline $configList $config*]
24
 
                } else {
25
 
                        set configList [glob -nocomplain $settings(dbdir)/$config*]
26
 
@@ -576,11 +581,17 @@
27
 
        }
28
 
        config {
29
 
                if [file exists $settings(dbdir)/configPack.tar.gz] {
30
 
+                   # Overriding from /etc/
31
 
+                   if [file exists $settings(dbdir_etc)/$config] {
32
 
+                       Log "Using overriden config $config from collection $settings(dbdir_etc)"
33
 
+                       set settings(tmpConfig) $settings(dbdir_etc)/$config
34
 
+                   } else {
35
 
                        set settings(tmpConfig) /var/lib/usb_modeswitch/current_cfg
36
 
                        Log "Extracting config $config from collection $settings(dbdir)/configPack.tar.gz"
37
 
                        set wc [open $settings(tmpConfig) w]
38
 
                        puts -nonewline $wc [exec tar -xzOf $settings(dbdir)/configPack.tar.gz $config 2>/dev/null]
39
 
                        close $wc
40
 
+                   }
41
 
                } else {
42
 
                        set settings(tmpConfig) $config
43
 
                }