postinst is in wims 4.01e-7.
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 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | #! /bin/sh
# postinst script for wims
#
# see: dh_installdeb(1)
set -e
[ -e /usr/share/debconf/confmodule ] && . /usr/share/debconf/confmodule
# 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
#
read_only_dirs(){
dirs="/var/lib/wims/bin
/var/lib/wims/log
/var/lib/wims/log/account
/var/lib/wims/log/classes
/var/lib/wims/log/classes/1011/forum
/var/lib/wims/log/classes/1011/forum/.threads
/var/lib/wims/log/forums
/var/lib/wims/log/modules
/var/lib/wims/log/referer
/var/lib/wims/public_html/bases/dic
/var/lib/wims/public_html/bases/doc
/var/lib/wims/public_html/bases/sheet
/var/lib/wims/public_html/bases/site
/var/lib/wims/public_html/bases/site/lists
/var/lib/wims/public_html/bases/site/pop
/var/lib/wims/public_html/bases/sys
/var/lib/wims/public_html/bin
/var/lib/wims/public_html/msg
/var/lib/wims/public_html/scripts/adm
/var/lib/wims/s2
/var/lib/wims/sessions
/var/lib/wims/src
/var/lib/wims/tmp/log"
for d in $dirs; do
mkdir -p $d
chmod 700 $d
done
true
}
mathfonts(){
#code grabbed from mkmathfonts
HOME_DIR=/var/lib/wims
HTML_DIR=$HOME_DIR/public_html
FONT_DIR=$HTML_DIR/mathfonts
FOUT_DIR=$HTML_DIR/w
tex2gif="su -s /bin/sh wims -c $HTML_DIR/bin/tex..gif"
texgifout=$HOME_DIR/tmp/texgif.out
wims_server_base=$HTML_DIR
texgif_tmpdir=$HOME_DIR/tmp
texgif_fontdir=$FOUT_DIR/texgif
texgif_texheader=$FONT_DIR/header.latex
export wims_server_base texgif_tmpdir texgif_fontdir texgif_texheader
export texgif_src texgif_outfile texgif_density
rm -f $texgifout 2>/dev/null
leftpar1='('
rightpar1=')'
leftbrace1='\{'
rightbrace1='\}'
Lleftpar='\left('; Rleftpar='\right.'
Lrightpar='\left.'; Rrightpar='\right)'
Lleftbrace='\left\{'; Rleftbrace='\right.'
Lrightbrace='\left.'; Rrightbrace='\right\}'
add='\mathstrut\cr'
in=$add$add
for size in 2 3; do
for type in leftpar leftbrace rightpar rightbrace; do
eval L='$'L$type; eval R='$'R$type;
eval $type$size=\'$L\\matrix\{$in\}$R\'
done
in=$in$add
done
# discontinuity !
in=$in$add
for size in 4 5 6 7 8 9 10; do
for type in leftpar leftbrace rightpar rightbrace; do
eval L='$'L$type; eval R='$'R$type;
eval $type$size=\'$L\\matrix\{$in\}$R\'
done
in=$in$add
done
# for density in 100
echo "Rendering fonts, sizes 63 to 173:"
if [ "$verbose" = yes ]; then
echo
fi
for density in 63 69 76 83 91 100 109 120 131 144 158 173
do
texgif_density=$density
mkdir -p $FONT_DIR/$density
for f in `cat /var/lib/wims/src/mathfonts`
do
F=$f
texgif_outfile=$FONT_DIR/$density/$F.gif
if [ ! -s $texgif_outfile ]; then
printf "$density: $f \r"
texgif_src="\$ \\$f \$"
$tex2gif >>$texgifout 2>/dev/null
fi
done
for f in x y z
do
texgif_outfile=$FONT_DIR/$density/$f.gif
if [ ! -s $texgif_outfile ]; then
printf "$density: $f \r"
texgif_src="\$ $f \$"
$tex2gif >>$texgifout 2>/dev/null
fi
done
for f in A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
do
#upper case
F=$f
texgif_outfile=$FONT_DIR/$density/$f$F.gif
if [ ! -s $texgif_outfile ]; then
printf "$density: $f$F \r"
texgif_src="\$ \\mathbb $f \$"
$tex2gif >>$texgifout 2>/dev/null
fi
texgif_outfile=$FONT_DIR/$density/euf$F.gif
if [ ! -s $texgif_outfile ]; then
printf "$density: euf$F \r"
texgif_src="\$ \\goth $f \$"
$tex2gif >>$texgifout 2>/dev/null
fi
texgif_outfile=$FONT_DIR/$density/cal$F.gif
if [ ! -s $texgif_outfile ]; then
printf "$density: cal$F \r"
texgif_src="\$ \\cal $f \$"
$tex2gif >>$texgifout 2>/dev/null
fi
#lower case
f=`echo $f | tr [A-Z] [a-z]`
texgif_outfile=$FONT_DIR/$density/euf$f.gif
if [ ! -s $texgif_outfile ]; then
printf "$density: euf$f \r"
texgif_src="\$ \\goth $f \$"
$tex2gif >>$texgifout 2>/dev/null
fi
done
# delimiters () {}
for type in leftpar leftbrace rightpar rightbrace; do
for size in 1 2 3 4 5 6 7 8 9 10; do
f=$type$size; eval src='$'$f
texgif_outfile=$FONT_DIR/$density/$f.gif
if [ ! -s $texgif_outfile ]; then
printf "$density: $f \r"
texgif_src="\$\$ $src \$\$"
$tex2gif >>$texgifout 2>/dev/null
fi
done
done
for syn in `cat /var/lib/wims/src/mathfonts-synonyms`
do
j1=`echo $syn | awk -F, '{print $1}'`
j2=`echo $syn | awk -F, '{print $2}'`
f=$FONT_DIR/$density/$j1.gif
if [ ! -r $f ]; then ln -s $j2.gif $f; fi
done
done
rm -f $HOME_DIR/tmp/texgif.*
echo
}
adjust_maildir(){
maildir=$(cat /etc/mailname)
if [ -n "$maildir" ]; then
for f in themes/default/visitor.phtml \
themes/default/supervisor.phtml \
themes/standard/visitor.phtml \
themes/standard/supervisor.phtml ; do
source=/var/lib/wims/public_html/$f
#sed 's/WIMS: \$httpd_HTTP_HOST/WIMS: '$maildir'/' $source > $source.tmp && \
# mv $source.tmp $source
sed 's/!mailurl \$wims_site_manager/!mailurl wims@'$maildir'/' $source > $source.tmp && \
mv $source.tmp $source
done
fi
}
case "$1" in
configure)
# giving all to wims user. That is a quick'n dirty hack !
# is it necessary ?
chown -R wims:wims /var/lib/wims
# making fonts
mathfonts;
# fixing permissions for some dirs
read_only_dirs;
# making wims suid, sgid
if ! dpkg-statoverride --list /var/lib/wims/public_html/wims >/dev/null 2>&1
then
dpkg-statoverride --update --add wims wims 6755 /var/lib/wims/public_html/wims 2>/dev/null
fi
#making /usr/lib/wims/bin private
if ! dpkg-statoverride --list /usr/lib/wims/bin >/dev/null 2>&1
then
dpkg-statoverride --update --add wims wims 700 /usr/lib/wims/bin 2>/dev/null
fi
#making wims.conf private
conffile=/var/lib/wims/log/wims.conf
[ -f $conffile ] || cp -f $conffile.distrib $conffile
if ! dpkg-statoverride --list $conffile >/dev/null 2>&1
then
dpkg-statoverride --update --add wims wims 600 $conffile 2>/dev/null
fi
# linking to /etc/wims
[ -e /etc/wims/wims.conf ] || \
[ -e $(readlink /etc/wims/wims.conf) ] ||
ln -s $conffile /etc/wims
[ -e /etc/wims/defaults.conf ] ||
[ -e $(readlink /etc/wims/defaults.conf) ] ||
ln -s /var/lib/wims/src/defaults.conf /etc/wims
# downgrading permissions for some wrappers
lambdawrapper=/var/lib/wims/public_html/bin/wrap..exec
dpkg-statoverride --update --force --add nowims nowims 6755 $lambdawrapper 2>/dev/null
#upgrading permissions for another wrapper
############ this wrapper will not be privileged, as it is not useful
############ when the feature wims_chroot is not used
############ See bug report #618476 submitted by ballombe@debian.org
## rootwrapper=/var/lib/wims/public_html/bin/ch..root
## dpkg-statoverride --update --force --add root root 6755 $rootwrapper 2>/dev/null
#delete one file
rm -f /var/lib/wims/log/unsecure
# gives the write permission for wims over its config files
chown -R wims:root /etc/wims
# reconfigure the webserver if necessary
db_get wims/reconfigure-webserver
webservers="$RET"
restart=""
for webserver in $webservers; do
webserver=${webserver%,}
test -x /usr/sbin/$webserver || continue
case "$webserver" in
apache|apache2)
newfile=false
if [ -d /etc/$webserver/conf.d ] && \
[ ! -f /etc/$webserver/conf.d/wims.conf ] && \
[ ! -h /etc/$webserver/conf.d/wims.conf ]; then
ln -s /etc/wims/apache.conf \
/etc/$webserver/conf.d/wims.conf
newfile=true
fi
if $newfile = true; then
db_reset wims/restart-webserver || true
db_subst wims/restart-webserver webserver "$webserver"
db_input high wims/restart-webserver || true
db_go
db_get wims/restart-webserver
if [ "$RET" = "true" ]; then
restart="$restart $webserver"
fi
fi
;;
esac
done
for webserver in $restart; do
webserver=${webserver%,}
if [ -x /usr/sbin/invoke-rc.d ]; then
invoke-rc.d $webserver reload || true
else
/etc/init.d/$webserver reload || true
fi
done
# don't update the index of modules since it is done by a trigger
# we do not "su - wims", so even if wims has an updated homedir
# due to a previous install it still works.
# (cd /var/lib/wims && su wims -c bin/mkindex)
# add some utilities in the set of trusted wims applications:
rm -f /var/lib/wims/bin/true; ln -s /bin/true /var/lib/wims/bin
rm -f /var/lib/wims/bin/false; ln -s /bin/false /var/lib/wims/bin
# modify the configuration for povray if this package is present
if [ -f /etc/povray/3.6/povray.conf ]; then
if ! grep -q wims /etc/povray/3.6/povray.conf; then
echo 'read+write* = /var/lib/wims/tmp' >> \
/etc/povray/3.6/povray.conf
fi
fi
# take in account the file /etc/mailname
adjust_maildir
# fix the link to the copyright file
ln -sf /usr/share/doc/wims/copyright /var/lib/wims/public_html/COPYING
;;
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.
exit 0
|