File: //var/lib/dpkg/info/cpanel-roundcubemail.postinst
#!/bin/sh
set -e -x
export ROUNDCUBE_ROOT=/usr/local/cpanel/base/3rdparty/roundcube
export ROUNDCUBE_DATA=/var/cpanel/roundcube
export CPANEL_ROUNDCUBE_INSTALL_VERSION="$2"
## <asset scriplets/post>
# Warning: shared script with debian/preinst and rpm %pre
runPosInst() {
# ensure we have the data directory #
mkdir -p ${ROUNDCUBE_DATA}
CRYPT_KEY=${ROUNDCUBE_ROOT}/plugins/calendar/calendar_crypt_key.inc
mkdir -p ${ROUNDCUBE_ROOT}/plugins/calendar
# ensure there's a "blowfish secret" filled in for storing user passwords for things like caldav calendars
test -f ${CRYPT_KEY} || /usr/local/cpanel/3rdparty/bin/perl -MCpanel::UUID -e 'print Cpanel::UUID::random_uuid();' >${CRYPT_KEY}
test -f ${CRYPT_KEY} && chmod 0644 ${CRYPT_KEY}
# roundcube requires a specially setup local user
# (from cpanel_initial_install sub setup_cpanel_system_users) #
# always check if the user is missing
/usr/bin/id cpanelroundcube >/dev/null 2>&1 \
|| /usr/local/cpanel/scripts/adduser -r --nochecks \
--noshell cpanelroundcube /var/cpanel/userhomes
# call cPanel to do post install tasks only
# if we're not in an initial install situation
# (we'll call the script later on in the install process)
if [ "x${CPANEL_BASE_INSTALL}" = "x" ]; then
# need CPANEL_ROUNDCUBE_INSTALL_VERSION env
/usr/local/cpanel/bin/update-roundcube-db
fi
}
## </asset>
case "$1" in
configure)
runPosInst;
;;
esac
exit 0