This file is indexed.

postinst is in request-tracker4 4.4.2-2.

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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
#!/bin/sh
set -e

branch_version=4
branch_priority=250

warn() {
	fmt -60 | sed 's/^/**WARNING**  /' 1>&2
}

warn <<eof

If you are using mod_perl or any form of persistent perl process
such as FastCGI, you will need to restart your web server and any
persistent processes now.

For mod_perl this means

invoke-rc.d apache2 stop && invoke-rc.d apache2 start

eof

find /var/cache/request-tracker$branch_version/mason_data -type f -print0 |xargs -r0 rm -f

alts() {
    for x in "/usr/bin/rt-crontool 1" "/usr/sbin/rt-setup-database 8" \
             "/usr/sbin/rt-dump-metadata 8" \
             "/usr/sbin/rt-email-digest 8" "/usr/sbin/rt-email-dashboards 8" \
             "/usr/sbin/rt-clean-sessions 8" "/usr/sbin/rt-shredder 8" \
             "/usr/sbin/rt-email-group-admin 8" "/usr/sbin/rt-attributes-viewer 8" \
             "/usr/sbin/rt-fulltext-indexer 8" "/usr/sbin/rt-setup-fulltext-index 8" \
             "/usr/sbin/rt-validator 8" "/usr/sbin/rt-session-viewer 8" \
             "/usr/sbin/rt-preferences-viewer 8" \
             "/usr/sbin/rt-validate-aliases 8" \
             "/usr/sbin/rt-importer 8" \
             "/usr/sbin/rt-serializer 8" \
             "/usr/sbin/rt-externalize-attachments 8" \
             "/usr/sbin/rt-ldapimport 8" ; do
        set -- $x; alt=$1; manext=$2; base=`basename $alt`
        update-alternatives \
	  --install $alt $base $alt-$branch_version $branch_priority \
          --slave /usr/share/man/man$manext/$base.$manext.gz \
	          $base.$manext.gz \
                  /usr/share/man/man$manext/$base-$branch_version.$manext.gz
    done
}

create_debconf_snippet () {
    # create a configuration snippet from the debconf database
    # and handle it with ucf
    tfile=$(mktemp -t request-tracker4-config.XXXXXXXX) || exit 1
    for i in rtname organization correspondaddress commentaddress \
             webpath webbaseurl
    do
        db_get "request-tracker4/$i"
        echo "$i=$RET"
    done | /usr/share/request-tracker4/debian/write-siteconfig \
           /usr/share/request-tracker4/debian/siteconfig.template > $tfile
    ucf --debconf-ok $tfile /etc/request-tracker4/RT_SiteConfig.d/50-debconf.pm
    rm $tfile
}

run_dbconfig () {
    dbc_generate_include=template:/etc/request-tracker4/RT_SiteConfig.d/51-dbconfig-common.pm
    dbc_generate_include_args="-o template_infile=/usr/share/request-tracker4/debian/dbconfig.template"
    if [ "$HANDLE_PERMISSIONS" = "true" ]
    then
        # hint the SQLite code for the database file permissions
        dbc_dbfile_owner="root:www-data"
        dbc_dbfile_perms=0660
    fi

    ROOT_PASSWORD="password"
    db_get request-tracker4/dbconfig-install
    DBC_INSTALL=$RET
    if [ -n "$2" ]; then
        DBC_INSTALL="false"
    fi
    db_get request-tracker4/dbconfig-reinstall
    DBC_REINSTALL=$RET
    if [ "$DBC_INSTALL" = "true" -o "$DBC_REINSTALL" = "true" ]; then
        db_get request-tracker4/initial-root-password
        if [ -n "$RET" ]; then
            ROOT_PASSWORD="$RET"
        fi
    fi
    ROOT_PASSWORD_FILE=`mktemp`
    export ROOT_PASSWORD_FILE
    echo $ROOT_PASSWORD > $ROOT_PASSWORD_FILE
    unset ROOT_PASSWORD
    if [ ! -e /usr/share/dbconfig-common/internal/dbc-no-thanks ]; then
        . /usr/share/dbconfig-common/dpkg/postinst
    fi
    dbc_go request-tracker4 $@
    if [ "$DBC_INSTALL" = "true" -o "$DBC_REINSTALL" = "true" ]; then
        db_reset request-tracker4/initial-root-password
        db_fset request-tracker4/initial-root-password seen true
        rm -f $ROOT_PASSWORD_FILE
    fi
}

