File: pathmangle.sh

package info (click to toggle)
egenix-mx-base 2.0.6-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,028 kB
  • ctags: 4,762
  • sloc: ansic: 14,965; python: 11,739; sh: 313; makefile: 117
file content (17 lines) | stat: -rw-r--r-- 388 bytes parent folder | download | duplicates (4)
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
        perl -pi -e 's|/usr/local(/bin)?/python|'$CMD'|g' "$f"
        if [ "$(head -c2 $f)" = "#!" ]; then
            chmod 755 "$f"
        fi
    done