#!/bin/sh
# Preserve new files
install_file() {
NEW="$1"
OLD="`dirname $NEW`/`basename $NEW .new`"
# If there's no file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}
# arg 1: the new package version
pre_install() {
/bin/true
}
# arg 1: the new package version
post_install() {
rm -f usr/bin/32/2to3
ln -sfr usr/bin/32/2to3-3.10 usr/bin/32/2to3
for file in idle pydoc pynche python ; do
rm -f usr/bin/32/${file}
ln -sfr usr/bin/32/${file}3 usr/bin/32/${file}
done
rm -f usr/bin/32/python-config
ln -sfr usr/bin/32/python3-config usr/bin/32/python-config
for file in msgfmt pygettext ; do
rm -f usr/bin/32/${file}.py
ln -sfr usr/bin/32/${file}-3.10.py usr/bin/32/${file}.py
done
}
# arg 1: the new package version
# arg 2: the old package version
pre_update() {
/bin/true
}
# arg 1: the new package version
# arg 2: the old package version
post_update() {
post_install
}
# arg 1: the old package version
pre_remove() {
/bin/true
}
# arg 1: the old package version
post_remove() {
rm -f usr/bin/32/2to3
if [ -x "usr/bin/32/2to3-2.7" ] ; then
ln -sfr usr/bin/32/2to3-2.7 usr/bin/32/2to3
fi
for file in idle pydoc pynche python ; do
rm -f usr/bin/32/${file}
if [ -L "usr/bin/32/${file}2" ] ; then
ln -sfr usr/bin/32/${file}2 usr/bin/32/${file}
fi
done
rm -f usr/bin/32/python-config
if [ -L "usr/bin/32/python2-config" ] ; then
ln -sfr usr/bin/32/python2-config usr/bin/32/python-config
fi
for file in msgfmt pygettext ; do
rm -f usr/bin/32/${file}.py
if [ -L "usr/bin/32/${file}-2.7.py" ] ; then
ln -sfr usr/bin/32/${file}-2.7.py usr/bin/32/${file}.py
fi
done
}
operation=$1
shift
$operation $*