File: pathmangle.sh

package info (click to toggle)
python-crypto 2.1.0-2%2Bsqueeze2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 1,584 kB
  • ctags: 2,188
  • sloc: ansic: 10,073; python: 6,026; makefile: 32; sh: 10
file content (17 lines) | stat: -rw-r--r-- 407 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#! /bin/sh
#
# This script is used to mangle things like /usr/local/bin/python into
# something more in line with Debian's Python policy.

set -e

CMD=$1
DIR=$2

grep -E -l -r '/usr/local(/bin)?/python' "$DIR" |
    while read f; do
        printf ",s:/usr/local\\\\(/bin\\\\)\\\\?/python:$CMD:g\nw\n" | ed -s "$f"
        if [ "$(head -c2 $f)" = "#!" ]; then
            chmod 755 "$f"
        fi
    done