wanpipe/deb_control/postinst

116 lines
3.1 KiB
Plaintext
Raw Normal View History

2021-12-29 16:56:27 +00:00
#! /bin/sh
set -e
2021-12-29 17:44:13 +00:00
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
#
# quoting from the policy:
# Any necessary prompting should almost always be confined to the
# post-installation script, and should be protected with a conditional
# so that unnecessary prompting doesn't happen if a package's
# installation fails and the `postinst' is called with `abort-upgrade',
# `abort-remove' or `abort-deconfigure'.
2021-12-29 16:56:27 +00:00
install_init()
{
PROD=wanrouter
2021-12-29 17:44:13 +00:00
START_SCRIPT=20
STOP_SCRIPT=10
2021-12-29 16:56:27 +00:00
PROD_INIT=/usr/sbin/wanrouter
2021-12-29 17:44:13 +00:00
# Examine system bootstrap files.
if [ -d /etc/rc0.d ]; then
RC_DIR=/etc
elif [ -d /etc/rc.d/rc0.d ]; then
RC_DIR=/etc/rc.d
else
2021-12-29 16:56:27 +00:00
return 0
2021-12-29 17:44:13 +00:00
fi
# Create Symbolic Link to Wanrouter binary
if [ ! -f "/etc/init.d/wanrouter" ]; then
ln -sf $PROD_INIT $RC_DIR/init.d/wanrouter
echo "Created SymLink of $PROD_INIT to $RC_DIR/init.d/wanrouter"
echo
fi
# Install start/stop scripts.
update-rc.d wanrouter defaults $START_SCRIPT $STOP_SCRIPT
return 0
2021-12-29 16:56:27 +00:00
}
2021-12-29 17:44:13 +00:00
case "$1" in
configure)
if [ -d "/usr/local/wanrouter" ]; then
cat <<EOM
2021-12-29 16:56:27 +00:00
*** Previous installation of Wanpipe detected.
Please use /usr/sbin/wancfg instead of /usr/local/wanrouter/wancfg
for Wanpipe configuration.
The new configuration files will be saved in /etc/wanpipe
and /etc/wanpipe/interfaces directories.
EOM
2021-12-29 17:44:13 +00:00
else
echo 'no old wanpipe detected' > /dev/null
fi
2021-12-29 16:56:27 +00:00
2021-12-29 17:44:13 +00:00
cat <<EOM
2021-12-29 16:56:27 +00:00
*** Sangoma Wanpipe was successfully installed.
Run wancfg command to configure wanpipe.
Refer to /usr/share/doc/wanpipe for documentation.
Docs: README-2.config
README-3.operation
README-4.debugging
Hardware Probe: /usr/sbin/wanrouter hwprobe
Wanpipe Config: /usr/sbin/wancfg
Wanpipe Start : /usr/sbin/wanrouter start
EOM
2021-12-29 17:44:13 +00:00
install_init;
# check dependancies for the new modules
echo "Executing depmod to check dependancies and new kernel modules"
eval "depmod -a > /dev/null 2>&1"
echo
eval "modprobe wanrouter"
if [ $? -eq 0 ]; then
eval "modprobe -r wanrouter"
if [ $? -eq 0 ]; then
echo "Module loaded/unloaded to test"
fi
else
echo "Failed to load wanpipe modules!"
echo
echo "Make sure you are installing correct DEBS for your system!"
echo
echo "Otherwise call Sangoma Tech Support"
fi
;;
2021-12-29 16:56:27 +00:00
2021-12-29 17:44:13 +00:00
abort-upgrade|abort-remove|abort-deconfigure)
;;
2021-12-29 16:56:27 +00:00
2021-12-29 17:44:13 +00:00
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
2021-12-29 16:56:27 +00:00
2021-12-29 17:44:13 +00:00
exit 0