File: //var/lib/dpkg/info/openlitespeed.preinst
#!/bin/bash
# preinst script for openlitespeed
#
# see: dh_installdeb(1)
#set -ex
#make sure the user lsadm and group lsadm exists in the system
getent group lsadm > /dev/null || groupadd -r lsadm
lsadm_gid=`grep ^lsadm: /etc/group | awk -F : '{ print $3; }'` >/dev/null 2>&1
getent passwd lsadm > /dev/null || useradd -g $lsadm_gid -d / -r -s /sbin/nologin -c "lsadm" lsadm >/dev/null 2>&1
grep -q nobody: "/etc/group"
if [ $? != 0 ] ; then
usermod -G lsadm,nogroup lsadm >/dev/null 2>&1
else
usermod -G lsadm,nobody lsadm >/dev/null 2>&1
fi
if [[ "$1" == 'upgrade' ]]; then
FILES_TO_IGNORE=( \
'/usr/local/lsws/conf/httpd_config.conf' \
'/usr/local/lsws/conf/mime.properties' \
'/usr/local/lsws/conf/vhosts/Example/htgroup' \
'/usr/local/lsws/conf/vhosts/Example/htpasswd' \
'/usr/local/lsws/conf/vhosts/Example/vhconf.conf' \
'/usr/local/lsws/conf/templates/ccl.conf' \
'/usr/local/lsws/conf/templates/phpsuexec.conf' \
'/usr/local/lsws/conf/templates/rails.conf' \
'/usr/local/lsws/fcgi-bin/lsphp' \
'/usr/local/lsws/admin/conf/admin_config.conf' \
'/usr/local/lsws/admin/conf/htpasswd' \
'/usr/local/lsws/admin/conf/jcryption_keypair' \
'/usr/local/lsws/admin/conf/webadmin.crt' \
'/usr/local/lsws/admin/conf/webadmin.key' \
'/usr/local/lsws/Example/cgi-bin/helloworld' \
'/usr/local/lsws/Example/html/error404.html' \
'/usr/local/lsws/Example/html/.htaccess' \
'/usr/local/lsws/Example/html/index.html' \
'/usr/local/lsws/Example/html/phpinfo.php' \
'/usr/local/lsws/Example/html/upload.html' \
'/usr/local/lsws/Example/html/upload.php' \
'/usr/local/lsws/Example/html/blocked/index.html' \
'/usr/local/lsws/Example/html/css/bootstrap.min.css' \
'/usr/local/lsws/Example/html/css/custom.css' \
'/usr/local/lsws/Example/html/img/404-icon.png' \
'/usr/local/lsws/Example/html/img/blocked_content-icon.png' \
'/usr/local/lsws/Example/html/img/cgi-icon.png' \
'/usr/local/lsws/Example/html/img/file_upload-icon.png' \
'/usr/local/lsws/Example/html/img/olsws_logo.png' \
'/usr/local/lsws/Example/html/img/php-icon.png' \
'/usr/local/lsws/Example/html/img/powered_by_ols-new.png' \
'/usr/local/lsws/Example/html/img/pwd_protect-icon.png' \
'/usr/local/lsws/Example/html/protected/index.html' \
'/usr/local/lsws/Example/logs/access.log' \
'/usr/local/lsws/PLAT' \
)
for FILE_TO_IGNORE in "${FILES_TO_IGNORE[@]}"; do
if [[ -f "${FILE_TO_IGNORE}" ]]; then
/usr/bin/dpkg-divert --list | grep -q "${FILE_TO_IGNORE}"
if [[ "$?" -ne 0 ]]; then
/usr/bin/dpkg-divert --local --add --divert "${FILE_TO_IGNORE}.dpkg" "${FILE_TO_IGNORE}" >/dev/null 2>&1
fi
fi
done
fi
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
exit 0