File: pathmangle.sh

package info (click to toggle)
python-crypto 2.0.1%2Bdfsg1-2.3%2Blenny0
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 744 kB
  • ctags: 935
  • sloc: ansic: 6,597; python: 3,598; makefile: 28; 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