#!/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() {
#
# NOTE:
# 'install-info' can work using relative paths and we can make use build machine
# utility during installation to the some partition and use target 'install-info'
# during installation directly on the running target machine.
#
if [ -x /usr/bin/install-info ] ; then
install-info --info-dir=usr/share/info usr/share/info/gettext.info.gz 2>/dev/null
elif ! grep "(gettext)" usr/share/info/dir 1> /dev/null 2> /dev/null ; then
cat << EOF >> usr/share/info/dir
GNU Gettext Utilities
* autopoint: (gettext)autopoint Invocation.
Copy gettext infrastructure.
* envsubst: (gettext)envsubst Invocation.
Expand environment variables.
* gettextize: (gettext)gettextize Invocation.
Prepare a package for gettext.
* gettext: (gettext). GNU gettext utilities.
* ISO3166: (gettext)Country Codes.
ISO 3166 country codes.
* ISO639: (gettext)Language Codes.
ISO 639 language codes.
* msgattrib: (gettext)msgattrib Invocation.
Select part of a PO file.
* msgcat: (gettext)msgcat Invocation.
Combine several PO files.
* msgcmp: (gettext)msgcmp Invocation.
Compare a PO file and template.
* msgcomm: (gettext)msgcomm Invocation.
Match two PO files.
* msgconv: (gettext)msgconv Invocation.
Convert PO file to encoding.
* msgen: (gettext)msgen Invocation.
Create an English PO file.
* msgexec: (gettext)msgexec Invocation.
Process a PO file.
* msgfilter: (gettext)msgfilter Invocation.
Pipe a PO file through a filter.
* msgfmt: (gettext)msgfmt Invocation.
Make MO files out of PO files.
* msggrep: (gettext)msggrep Invocation.
Select part of a PO file.
* msginit: (gettext)msginit Invocation.
Create a fresh PO file.
* msgmerge: (gettext)msgmerge Invocation.
Update a PO file from template.
* msgunfmt: (gettext)msgunfmt Invocation.
Uncompile MO file into PO file.
* msguniq: (gettext)msguniq Invocation.
Unify duplicates for PO file.
* ngettext: (gettext)ngettext Invocation.
Translate a message with plural.
* xgettext: (gettext)xgettext Invocation.
Extract strings into a PO file.
EOF
fi
}
# 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() {
if [ -x /usr/bin/install-info ] ; then
install-info --delete --info-file=usr/share/info/gettext.info.gz --dir-file=usr/share/info/dir 2> /dev/null || /bin/true
fi
}
# arg 1: the old package version
post_remove() {
/bin/true
}
operation=$1
shift
$operation $*