maybe_handle_permissions () {
    if [ "$HANDLE_PERMISSIONS" = "true" ]
    then
        for f in /etc/request-tracker4/RT_SiteConfig.d/50-debconf.pm \
                 /etc/request-tracker4/RT_SiteConfig.d/51-dbconfig-common.pm; do
            if [ -f "$f" ]; then
                chown root:www-data $f && chmod 640 $f
            fi
        done
    fi
}

ucf_register () {
    # Add the generated files into the ucf registry
    if which ucfr >/dev/null 2>&1
    then
        ucfr request-tracker4 /etc/request-tracker4/RT_SiteConfig.d/50-debconf.pm
        ucfr request-tracker4 /etc/request-tracker4/RT_SiteConfig.pm
        ucfr request-tracker4 /etc/cron.d/request-tracker4
        # this should probably be registered by dbconfig-generate-include,
        # but ucfr is idempotent so it doesn't hurt here anyway.
        ucfr request-tracker4 /etc/request-tracker4/RT_SiteConfig.d/51-dbconfig-common.pm
    fi
}

setup_cronjobs () {
    tfile=$(mktemp -t request-tracker4-config.XXXXXXXX) || exit 1
    chmod 0755 $tfile
    if [ "$INSTALL_CRONJOBS" = "true" ]
    then
        cat > $tfile <<EOF
0 0 * * * www-data [ -x /usr/sbin/rt-email-digest-4 ] && /usr/sbin/rt-email-digest-4 -m daily
0 0 * * 0 www-data [ -x /usr/sbin/rt-email-digest-4 ] && /usr/sbin/rt-email-digest-4 -m weekly
0 * * * * www-data [ -x /usr/sbin/rt-email-dashboards-4 ] && /usr/sbin/rt-email-dashboards-4
# Enable the following cron job if you have set up external storage
#0 0 * * * www-data [ -x /usr/sbin/rt-externalize-attachments-4 ] && /usr/sbin/rt-externalize-attachments-4
EOF
    else
        cat > $tfile <<EOF
#0 0 * * * www-data [ -x /usr/sbin/rt-email-digest-4 ] && /usr/sbin/rt-email-digest-4 -m daily
#0 0 * * 0 www-data [ -x /usr/sbin/rt-email-digest-4 ] && /usr/sbin/rt-email-digest-4 -m weekly
#0 * * * * www-data [ -x /usr/sbin/rt-email-dashboards-4 ] && /usr/sbin/rt-email-dashboards-4
## Enable the following cron job if you have set up external storage
##0 0 * * * www-data [ -x /usr/sbin/rt-externalize-attachments-4 ] && /usr/sbin/rt-externalize-attachments-4
EOF
    fi
    mkdir -p /etc/cron.d
    ucf --debconf-ok $tfile /etc/cron.d/request-tracker4
    rm $tfile
    if [ -f /etc/cron.d/request-tracker40 ]; then
        mv /etc/cron.d/request-tracker40 /etc/cron.d/request-tracker40.request-tracker4.0
    fi
}

fix_vulnerable_passwords() {
    if [ "$1" = "configure" ] && [ -n "$2" ] && \
        dpkg --compare-versions "$2" lt 4.0.5-3
    then
        if su -s /bin/sh -c "RTHOME=/usr/share/request-tracker4 /usr/share/request-tracker4/etc/upgrade/vulnerable-passwords --fix" www-data; then
            echo "rt-vulnerable-passwords-4 invoked successfully on upgrade"
        else
            echo "rt-vulnerable-passwords-4 exited with an error but the"
            echo "package post-installation will continue. We recommend that"
            echo "you check the above error and take corrective action to"
            echo "ensure the privacy of your user's passwords."
        fi
    fi
}

