~ubuntu-branches/ubuntu/natty/otrs2/natty-updates

« back to all changes in this revision

Viewing changes to scripts/suse-otrs-10.0.spec

  • Committer: Package Import Robot
  • Author(s): Torsten Werner
  • Date: 2007-04-14 17:58:55 UTC
  • mto: (20.1.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: package-import@ubuntu.com-20070414175855-9ne0w01yu1q44ch0
Tags: upstream-2.1.7
ImportĀ upstreamĀ versionĀ 2.1.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# --
 
2
# RPM spec file for SUSE Linux 9.1 of the OTRS package
 
3
# Copyright (C) 2001-2007 OTRS GmbH, http://otrs.org/
 
4
# --
 
5
# $Id: suse-otrs-10.0.spec,v 1.3.2.1 2007/03/08 19:36:42 martin Exp $
 
6
# --
 
7
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
 
8
# the enclosed file COPYING for license information (GPL). If you
 
9
# did not receive this file, see http://www.gnu.org/licenses/gpl.txt.
 
10
# --
 
11
#
 
12
# please send bugfixes or comments to bugs+rpm@otrs.org
 
13
#
 
14
# --
 
15
Summary:      The Open Ticket Request System.
 
16
Name:         otrs
 
17
Version:      0.0
 
18
Copyright:    GNU GENERAL PUBLIC LICENSE Version 2, June 1991
 
19
Group:        Applications/Mail
 
20
Provides:     otrs
 
21
Requires:     perl perl-DBI perl-GD perl-GDGraph perl-GDTextUtil perl-Net-DNS perl-Digest-MD5 apache2 apache2-mod_perl mysql mysql-client perl-Msql-Mysql-modules mysql-shared fetchmail procmail perl-libwww-perl
 
22
Autoreqprov:  on
 
23
Release:      01
 
24
Source0:      otrs-%{version}.tar.bz2
 
25
BuildRoot:    %{_tmppath}/%{name}-%{version}-build
 
26
 
 
27
%description
 
28
<DESCRIPTION>
 
29
 
 
30
SuSE series: ap
 
31
 
 
32
%prep
 
33
%setup
 
34
 
 
35
%build
 
36
# copy config file
 
37
cp Kernel/Config.pm.dist Kernel/Config.pm
 
38
cd Kernel/Config/ && for foo in *.dist; do cp $foo `basename $foo .dist`; done && cd ../../
 
39
# copy all crontab dist files
 
40
for foo in var/cron/*.dist; do mv $foo var/cron/`basename $foo .dist`; done
 
41
# copy all .dist files
 
42
cp .procmailrc.dist .procmailrc
 
43
cp .fetchmailrc.dist .fetchmailrc
 
44
cp .mailfilter.dist .mailfilter
 
45
 
 
46
%install
 
47
# delete old RPM_BUILD_ROOT
 
48
rm -rf $RPM_BUILD_ROOT
 
49
# set DESTROOT
 
50
export DESTROOT="/opt/otrs/"
 
51
# create RPM_BUILD_ROOT DESTROOT
 
52
mkdir -p $RPM_BUILD_ROOT/$DESTROOT/
 
53
# copy files
 
54
cp -R . $RPM_BUILD_ROOT/$DESTROOT
 
55
# install init-Script and rc.config entry
 
56
install -d -m 755 $RPM_BUILD_ROOT/etc/init.d
 
57
install -d -m 755 $RPM_BUILD_ROOT/usr/sbin
 
58
install -d -m 755 $RPM_BUILD_ROOT/etc/sysconfig
 
59
install -d -m 744 $RPM_BUILD_ROOT/var/adm/fillup-templates
 
60
install -d -m 755 $RPM_BUILD_ROOT/etc/apache2/conf.d
 
61
 
 
62
# replace apache with apache2
 
63
sed  "s/rcapache/rcapache2/" scripts/suse-rcotrs-config > /tmp.otrs.$$ && mv /tmp.otrs.$$ scripts/suse-rcotrs-config
 
64
sed  "s/apache/apache2/" scripts/suse-rcotrs > /tmp.otrs.$$ && mv /tmp.otrs.$$ scripts/suse-rcotrs
 
65
install -m 644 scripts/suse-rcotrs-config $RPM_BUILD_ROOT/etc/sysconfig/otrs
 
66
 
 
67
install -m 755 scripts/suse-rcotrs $RPM_BUILD_ROOT/etc/init.d/otrs
 
68
rm -f $RPM_BUILD_ROOT/sbin/otrs
 
69
ln -s ../../etc/init.d/otrs $RPM_BUILD_ROOT/usr/sbin/rcotrs
 
70
 
 
71
install -m 644 scripts/apache2-httpd-new.include.conf $RPM_BUILD_ROOT/etc/apache2/conf.d/otrs.conf
 
72
 
 
73
# set permission
 
74
export OTRSUSER=otrs
 
75
useradd $OTRSUSER || :
 
76
useradd wwwrun || :
 
77
groupadd www || :
 
78
$RPM_BUILD_ROOT/opt/otrs/bin/SetPermissions.sh $RPM_BUILD_ROOT/opt/otrs $OTRSUSER wwwrun www www
 
79
 
 
80
%pre
 
81
# remember about the installed version
 
82
if test -e /opt/otrs/RELEASE; then
 
83
    cat /opt/otrs/RELEASE|grep VERSION|sed 's/VERSION = //'|sed 's/ /-/g' > /tmp/otrs-old.tmp
 
84
fi
 
85
# useradd
 
86
export OTRSUSER=otrs
 
87
echo -n "Check OTRS user (/etc/passwd)... "
 
88
if cat /etc/passwd | grep $OTRSUSER > /dev/null ; then
 
89
    echo "$OTRSUSER exists."
 
90
    # update groups
 
91
    usermod -g www $OTRSUSER
 
92
    # update home dir
 
93
    usermod -d /opt/otrs $OTRSUSER
 
94
else
 
95
    useradd $OTRSUSER -d /opt/otrs/ -s /bin/false -g nogroup -c 'OTRS System User' && echo "$OTRSUSER added."
 
96
fi
 
97
 
 
98
 
 
99
%post
 
100
# sysconfig
 
101
%{fillup_and_insserv -s otrs START_OTRS}
 
102
 
 
103
# if it's a major-update backup old version templates (maybe not compatible!)
 
104
if test -e /tmp/otrs-old.tmp; then
 
105
    TOINSTALL=`echo %{version}| sed 's/..$//'`
 
106
    OLDOTRS=`cat /tmp/otrs-old.tmp`
 
107
    if echo $OLDOTRS | grep -v "$TOINSTALL" > /dev/null; then
 
108
        echo "backup old (maybe not compatible) templates (of $OLDOTRS)"
 
109
        for i in /opt/otrs/Kernel/Output/HTML/Standard/*.rpmnew;
 
110
            do BF=`echo $i|sed 's/.rpmnew$//'`; mv -v $BF $BF.backup_maybe_not_compat_to.$OLDOTRS; mv $i $BF;
 
111
        done
 
112
    fi
 
113
    rm -rf /tmp/otrs-old.tmp
 
114
fi
 
115
 
 
116
# OTRS 2.0 -> OTRS 2.1
 
117
# remove old ticket config file
 
118
if test -e /opt/otrs/Kernel/Config/Files/Ticket.pm; then
 
119
    mv /opt/otrs/Kernel/Config/Files/Ticket.pm /opt/otrs/Kernel/Config/Files/Ticket.pm.not_longer_used
 
120
fi;
 
121
# remove old ticket postmaster config file
 
122
if test -e /opt/otrs/Kernel/Config/Files/TicketPostMaster.pm; then
 
123
    mv /opt/otrs/Kernel/Config/Files/TicketPostMaster.pm /opt/otrs/Kernel/Config/Files/TicketPostMaster.pm.not_longer_used;
 
124
fi
 
125
# remove old faq config file
 
126
if test -e /opt/otrs/Kernel/Config/Files/FAQ.pm; then
 
127
    mv /opt/otrs/Kernel/Config/Files/FAQ.pm /opt/otrs/Kernel/Config/Files/FAQ.pm.not_longer_used;
 
128
fi
 
129
 
 
130
# note
 
131
HOST=`hostname -f`
 
132
echo ""
 
133
echo "Next steps: "
 
134
echo ""
 
135
echo "[SuSEconfig]"
 
136
echo " Execute 'SuSEconfig' to configure the webserver."
 
137
echo ""
 
138
echo "[start Apache and MySQL]"
 
139
echo " Execute 'rcapache2 restart' and 'rcmysql start' in case they don't run."
 
140
echo ""
 
141
echo "[install the OTRS database]"
 
142
echo " Use a webbrowser and open this link:"
 
143
echo " http://$HOST/otrs/installer.pl"
 
144
echo ""
 
145
echo "[OTRS services]"
 
146
echo " Start OTRS 'rcotrs start-force' (rcotrs {start|stop|status|restart|start-force|stop-force})."
 
147
echo ""
 
148
echo "Have fun!"
 
149
echo ""
 
150
echo " Your OTRS Team"
 
151
echo " http://otrs.org/"
 
152
echo ""
 
153
 
 
154
%clean
 
155
rm -rf $RPM_BUILD_ROOT
 
156
 
 
157
%files
 
158
%config(noreplace) /etc/sysconfig/otrs
 
159
%config /etc/apache2/conf.d/otrs.conf
 
160
 
 
161
/etc/init.d/otrs
 
162
/usr/sbin/rcotrs
 
163
 
 
164
<FILES>
 
165
 
 
166
%changelog
 
167
* Thu Oct 18 2006 - martin+rpm@otrs.org
 
168
- added rename of old /opt/otrs/Kernel/Config/Files/(Ticket|TicketPostMaster|FAQ).pm files
 
169
* Sun Mar 25 2006 - martin+rpm@otrs.org
 
170
- added SUSE 10.0 support
 
171