equal
deleted
inserted
replaced
22 trap "rm -f $tmp" EXIT INT QUIT TERM |
22 trap "rm -f $tmp" EXIT INT QUIT TERM |
23 |
23 |
24 case "$1" in |
24 case "$1" in |
25 configure) |
25 configure) |
26 |
26 |
27 DIR=/srv/www/littlebird/TrustCenter/data |
27 dirs="/var/log/littlebird-tc /var/lib/littlebird-tc" |
28 chown -R :www-data "$DIR" |
28 chown -R :www-data $dirs |
29 chmod -R g+w "$DIR" |
29 chmod -R g+w $dirs |
30 |
30 |
31 # Timezone in /usr/local/zend/etc/php.ini |
31 # Timezone in /usr/local/zend/etc/php.ini |
32 # note: this file is handled as a conffile under ucf control |
32 # note: this file is handled as a conffile under ucf control |
33 f=/usr/local/zend/etc/php.ini |
33 f=/usr/local/zend/etc/php.ini |
34 perl -pi -e 's{^;?\s*(date\.timezone\s*=).*$}{$1 "Europe/Berlin"}' $f |
34 perl -pi -e 's{^;?\s*(date\.timezone\s*=).*$}{$1 "Europe/Berlin"}' $f |
100 test "$crt" && ucfr littlebird-tc-core "$crt" |
100 test "$crt" && ucfr littlebird-tc-core "$crt" |
101 test "$key" && ucfr littlebird-tc-core "$key" |
101 test "$key" && ucfr littlebird-tc-core "$key" |
102 |
102 |
103 # tweak the config file, but just the lines following a magical |
103 # tweak the config file, but just the lines following a magical |
104 # debconf line |
104 # debconf line |
105 cp /usr/share/doc/littlebird-tc/examples/apache/littlebird-tc $tmp |
105 cp /usr/share/doc/littlebird-tc/examples/apache/littlebird-tc.conf $tmp |
106 perl - "$tmp" serveradmin="$serveradmin" servername="$servername" serverport="$serverport" \ |
106 perl - "$tmp" serveradmin="$serveradmin" servername="$servername" serverport="$serverport" \ |
107 crt="$crt" key="$key" <<'_' |
107 crt="$crt" key="$key" <<'_' |
108 use strict; |
108 use strict; |
109 use warnings; |
109 use warnings; |
110 my $mark = '# debconf:'; |
110 my $mark = '# debconf:'; |
128 print(F $_); |
128 print(F $_); |
129 truncate(F, tell F); |
129 truncate(F, tell F); |
130 close(F); |
130 close(F); |
131 _ |
131 _ |
132 |
132 |
133 ucf --debconf-ok $tmp /etc/apache2/conf.d/littlebird-tc |
133 # transition to *.conf |
|
134 old_conf=/etc/apache2/conf.d/littlebird-tc |
|
135 conf=/etc/apache2/conf.d/littlebird-tc.conf |
|
136 |
|
137 if test -f $old_conf; then |
|
138 ucf --debconf-ok $old_conf $conf |
|
139 ucf --purge $old_conf |
|
140 rm -f $old_conf $old_conf.ucf* |
|
141 fi |
|
142 |
|
143 ucf --debconf-ok $tmp $conf |
|
144 rm -f $conf.ucf* |
134 |
145 |
135 # need log dir(s) |
146 # need log dir(s) |
136 ( . /etc/apache2/envvars |
147 ( . /etc/apache2/envvars |
137 file=`perl -ne '/^\s*errorlog\s+(\S+)/i&&print "$1\n"' /etc/apache2/conf.d/littlebird-tc` |
148 file=`perl -ne '/^\s*errorlog\s+(\S+)/i&&print "$1\n"' $conf` |
138 dir=`eval dirname "$file"` |
149 dir=`eval dirname "$file"` |
139 mkdir -p "$dir" |
150 mkdir -p "$dir" |
140 file=`perl -ne '/^\s*customlog\s+(\S+)/i&&print "$1\n"' /etc/apache2/conf.d/littlebird-tc` |
151 file=`perl -ne '/^\s*customlog\s+(\S+)/i&&print "$1\n"' $conf` |
141 dir=`eval dirname "$file"` |
152 dir=`eval dirname "$file"` |
142 mkdir -p "$dir" |
153 mkdir -p "$dir" |
143 ) |
154 ) |
144 |
155 |
145 # fix application_ini, there should be a cleaner approach |
156 # fix application_ini, there should be a cleaner approach |
157 my %o; foreach (@ARGV) { my ($k, $v) = split /=/, $_, 2; $o{$k} = $v } |
168 my %o; foreach (@ARGV) { my ($k, $v) = split /=/, $_, 2; $o{$k} = $v } |
158 |
169 |
159 if ($o{serverport} eq "443") { $o{serverurl} = "https://$o{servername}" } |
170 if ($o{serverport} eq "443") { $o{serverurl} = "https://$o{servername}" } |
160 else { $o{serverurl} = "https://$o{servername}:$o{serverport}" } |
171 else { $o{serverurl} = "https://$o{servername}:$o{serverport}" } |
161 |
172 |
162 open(F, "+</srv/www/littlebird/TrustCenter/application/configs/application_installation.ini") |
173 open(F, "+</usr/lib/littlebird-tc/TrustCenter/application/configs/application_installation.ini") |
163 or die; |
174 or die; |
164 $_ = join "" => <F>; |
175 $_ = join "" => <F>; |
165 s|^(\Qresources.db.params.dbname\E\s*=).*|$1 $o{dbname}|mig; |
176 s|^(\Qresources.db.params.dbname\E\s*=).*|$1 $o{dbname}|mig; |
166 s|^(\Qresources.db.params.host\E\s*=).*|$1 $o{dbhost}|mig; |
177 s|^(\Qresources.db.params.host\E\s*=).*|$1 $o{dbhost}|mig; |
167 s|^(\Qresources.db.params.username\E\s*=).*|$1 $o{dbuser}|mig; |
178 s|^(\Qresources.db.params.username\E\s*=).*|$1 $o{dbuser}|mig; |
168 s|^(\Qresources.db.params.password\E\s*=).*|$1 $o{dbpass}|mig; |
179 s|^(\Qresources.db.params.password\E\s*=).*|$1 $o{dbpass}|mig; |
169 s|^(\Qlittlebird.trustcenter.url\E\s*=).*|$1 $o{serverurl}|mig; |
180 s|^(\Qlittlebird.trustcenter.url\E\s*=).*|$1 $o{serverurl}|mig; |
170 s|/opt/LittleBird/LittleBird(?:-Test)?|/srv/www/littlebird|mig; |
181 s|/opt/LittleBird/LittleBird(?:-Test)?|/usr/lib/littlebird-tc|mig; |
171 seek(F, 0, 0); |
182 seek(F, 0, 0); |
172 print(F $_); |
183 print(F $_); |
173 truncate(F, tell F); |
184 truncate(F, tell F); |
174 close(F); |
185 close(F); |
175 _ |
186 _ |