This file is indexed.

postinst is in hyperestraier 1.4.13-12ubuntu1.

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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#! /bin/sh
# postinst script for hyperestraier
#
# see: dh_installdeb(1)

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
#

update_conf()
{
    if ! grep -q '^bindaddr:' $ROOTDIR/_conf; then
	cat <<EOF >> $ROOTDIR/_conf
# binding address of TCP (0.0.0.0 means every address)
bindaddr: 0.0.0.0
EOF
    fi
    if ! grep -q '^idleflush:' $ROOTDIR/_conf; then
	cat <<EOF >> $ROOTDIR/_conf
# idle time to start flushing (in seconds)
idleflush: 30
EOF
    fi
    if ! grep -q '^idlesync:' $ROOTDIR/_conf; then
	cat <<EOF >> $ROOTDIR/_conf
# idle time to start synchronizing (in seconds)
idlesync: 300
EOF
    fi
    if ! grep -q '^logfile:' $ROOTDIR/_conf; then
	cat <<EOF >> $ROOTDIR/_conf
# path of the log file (relative path or absolute path)
logfile: _log
EOF
    fi
    if ! grep -q '^mergemethod:' $ROOTDIR/_conf; then
	cat <<EOF >> $ROOTDIR/_conf
# merge method (1:score, 2:score and rank, 3:rank)
mergemethod: 2
EOF
    fi
    if ! grep -q '^publicurl:' $ROOTDIR/_conf; then
	cat <<EOF >> $ROOTDIR/_conf
# public URL (absolute URL)
publicurl:
EOF
    fi
    if ! grep -q '^searchmax:' $ROOTDIR/_conf; then
	cat <<EOF >> $ROOTDIR/_conf
# maximum number of documents to send
searchmax: 1000
EOF
    fi
    if ! grep -q '^adminemail:' $ROOTDIR/_conf; then
	cat <<EOF >> $ROOTDIR/_conf
# e-mail address of the administrator
adminemail: webmaster@$(cat /etc/mailname)
EOF
    fi
    if ! grep -q '^backupcmd:' $ROOTDIR/_conf; then
	cat <<EOF >> $ROOTDIR/_conf
# command for backup (absolute path of a command)
backupcmd:
EOF
    fi
    if ! grep -q '^attrindex:' $ROOTDIR/_conf; then
	cat <<EOF >> $ROOTDIR/_conf
# attribute indexes (attribute name and data type)
attrindex: @mdate{{!}}seq
attrindex: @title{{!}}str
EOF
    fi
    if ! grep -q '^wildmax:' $ROOTDIR/_conf; then
	cat <<EOF >> $ROOTDIR/_conf
# maximum number of expansion of wild cards
wildmax: 256
EOF
    fi
    if ! grep -q '^limittextsize:' $ROOTDIR/_conf; then
	cat <<EOF >> $ROOTDIR/_conf
# text size limitation of indexing documents (in kilo bytes)
limittextsize: 128
EOF
    fi
    if ! grep -q '^uismlrtune:' $ROOTDIR/_conf; then
	cat <<EOF >> $ROOTDIR/_conf
# tuning parameters for similarity search
uismlrtune: 16 1024 4096
EOF
    fi
    if ! grep -q '^recvmax:' $ROOTDIR/_conf; then
	cat <<EOF >> $ROOTDIR/_conf
# maximum length of data to receive (in kilobytes)
recvmax: 1024
EOF
    fi
    if ! grep -q '^scalepred:' $ROOTDIR/_conf; then
	cat <<EOF >> $ROOTDIR/_conf
# scale prediction (1:small, 2:medium, 3:large, 4:huge)
scalepred: 2
EOF
    fi
    if ! grep -q '^scoreexpr:' $ROOTDIR/_conf; then
	cat <<EOF >> $ROOTDIR/_conf
# score expression (1:void, 2:char, 3:int, 4:asis)
scoreexpr: 2
EOF
    fi
    if ! grep -q '^uiphraseform:' $ROOTDIR/_conf; then
	cat <<EOF >> $ROOTDIR/_conf
# mode of phrase form (1:usual, 2:simplified, 3:rough, 4:union: 5:intersection)
uiphraseform: 2
EOF
    fi

}

update_kwd()
{
    tempdb=$(mktemp -d /tmp/estmaster.XXXXXX)
    estcmd gather $tempdb - < /dev/null > /dev/null
    for node in $ROOTDIR/_node/*
    do
      test -d "$node" || continue
      if ! test -d "$node/_kwd"; then
	  cp -a $tempdb/_attr $node/_kwd
      fi
    done
    rm -rf $tempdb
}

case "$1" in
    configure)
	. /etc/default/hyperestraier
	if [ -d "$ROOTDIR" ] && [ -f "$ROOTDIR/_conf" ]; then
	    if test -d "$ROOTDIR.dpkg-tmp" && \
		[ "$2" = "$(cat $ROOTDIR.dpkg-tmp/_pkg_version)" ]; then
		cp -a $ROOTDIR $ROOTDIR.$2
		echo -n "node database restoring..."
		for nodedir in $ROOTDIR/_node/*
		do
		  test -d $nodedir || continue
		  nodename=$(basename $nodedir)
		  rm -rf $nodedir
		  echo -n "node/$nodename"
		  nodetmp=$ROOTDIR.dpkg-tmp/_node/$nodename
		  # XXX: estcmd gather?
		  for id in $nodetmp/*
		  do
		    test -f $id || continue
		    estcmd put $nodedir $id > /dev/null
		  done
		done
		echo "done."
	    fi
	    update_conf
	    update_kwd
	    chown -R $USER $ROOTDIR
	else
	   # no db found. create now
            [ -d /var/lib/hyperestraier ] || mkdir -p /var/lib/hyperestraier
	    echo -n "Creating initial node database in $ROOTDIR..."
	    estmaster init $ROOTDIR > /dev/null
	    chown -R $USER $ROOTDIR
	    echo "done."
	fi
    ;;

    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/hyperestraier" ] || [ -e "/etc/init/hyperestraier.conf" ]; then
	if [ ! -e "/etc/init/hyperestraier.conf" ]; then
		update-rc.d hyperestraier defaults >/dev/null
	fi
	invoke-rc.d hyperestraier start || exit $?
fi
# End automatically added section


exit 0