This file is indexed.

postinst is in havp 0.92a-2ubuntu1.

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
#! /bin/sh
# postinst script for havp
#
# see: dh_installdeb(1)

init_error() {
echo "E: Error starting service (could be due to port 8080 already in use), ignoring..."
}

CONFIGFILE=/etc/default/havp

set -e

# 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
#

. /usr/share/debconf/confmodule

case "$1" in
    configure)
      # create havp group and user
      if ! getent group havp >/dev/null; then
        addgroup --system havp || true
      fi 
      if ! getent passwd havp >/dev/null; then
        adduser --quiet --system --no-create-home \
        --home /var/run/havp --ingroup havp havp || true
      fi
      # care for proper ownership in any case (e.g. updating from an earlier 
      # havp package with different paths)
      chown havp:havp /var/run/havp
      chown havp:havp /var/log/havp
      chown havp:havp /var/lib/havp
      chown havp:havp /var/spool/havp

    if [ ! -e $CONFIGFILE ]; then 
      echo "# Use a loopback mount for the scanner files?" > $CONFIGFILE
      echo "USE_LOOPBACK=" >> $CONFIGFILE
    fi 

    db_get havp/loopback_mount
    if [ "$RET" = "true" ]; then
      # restore if it's no longer there
      cp -a -f $CONFIGFILE $CONFIGFILE.tmp
      grep -Eq '^ *USE_LOOPBACK=' $CONFIGFILE || echo "USE_LOOPBACK=" >> $CONFIGFILE
      # set
      sed -e "s/^ *USE_LOOPBACK=.*/USE_LOOPBACK=\"$RET\"/" < $CONFIGFILE > $CONFIGFILE.tmp
      mv -f $CONFIGFILE.tmp $CONFIGFILE

      havp_dir=/var/lib/havp
      havp_loopback=$havp_dir/havp.loop
      havp_mountpoint=/var/spool/havp

      if [ -f $havp_loopback ]; then
        echo "There is already "$havp_loopback", maybe from an earlier or custom installation, not building loopback-device"
      else
        db_get havp/loopback_size
        havp_loopsize=`expr $RET \* 1024`
        echo -n "Using "$havp_loopsize" kilobytes for building loopback-device "$havp_loopback" with mandatory locks, this MAY take a little while so please be patient... "

        dd if=/dev/zero of=$havp_loopback bs=1024 count=$havp_loopsize >/dev/null 2>&1
        mkfs.ext3 -F $havp_loopback >/dev/null 2>&1
        echo "building loopback-device finished!"
      fi
    fi
    # finished with debconf, close properly...
    db_stop

    ;;

    abort-upgrade|abort-remove|abort-deconfigure)

    ;;

    *)
        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_installinit
if [ -x "/etc/init.d/havp" ]; then
	if [ ! -e "/etc/init/havp.conf" ]; then
		update-rc.d havp defaults >/dev/null
	fi
	invoke-rc.d havp start || init_error
fi
# End automatically added section


exit 0