File Manager

Current Path : /var/lib/dpkg/info/
Upload File :
Current File : //var/lib/dpkg/info/rspamd.postinst

#!/bin/sh

set -eu

copy_js_font_files()
{
  # Rspamd web interface doesn't support symlinks and directory traversal
  # copy javascript files from original Debian packages
  RSPAMD_CSS_DIR=/usr/share/rspamd/www/css
  RSPAMD_JS_LIB_DIR=/usr/share/rspamd/www/js/lib
  cp --remove-destination /usr/share/javascript/bootstrap4/js/bootstrap.bundle.min.js $RSPAMD_JS_LIB_DIR/bootstrap.bundle.min.js
  cp --remove-destination /usr/share/javascript/bootstrap4/css/bootstrap.min.css $RSPAMD_CSS_DIR/bootstrap.min.css
  cp --remove-destination /usr/share/javascript/jquery/jquery.min.js $RSPAMD_JS_LIB_DIR/jquery.min.js
  cp --remove-destination /usr/share/javascript/requirejs/require.js $RSPAMD_JS_LIB_DIR/require.min.js

  # remove path of previous versions, if existent
  if [ -f $RSPAMD_JS_LIB_DIR/jquery-3.3.1.min.js ]; then
    rm $RSPAMD_JS_LIB_DIR/jquery-3.3.1.min.js
  fi
  if [ -f $RSPAMD_JS_LIB_DIR/bootstrap.min.js ]; then
    rm $RSPAMD_JS_LIB_DIR/bootstrap.min.js
  fi

  # copy font files from original Debian package
  RSPAMD_FONT_DIR=/usr/share/rspamd/www/fonts
  cp --remove-destination /usr/share/fonts-glyphicons/glyphicons-halflings-regular.ttf $RSPAMD_FONT_DIR/glyphicons-halflings-regular.ttf
  cp --remove-destination /usr/share/fonts-glyphicons/glyphicons-halflings-regular.woff $RSPAMD_FONT_DIR/glyphicons-halflings-regular.woff
  cp --remove-destination /usr/share/fonts-glyphicons/glyphicons-halflings-regular.woff2 $RSPAMD_FONT_DIR/glyphicons-halflings-regular.woff2
}

case "$1" in
    configure)
      SERVER_HOME=/var/lib/rspamd
      SERVER_LOG=/var/log/rspamd
      SERVER_USER=_rspamd

      adduser --quiet \
              --system \
              --group \
              --home $SERVER_HOME \
              --no-create-home \
              --disabled-login \
              --gecos "rspamd spam filtering system" \
              --force-badname \
              $SERVER_USER

      chown $SERVER_USER: $SERVER_HOME $SERVER_LOG

      copy_js_font_files
    ;;

    triggered)
      copy_js_font_files
    ;;

    abort-*)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

# Automatically added by dh_installdeb/13.5.2ubuntu1
dpkg-maintscript-helper rm_conffile /etc/rspamd/logging.conf 0.6.11\~ rspamd -- "$@"
dpkg-maintscript-helper rm_conffile /etc/rspamd/options.conf 0.6.11\~ rspamd -- "$@"
dpkg-maintscript-helper rm_conffile /etc/rspamd/workers.conf 0.6.11\~ rspamd -- "$@"
# End automatically added section
# Automatically added by dh_installinit/13.5.2ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	if [ -z "${DPKG_ROOT:-}" ] && [ -x "/etc/init.d/rspamd" ]; then
		update-rc.d rspamd defaults >/dev/null
		invoke-rc.d --skip-systemd-native rspamd restart || exit 1
	fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.5.2ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	# This will only remove masks created by d-s-h on package removal.
	deb-systemd-helper unmask 'rspamd.service' >/dev/null || true

	# was-enabled defaults to true, so new installations run enable.
	if deb-systemd-helper --quiet was-enabled 'rspamd.service'; then
		# Enables the unit on first installation, creates new
		# symlinks on upgrades if the unit file has changed.
		deb-systemd-helper enable 'rspamd.service' >/dev/null || true
	else
		# Update the statefile to add new symlinks (if any), which need to be
		# cleaned up on purge. Also remove old symlinks.
		deb-systemd-helper update-state 'rspamd.service' >/dev/null || true
	fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.5.2ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	if [ -z "${DPKG_ROOT:-}" ] && [ -d /run/systemd/system ]; then
		systemctl --system daemon-reload >/dev/null || true
		deb-systemd-invoke restart 'rspamd.service' >/dev/null || true
	fi
fi
# End automatically added section


File Manager Version 1.0, Coded By Lucas
Email: hehe@yahoo.com