File: pathmangle.sh

package info (click to toggle)
python-kjbuckets 2.2port20011104-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 508 kB
  • ctags: 451
  • sloc: ansic: 5,169; python: 367; makefile: 52; sh: 12
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