move_gpg_data() {
    if [ "$1" = "configure" ] && [ -n "$2" ] && \
        dpkg --compare-versions "$2" lt 4.0.7-5
    then
        if [ -d /var/cache/request-tracker4/data/gpg ]; then
            echo "Moving GPG data from /var/cache to /var/lib"
            # This should be part of the package, but make sure
            if [ ! -d /var/lib/request-tracker4/data ]; then
                mkdir -p /var/lib/request-tracker4/data
                chown www-data:root /var/lib/request-tracker4/data
                chown 2750 /var/lib/request-tracker4/data
            fi
            mv -vu /var/cache/request-tracker4/data/gpg/* \
                   /var/lib/request-tracker4/data/gpg
            rmdir --ignore-fail-on-non-empty /var/cache/request-tracker4/data/gpg
        fi
    fi
}

move_snippets_to_pm() {
    if [ "$1" = "configure" ] && [ -n "$2" ] && \
        dpkg --compare-versions "$2" lt 4.4.1
    then
        for f in 50-debconf 51-dbconfig-common; do
            path=/etc/request-tracker4/RT_SiteConfig.d/$f
            if [ -e "$path" ]; then
                if [ -e "$path.pm" ]; then
                    echo "$path.pm already exists so not moving $path"
                else
                    echo "Moving $path to $path.pm"
                    mv $path $path.pm
                    ucfr --purge request-tracker4 $path
                    ucfr request-tracker4 $path.pm
                fi
            fi
        done
    fi
    # Also clean up obsolete script whilst we're here
    update-alternatives --remove update-rt-siteconfig /usr/sbin/update-rt-siteconfig-4
}

# The actual work starts here
. /usr/share/debconf/confmodule

# this is used for the SiteConfig.pm file and the possible SQLite database file
db_get request-tracker4/handle-siteconfig-permissions
HANDLE_PERMISSIONS="$RET"

db_get request-tracker4/install-cronjobs
INSTALL_CRONJOBS="$RET"

move_snippets_to_pm $@
create_debconf_snippet
if [ ! -e /usr/share/dbconfig-common/internal/dbc-no-thanks ]; then
    run_dbconfig $@
fi

# Update /etc/request-tracker4/RT_SiteConfig.pm. This is now static
# content, but we keep managing it with ucf to avoid unnecessary user
# prompting. This is a quick fix to resolve an RC bug just before freeze;
# there is probably a way to transition from ucf to a conffile that should
# be investigated later.
#
# This is a much-shortened version of the previous update-rt-siteconfig
# script (embedded as there should be no reason to call it elsewhere now.
SITE_CONFIG="/etc/request-tracker4/RT_SiteConfig.pm"
tfile=$(mktemp -t request-tracker-siteconfig.XXXXXXXX) || exit 1
cat <<EOF > $tfile
# Default RT_SiteConfig.pm for Debian
# Since RT 4.4, snippets from /etc/request-tracker4/RT_SiteConfig.d
# are read in by RT itself, so this file is now empty.
EOF
if [ -f "$SITE_CONFIG" ]
then
    # try to honor the existing mode and owner of the file
    chown --reference "$SITE_CONFIG" $tfile
    chmod --reference "$SITE_CONFIG" $tfile
fi
ucf --debconf-ok $tfile "$SITE_CONFIG"
rm $tfile

maybe_handle_permissions
setup_cronjobs
ucf_register
fix_vulnerable_passwords $@
move_gpg_data $@

case "$1" in
    configure)
        alts
        ;;
    abort-upgrade)
        alts
        ;;
esac


# Automatically added by dh_usrlocal/11.1.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ]; then
(
	while read line; do
		set -- $line
		dir="$1"; mode="$2"; user="$3"; group="$4"
		if [ ! -e "$dir" ]; then
			if mkdir "$dir" 2>/dev/null; then
				chown "$user":"$group" "$dir"
				chmod "$mode" "$dir"
			fi
		fi
	done
) << DATA
/usr/local/share 02775 root staff
/usr/local/share/request-tracker4 02775 root staff
/usr/local/share/request-tracker4/html 02775 root staff
/usr/local/share/request-tracker4/lib 02775 root staff
/usr/local/share/request-tracker4/plugins 02775 root staff
/usr/local/share/request-tracker4/po 02775 root staff
/usr/local/share/request-tracker4/static 02775 root staff
DATA
fi
# End automatically added section
# Automatically added by dh_installdeb/11.1.6ubuntu1
dpkg-maintscript-helper mv_conffile /etc/request-tracker4/RT_SiteConfig.d/40-timezone /etc/request-tracker4/RT_SiteConfig.d/40-timezone.pm -- "$@"
# End automatically added section
# Automatically added by dh_installdeb/11.1.6ubuntu1
dpkg-maintscript-helper mv_conffile /etc/request-tracker4/RT_SiteConfig.d/60-logging /etc/request-tracker4/RT_SiteConfig.d/60-logging.pm -- "$@"
# End automatically added section
# Automatically added by dh_installinit/11.1.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	if [ -x "/etc/init.d/request-tracker4" ]; then
		update-rc.d request-tracker4 defaults >/dev/null
		invoke-rc.d request-tracker4 start || exit 1
	fi
fi
# End automatically added section