~ubuntu-branches/debian/squeeze/bugzilla/squeeze

« back to all changes in this revision

Viewing changes to debian/bugzilla3.preinst

  • Committer: Bazaar Package Importer
  • Author(s): Raphael Bossek
  • Date: 2009-11-24 08:41:13 UTC
  • mfrom: (1.1.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20091124084113-xku7ti9v839ypnt0
Tags: 3.2.5.1-1
* Do not change user/group and modes within /etc/cron.daily/bugzilla3. This
  scripts are started with www-data user and the files are created with the
  same security level. Closes: #556408
* Fixed post-checksetup.d/15restoredpkgstatoverride script. Closes: #557243
* Execute daily /usr/share/bugzilla3/lib/whine.pl.
* Surrpress stdout of whineatnews.pl and whine.pl in cron.daily/bugzilla3.
* If a configuration variable is missing in /etc/bugzilla3/localconfig the
  upgrade fails; /etc/bugzilla3/params is not created and checksetup.pl
  exit. LP: #419826 Closes: #557289, #538289
* Deconfigure dbcommon-config created database. Closes: #557361
* Added BG langauge pack.
* Scripts exit with error code where an error occured.
* Fixed/Added usage of dbconfig-common prerm scripts.
* Removed obsolate sym-link usr/lib/cgi-bin/bugzilla3/webdot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh
2
2
 
3
 
# Summary of how this script is called:
4
 
# . new-preinst install
5
 
# . new-preinst install old-version
6
 
# . new-preinst upgrade old-version 
 
3
set -e
 
4
 
 
5
# summary of how this script can be called:
 
6
#  * <new-preinst> `install'
 
7
#  * <new-preinst> `install' <old-version>
 
8
#  * <new-preinst> `upgrade' <old-version>
 
9
#  * <old-preinst> `abort-upgrade' <new-version>
 
10
# for details, see http://www.debian.org/doc/debian-policy/ch-maintainerscripts.html
 
11
 
 
12
mode="$1"
 
13
version="$2"
7
14
 
8
15
export BUGZILLA_ETCDIR="/etc/bugzilla3"
9
16
export BUGZILLA_VARDIR="/var/lib/bugzilla3"
13
20
export BUGZILLA_TEMPLATEDIR="$BUGZILLA_VARDIR/template"
14
21
export BUGZILLA_COMPILEDTEMPLATEDIR="$BUGZILLA_DATADIR/template"
15
22
 
16
 
debug()
17
 
{
18
 
    if [ -n "$DEBIAN_BUGZILLA_DEBUG" ]; then
19
 
        echo "$1" >&2
20
 
    fi
21
 
}
22
 
 
23
23
# Use the same order as for mv
24
24
replace_file()
25
25
{
32
32
        if [ ! -f $file_dest ]; then
33
33
            mv -v $file_source $file_dest || exit 10
34
34
        else
35
 
            echo "ucf --debconf-ok $file_source $file_dest"
36
35
            ucf --debconf-ok $file_source $file_dest || exit 11
37
36
        fi
38
37
    fi
42
41
{
43
42
    file="$1"
44
43
    if [ -e $file ]; then
45
 
        debug "Moving $file"
46
44
        replace_file "$file" "$BUGZILLA_ETCDIR/params"
47
45
    fi
48
46
}
49
47
 
50
 
 
51
 
##############################################################
52
 
# Main
53
 
#############################################################
54
 
 
55
 
set -e
56
 
mode="$1"
57
 
version="$2"
 
48
tmpf=`tempfile`
 
49
trap "rm $tmpf" EXIT QUIT
58
50
 
59
51
if [ "$mode" = "upgrade" ]; then
60
52
    umask 0002
61
53
 
62
54
    # Upgrade the 2.16 packages and older
63
 
    params_216="$BUGZILLA_DATADIR/params"
64
55
    if  [ -n "$version" ] && dpkg --compare-versions "$version" lt 2.16.7-6; then
65
 
        debug "Upgrading $version"
66
 
        upgrade_params_file $params_216
 
56
        upgrade_params_file "$BUGZILLA_DATADIR/params"
67
57
    fi
68
58
 
69
59
    # Upgrade previous 2.18 packages
70
 
    params_218="/usr/share/bugzilla3/web/data/params"
71
60
    if [ -n "$version" ] && dpkg --compare-versions "$version" lt 2.18-4; then
72
 
        debug "Upgrading $version"
73
 
        upgrade_params_file $params_218
 
61
        upgrade_params_file "$BUGZILLA_SHAREDIR/web/data/params"
74
62
    fi
75
63
 
76
64
    # Upgrade previous 2.22 package
77
 
    params_222="/usr/share/bugzilla3/debian/params"
78
65
    if [ -n "$version" ] && dpkg --compare-versions "$version" lt 2.22.1; then
79
 
        debug "Upgrading $version"
80
 
        upgrade_params_file $params_222
 
66
        upgrade_params_file "$BUGZILLA_SHAREDIR/debian/params"
81
67
    fi
82
68
 
83
69
    if [ -n "$version" -a -e "$BUGZILLA_ETCDIR/pre-checksetup.d/55localyui" ] && dpkg --compare-versions "$version" lt 3.2.5.0-2; then
87
73
            rm "$BUGZILLA_ETCDIR/pre-checksetup.d/55localyui"
88
74
        fi
89
75
    fi
 
76
 
 
77
    # Migrate $BUGZILLA_ETCDIR/params:
 
78
    # urlbase: /cgi-bin/bugzilla3 -> /bugzilla3
 
79
    # url_docbase: /docs/bugzilla3-doc/%lang%/html -> /doc/bugzilla3-doc/%lang%/html
 
80
    if test -s "$BUGZILLA_ETCDIR/params" && dpkg --compare-versions "$version" lt "3.0.10.0-1" || ( dpkg --compare-versions "$version" ge "3.2" && dpkg --compare-versions "$version" lt "3.2.5.0-1" ); then
 
81
        sed -e 's,/cgi-bin/bugzilla3,/bugzilla3,g' \
 
82
            -e 's,/docs/bugzilla3-doc/%lang%/html/,/doc/bugzilla3-doc/%lang%/html/,g' \
 
83
            "$BUGZILLA_ETCDIR/params" >"$tmpf"
 
84
        cat "$tmpf" >"$BUGZILLA_ETCDIR/params"
 
85
    fi
 
86
 
 
87
    # Introduction of dpkg-statsoverride support:
 
88
    # Revert previous file access rights/modes.
 
89
    if dpkg --compare-versions "$version" lt "3.0.10.0-1" || ( dpkg --compare-versions "$version" ge "3.2" && dpkg --compare-versions "$version" lt "3.2.5.0-3" ); then
 
90
        chown -R root:root "$BUGZILLA_VARDIR"
 
91
        chmod -R 0755 "$BUGZILLA_VARDIR"
 
92
    fi
90
93
fi
91
94
 
92
95
#DEBHELPER#