postinst is in hylafax-server 3:6.0.6-8.
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 326 327 | #! /bin/sh -e
# Automatically added by dh_installinit/10.7.2ubuntu2
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
if [ -x "/etc/init.d/hylafax" ]; then
update-rc.d hylafax defaults >/dev/null || exit $?
fi
fi
# End automatically added section
# Source debconf library.
. /usr/share/debconf/confmodule
db_title HylaFAX Server
if [ 0 -eq $(findmnt --noheadings --target /var/spool/hylafax/etc | grep -Fc '[/etc/hylafax]') ]
then
bindmounted=false
else
bindmounted=true
fi
# Create the faxmaster account if it doesn't exist already
if ! id faxmaster >/dev/null 2>&1; then
adduser --system --group --home /var/spool/hylafax --no-create-home --disabled-password \
--gecos "HylaFAX administrative mailbox" faxmaster
fi
if [ -f /var/spool/hylafax/etc/hosts -a ! -f /var/spool/hylafax/etc/hosts.hfaxd ]; then
mv /var/spool/hylafax/etc/hosts /var/spool/hylafax/etc/hosts.hfaxd
[ $bindmounted = false ] && cp -p /var/spool/hylafax/etc/hosts.hfaxd /etc/hylafax/
fi
#
# copy all configuration files from var/spool/hylafax/etc to /etc/hylafax
# (This means that we are upgrading a system where the "twin directories"
# were already setup)
# copy only if not bind mounted from /etc/hylafax
#
conf=""
nconf=0
if [ ! -L /var/spool/hylafax/etc ] && [ $bindmounted = false ]
then
#
# create a list of all configuration files in use
#
cd /var/spool/hylafax/etc
for i in config.*
do
if [ -e "$i" ];
then
conf="$conf $i"
nconf=$(($nconf+1))
fi
done
[ -f config ] && conf="$conf config"
cd - >/dev/null 2>&1
#
# copy old configuration files to /etc/hylafax
#
for i in $conf cover.templ dialrules dialrules.europe dialrules.sf-ba faxcover.ps faxmail.ps hfaxd.conf hosts.hfaxd lutRS18.pcf setup.cache setup.modem typerules
do
if [ -f "/etc/hylafax/$i" -a -e "/var/spool/hylafax/etc/$i" ]
then
if [ -L "/var/spool/hylafax/etc/$i" ]
then
if [ $(readlink "/var/spool/hylafax/etc/$i") = "/etc/hylafax/$i" ]
then
# This is a link from /var/spool/hylafax/etc/$i
# to /etc/hylafax/$i . Most probably it is a
# configuration file from other software, like
# capi4hylafax.
#
# So, I remove the link and recreate it, copying
# from its mastercopy.
rm /var/spool/hylafax/etc/$i
cp -p /etc/hylafax/$i /var/spool/hylafax/etc/$i
else
cp -p /var/spool/hylafax/etc/$i /etc/hylafax/$i
fi
else
# if the file in /etc/hylafax already exists and is an updated config file
# then keep it. See #287056
if grep -q ^/etc/hylafax/$i\$ /var/lib/dpkg/info/hylafax-server.conffiles
then
if grep -q "^$(cd /; md5sum etc/hylafax/$i)$" /var/lib/dpkg/info/hylafax-server.md5sums
then
cp -p /etc/hylafax/$i /var/spool/hylafax/etc/$i
else
# file is a config file and is changed, so it isn't the new one in /etc/hylafax
cp -p /var/spool/hylafax/etc/$i /etc/hylafax/$i
fi
else
# file isn't a conffile
cp -p /var/spool/hylafax/etc/$i /etc/hylafax/$i
fi
fi
fi
done
else
#
# Otherwise, we are upgrading from a system that uses the linked
# directories, i.e., Woody, or we are being mounted with --bind option
# (See #656712)
#
if [ $bindmounted = false ]
then
rm /var/spool/hylafax/etc
mkdir /var/spool/hylafax/etc
chown uucp:uucp /var/spool/hylafax/etc
fi
fi
#
# hylafax-server require hylafax-client, so now all clent files are copied to the server dir.
#
if [ $bindmounted = false ]
then
for f in hyla.conf pagesizes faxcover.ps typerules faxmail.ps
do
[ -e /etc/hylafax/$f ] && cp -p /etc/hylafax/$f /var/spool/hylafax/etc
done
fi
if [ -L /var/spool/hylafax/bin ]
then
real=$(readlink -f /var/spool/hylafax/bin)
rm /var/spool/hylafax/bin
mv "$real" /var/spool/hylafax/bin
fi
#
# Remove old /etc/hylafax/bin directory
#
if [ -d /etc/hylafax/bin ]
then
cd /etc/hylafax/
tar czf old-bin-directory.tgz bin
cd -
rm -rf /etc/hylafax/bin
fi
#
# Remove old /var/spool/hylafax/etc/bin directory
#
if [ -d /var/spool/hylafax/etc/bin ]
then
cd /var/spool/hylafax/etc
tar czf /etc/hylafax/old-spoolbin-directory.tgz bin
cd -
rm -rf /var/spool/hylafax/etc/bin
fi
# Add getty symlinks
if [ -e /sbin/mgetty ]; then
[ -e /etc/hylafax/getty-link ] \
|| ln -s /sbin/mgetty /etc/hylafax/getty-link
[ -e /etc/hylafax/egetty-link ] \
|| ln -s /sbin/mgetty /etc/hylafax/egetty-link
fi
if [ -e /usr/sbin/vgetty ]; then
[ -e /etc/hylafax/vgetty-link ] \
|| ln -s /usr/sbin/vgetty /etc/hylafax/vgetty-link
fi
# Change owner and group to uucp so that the FIFO pipes could be created.
chown uucp:uucp /var/spool/hylafax
if [ ! -e /var/spool/hylafax/etc/setup.cache -a ! -e /etc/hylafax/setup.cache ]
then
(echo ; echo no) | faxsetup -server
#
# Check if faxsetup worked correctly
#
if [ ! -f /etc/hylafax/setup.cache ]
then
db_input critical hylafax-server/setup_failed || true
db_go
exit 1
fi
else
#
# These links are normally created via faxsetup during the first
# installation. If we are upgrading from an earlier version (and not
# installing for the first time) we have to create them by hand.
# 4.2.1-5
if [ ! -e /var/spool/hylafax/bin/pdf2fax ]
then
(cd /var/spool/hylafax/bin && ln -s pdf2fax.gs pdf2fax)
fi
if [ ! -e /var/spool/hylafax/bin/ps2fax ]
then
(cd /var/spool/hylafax/bin && ln -s ps2fax.gs ps2fax)
fi
fi
setupcache=/etc/hylafax/setup.cache
[ ! -e $setupcache ] && setupcache=/var/spool/hylafax/etc/setup.cache
sed -i -e 's@^DPSRIP=.*$@DPSRIP=@' $setupcache
sed -i -e "s@^AWK='/bin/awk'@AWK='/usr/bin/awk'@" $setupcache
sed -i -e "s@^ENCODING=''@ENCODING='base64'@" $setupcache
sed -i -e "s@^MANDIR='/usr/local/man'@MANDIR='/usr/share/man'@" $setupcache
sed -i -e "s@^FONTPATH='/usr/local/lib/ghostscript/common:/usr/local/lib/ghostscript/7.07:/usr/local/lib/ghostscript/fonts:/usr/local/share/ghostscript/common:/usr/local/share/ghostscript/7.07:/usr/local/share/ghostscript/fonts:/var/lib/defoma/gs.d/dirs/fonts:/usr/share/ghostscript/common:/usr/share/gs/7.07'@FONTPATH='/usr/share/enscript/afm:/usr/share/fonts/afms/adobe:/usr/share/fonts/type1/gsfonts'@" $setupcache
# When upgrading to 4.2.1, be sure that all fields are present in the configuration.
if [ -x /usr/bin/uuencode ]
then
grep -q '^UUENCODE=' $setupcache || echo "UUENCODE='/usr/bin/uuencode'" >> $setupcache
grep -q '^ENCODING=' $setupcache || echo "ENCODING='base64'" >> $setupcache
# if uuencode was specified without complete PATH then add it
# see bug #377914
if grep -q "^UUENCODE='uuencode'" $setupcache
then
sed -i -e "s@^UUENCODE='uuencode'@UUENCODE='/usr/bin/uuencode'@" $setupcache
fi
fi
# bug #429614
# check for uuencode used for base64encoding. Change it to use mimencode
if [ -x /usr/bin/mimencode ]
then
sed -i -e "s@BASE64ENCODE='/usr/bin/uuencode'@BASE64ENCODE='/usr/bin/mimencode'@" $setupcache
sed -i -e "s@BASE64ENCODE='/usr/bin/uuencode -m ===='@BASE64ENCODE='/usr/bin/mimencode'@" $setupcache
fi
# bug #425191
# Update psrip path
if [ -x /usr/bin/psrip ]
then
sed -i -e "s@IMPRIP='/usr/lib/print/psrip'@IMPRIP='/usr/bin/psrip'@" $setupcache
fi
[ -x /usr/bin/tty ] && grep -q '^TTYCMD=' $setupcache || echo "TTYCMD='/usr/bin/tty'" >> $setupcache
if invoke-rc.d hylafax stop
then
restart=true
else
restart=false
fi
# workaround for upgrading from 6.0.3 since the init script did not umount
# correctly the file system. See #551566 and #551443.
# The source problem is in mountpoint command. See #359717
# Test if /etc/mtab is readable. See #604221
[ ! -r /etc/mtab ] \
|| awk '$1=="/etc/hylafax" && $2=="/var/spool/hylafax/etc" { system("umount "$2)}' /etc/mtab
(echo; echo no; echo no) | faxsetup -server
# [ $restart = true ] && invoke-rc.d hylafax start
# fix default values set by faxsetup without check on the real presence
# of the binary executable
uuenc=$(grep '^UUENCODE=' $setupcache | sed -e "s/^UUENCODE='\(.*\)'$/\1/" | (read a b; echo $a))
mmenc=$(grep '^MIMENCODE=' $setupcache | sed -e "s/^MIMENCODE='\(.*\)'$/\1/" | (read a b; echo $a))
baenc=$(grep '^BASE64ENCODE=' $setupcache | sed -e "s/^BASE64ENCODE='\(.*\)'$/\1/" | (read a b; echo $a))
if [ ! -x "$uuenc" ]
then
sed -i -e "s@UUENCODE='.*'@UUENCODE=''@" $setupcache
fi
if [ ! -x "$mmenc" ]
then
sed -i -e "s@MIMENCODE='.*'@MIMENCODE=''@" $setupcache
fi
if [ ! -x "$baenc" ]
then
sed -i -e "s@BASE64ENCODE='.*'@BASE64ENCODE=''@" $setupcache
fi
#
# Tell the user that he must use faxaddmodem in order to really use
# hylafax.
#
# Commented out per bug #388907. The text is now in README.Debian
#
# if [ $nconf -eq 0 ]
# then
# db_input low hylafax-server/configure_note || true
# db_go
# fi
#
# ask the user if he want to start hylafax now and warn it about the change in
# /etc/default/hylafax.
# only if /etc/default/hylafax doesn't exist yet
if [ ! -f /etc/default/hylafax ] ; then
db_input low hylafax-server/start_now || true
db_go
db_get hylafax-server/start_now
if [ "$RET" = "true" ]; then
# removed redirect to /dev/null so that user knows that
# hylafax is actually restarting
sed -e 's/# RUN_HYLAFAX=1/RUN_HYLAFAX=1/' < /usr/share/hylafax/hylafax.default-maintainer > /etc/default/hylafax
# invoke-rc.d hylafax stop || true
# Added || true in order to complete the installation even if something goes
# wrong and the server is not starting
# Closes: #357435
invoke-rc.d hylafax start || true
fi
fi
if [ $restart = true ]; then
invoke-rc.d hylafax start || true
fi
# Remove old broken link on upgrade to 4.2.2. -- Corrected in 4.2.5
[ -L /var/spool/hylafax/etc/bin ] && rm /var/spool/hylafax/etc/bin
# manually fix permissione when upgrading from old package
if [ "$1" = configure ] && dpkg --compare-versions "$2" lt 3:6.0.6-4
then
chmod o+t /var/spool/hylafax/tmp
fi
db_stop
exit 0
|