summaryrefslogtreecommitdiff
path: root/lang/modula-3/scripts/fix_pathnames
blob: f4f459bacb45a32e86fd12444ee366d40855ead0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#! /bin/sh
#
# $FreeBSD$

umask 022

if [ $# -ne 2 ]; then
    echo "Usage: $0 oldpath newpath" >&2
    exit 1
fi

oldpath=$1
newpath=$2
pkgdir=lib/m3/pkg

# Fix absolute pathnames in files so that they reference the actual
# installation directory, instead of the temporary directory we have
# been using.

cd ${newpath}/${pkgdir}
for i in `cd ${oldpath}/${pkgdir}; \
  find . -type f \( -name .M3IMPTAB -o -name FreeBSD2 \)`; do
    if [ -f ${i} ]; then
	test -f ${i}.bak || cp -p ${i} ${i}.bak
	rm -f ${i}
	sed -e "s|/[^ 	]*/work/installed/|${newpath}/|g" ${i}.bak >${i} && \
	  rm -f ${i}.bak
    fi
done