~ubuntu-branches/ubuntu/precise/autofs5/precise

« back to all changes in this revision

Viewing changes to .pc/autofs-5.0.5-fix-ampersand-escape-in-auto-smb.patch/samples/auto.smb

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2011-07-03 14:35:46 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110703143546-nej26krjij0rf792
Tags: 5.0.6-0ubuntu1
* New upstream release:
  - Dropped upstream patches 
  - Refreshed debian/patches/17ld.patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/bash
2
 
 
3
 
# This file must be executable to work! chmod 755!
4
 
 
5
 
key="$1"
6
 
opts="-fstype=cifs"
7
 
 
8
 
for P in /bin /sbin /usr/bin /usr/sbin
9
 
do
10
 
        if [ -x $P/smbclient ]
11
 
        then
12
 
                SMBCLIENT=$P/smbclient
13
 
                break
14
 
        fi
15
 
done
16
 
 
17
 
[ -x $SMBCLIENT ] || exit 1
18
 
 
19
 
$SMBCLIENT -gNL $key 2>/dev/null| awk -v key="$key" -v opts="$opts" -F'|' -- '
20
 
        BEGIN   { ORS=""; first=1 }
21
 
        /Disk/  {
22
 
                  if (first)
23
 
                        print opts; first=0
24
 
                  dir = $2
25
 
                  loc = $2
26
 
                  # Enclose mount dir and location in quotes
27
 
                  # Double quote "$" in location as it is special
28
 
                  gsub(/\$$/, "\\$", loc);
29
 
                  print " \\\n\t \"/" dir "\"", "\"://" key "/" loc "\""
30
 
                }
31
 
        END     { if (!first) print "\n"; else exit 1 }
32
 
        '
33