postinst is in canna 3.7p3-14.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | #!/bin/sh
set -e
case "$1" in
configure)
# Source debconf library.
. /usr/share/debconf/confmodule
db_version 2.0
adduser --quiet --system --group --no-create-home --home /var/lib/canna --gecos "Canna server" --disabled-password --disabled-login canna
chown -R canna:canna /var/lib/canna
mkdir -p /var/log/canna
chown -R canna:canna /var/log/canna
update-canna-dics_dir
# debconf processing for running cannaserver
db_get canna/run_cannaserver
if [ "$RET" = "true" ] ; then
CANNA_SERVER_RUN=yes
db_get canna/run_with_inet
if [ "$RET" = "true" ] ; then
CANNA_ENABLE_INET=yes
db_get canna/manage_allow_hosts_with_debconf
if [ "$RET" = "true" ] ; then
CANNA_MANAGE_CANNAHOST=yes
db_get canna/allow_hosts
CANNA_ALLOW_HOSTS="$RET"
else
CANNA_MANAGE_CANNAHOST=no
CANNA_ALLOW_HOSTS="unix"
fi
else
CANNA_ENABLE_INET=no
CANNA_MANAGE_CANNAHOST=yes
CANNA_ALLOW_HOSTS="unix"
fi
else
CANNA_SERVER_RUN=no
CANNA_ENABLE_INET=no
CANNA_MANAGE_CANNAHOST=yes
CANNA_ALLOW_HOSTS="unix"
fi
db_stop
if [ -e /etc/default/canna ] ; then
cp /etc/default/canna /etc/default/canna.dpkg-old
rm -f /etc/default/canna
fi
cat > /etc/default/canna <<EOF
# Enable cannaserver
CANNA_SERVER_RUN=${CANNA_SERVER_RUN}
# Enable inet socket connection
CANNA_ENABLE_INET=${CANNA_ENABLE_INET}
EOF
if [ "${CANNA_MANAGE_CANNAHOST}" = "yes" ] ; then
TMPFILE=`tempfile`
for HOST in ${CANNA_ALLOW_HOSTS}
do
echo $HOST >> ${TMPFILE}
done
if [ -e /etc/hosts.canna ] ; then
cmp -s ${TMPFILE} /etc/hosts.canna || \
(cp /etc/hosts.canna /etc/hosts.canna.dpkg-old && cp ${TMPFILE} /etc/hosts.canna)
else
cp ${TMPFILE} /etc/hosts.canna
fi
chmod 644 /etc/hosts.canna
rm -f ${TMPFILE}
else
[ ! -e /etc/hosts.canna ] && echo unix > /etc/hosts.canna
chmod 644 /etc/hosts.canna
fi
# Install files from template dir to /var
if [ -f /var/lib/canna/dic/canna/iroha.cbd ] && [ -f /var/lib/canna/dic/canna/iroha.cld ] && [ -f /var/lib/canna/dic/canna/bushu.cld ]; then
: # the files already exist, ignore
echo "iroha dics are already installed... ignoring" >&2
else
for FILE in iroha.cbd iroha.cld bushu.cld; do
cp -p /usr/lib/canna/debian-template/$FILE /var/lib/canna/dic/canna/
chown canna:canna /var/lib/canna/dic/canna/$FILE
done
echo "Installed new iroha dic" >&2
fi
if [ -f /var/lib/canna/dic/canna/fuzokugo.cbd ] && [ -f /var/lib/canna/dic/canna/fuzokugo.cld ]; then
: # the files already exist, ignore
echo "fuzokugo dics are already installed... ignoring" >&2
else
cp -p /usr/lib/canna/debian-template/fuzokugo.cbd /var/lib/canna/dic/canna/
chown canna:canna /var/lib/canna/dic/canna/fuzokugo.cbd
rm -f /var/lib/canna/dic/canna/fuzokugo.cld
echo "Installed new fuzokugo dics" >&2
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
;;
esac
# Automatically added by dh_installinit
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
if [ -x "/etc/init.d/canna" ]; then
update-rc.d canna defaults >/dev/null
invoke-rc.d canna start || exit $?
fi
fi
# End automatically added section
|