blob: bdb7128ee46826e82a3287df58ae19215ccfc83c (
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#!/bin/sh
# Names of the script(s) to be updated in the same directory this is run from:
scripts="ac_update_extern_pkg"
# Work in the directory where this script and those to be updated live:
cd `dirname "$0"` || exit 1 # (should never fail if this script can be executed)
# Put temporary copies in a tmp/ directory in the conda environment or /tmp/:
tmp="$PREFIX/tmp"
if [ -d "$tmp" ]; then
remove_tmp=0
else
if ! mkdir "$tmp"; then
echo "failed to create $tmp" >&2
exit 1
fi
remove_tmp=1
fi
# Update each named script in turn:
for script in $scripts; do
if [ ! -r "$script" ]; then
echo "no such script: $script" >&2
exit 1
fi
tmpscript="$tmp/$script"
if ! sed -e 's|#\!.*/python|#\!/usr/bin/python|' "$script" > "$tmpscript"
then
echo "cannot write $tmpscript" >&2
exit 1
fi
chmod 755 "$tmpscript"
if ! mv -f "$tmpscript" "$script"; then
echo "failed to replace $script" >&2
exit 1
fi
done
# Clean up:
[ $remove_tmp == 1 ] && rmdir "$tmp"
|