postinst is in quota 4.04-2.
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 | #! /bin/sh
# postinst script for quota
#
# see: dh_installdeb(1)
set -e
# 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 /usr/doc/packaging-manual/
#
# quoting from the policy:
# Any necessary prompting should almost always be confined to the
# post-installation script, and should be protected with a conditional
# so that unnecessary prompting doesn't happen if a package's
# installation fails and the `postinst' is called with `abort-upgrade',
# `abort-remove' or `abort-deconfigure'.
# create list of all fs with quota
scan_fstab()
{
tmplist=`egrep -e "^[ ]*[^#].*(usrquota|usrjquota|uquota|uqnoenforce|grpquota|grpjquota|gquota|gqnoenforce)" /etc/fstab | \
sed -e 's/\(^[[:space:]]*[^[:space:]]*[[:space:]]*[^[:space:]]*[[:space:]]*[^[:space:]]*\).*/\1/g' \
-e 's/^[[:space:]]*[^[:space:]]*[[:space:]]*//g'`
list=${tmplist:=empty}
}
if [ "$1" = "configure" ]; then
. /usr/share/debconf/confmodule
#
# generate the config files if they don't exist
#
if [ ! -f /etc/warnquota.conf ]; then
db_get quota/mailfrom
mailfrom="$RET"
db_get quota/supportemail
supportemail="$RET"
db_get quota/supportphone
supportphone="$RET"
db_get quota/message
message="$RET"
db_get quota/signature
signature="$RET"
db_get quota/subject
subject="$RET"
db_get quota/cc
cc="$RET"
db_get quota/charset
charset="$RET"
db_get quota/cc_before
cc_before="$RET"
temp=`mktemp /etc/warnquota.conf.XXXXXX`
cat <<EOF >"$temp"
# Debian configuration
# generated from debconf on `date`
#
# Command used to send email
MAIL_CMD = "/usr/sbin/sendmail -t"
# From email used in generated emails
FROM = "$mailfrom"
# Subject line
SUBJECT = $subject
# Send a copy to this address
CC_TO = "$cc"
# Support email for assistance (included in generated mail)
SUPPORT = "$supportemail"
# Support phone for assistance (included in generated mail)
PHONE = "$supportphone"
EOF
if [ -n "$message" ]; then
cat <<EOF >>"$temp"
# The message to send
MESSAGE = "$message"
EOF
fi
if [ -n "$signature" ]; then
cat <<EOF >>"$temp"
# The signature of the mail
SIGNATURE = "$signature"
EOF
fi
if [ -n "$charset" ]; then
cat <<EOF >>"$temp"
# character set the email is to be send in
CHARSET = "$charset"
EOF
fi
if [ -n "$cc_before" ]; then
cat <<EOF >>"$temp"
# CC admin this time before the end of grace period
CC_BEFORE = "$cc_before"
EOF
fi
mv $temp /etc/warnquota.conf
fi
if [ ! -f /etc/default/quota ]; then
db_get quota/run_warnquota
run_warnquota="$RET"
temp=`mktemp /etc/default/quota.XXXXXX`
cat <<EOF >"$temp"
# Configuration for quota scripts
# generated from debconf on `date`
#
# Set to "true" if warnquota should be run in cron.daily
run_warnquota="$run_warnquota"
EOF
mv $temp /etc/default/quota
fi
#
# stop debconf
#
db_stop
fi
case "$1" in
configure)
# if we have a recenty configured package, do nothing
if test ! -f /var/run/quota.upgrade; then
if [ -f /etc/fstab ]; then
# enable quota if already configured
scan_fstab
set -- $list
if [ $# -ge 2 ]; then
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
invoke-rc.d quota start
else
/etc/init.d/quota start > /dev/null 2>&1 &
fi
fi
fi
# set quota_is_new file
touch /var/lib/quota/new
fi
# if the old /var/state/quota dir exists, move the files to the new location
if [ -d /var/state/quota ]; then
[ ! -f /var/state/quota/off ] || touch /var/lib/quota/off
[ ! -f /var/state/quota/new ] || touch /var/lib/quota/new
rm -rf /var/state/quota
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 0
;;
esac
#
# remove old links
#
if test -f /var/run/quota.upgrade
then
if dpkg --compare-versions "$2" lt 3.00pre01-10
then
update-rc.d -f quota remove 2>/dev/null > /dev/null
elif dpkg --compare-versions "$2" lt 3.12-3
then
update-rc.d -f quotarpc remove 2>/dev/null > /dev/null
elif dpkg --compare-versions "$2" lt 3.17-4
then
rm -f /etc/rcS.d/S*quotarpc
fi
fi
rm -f /var/run/quota.upgrade
# Automatically added by dh_installsystemd/11.1.3ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask 'quota.service' >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled 'quota.service'; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable 'quota.service' >/dev/null || true
else
# Update the statefile to add new symlinks (if any), which need to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state 'quota.service' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/11.1.3ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
if [ -n "$2" ]; then
_dh_action=restart
else
_dh_action=start
fi
deb-systemd-invoke $_dh_action 'quota.service' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/11.1.3ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask 'quotarpc.service' >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled 'quotarpc.service'; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable 'quotarpc.service' >/dev/null || true
else
# Update the statefile to add new symlinks (if any), which need to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state 'quotarpc.service' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/11.1.3ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
if [ -n "$2" ]; then
_dh_action=restart
else
_dh_action=start
fi
deb-systemd-invoke $_dh_action 'quotarpc.service' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_installinit/11.1.3ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -x "/etc/init.d/quota" ]; then
update-rc.d quota defaults >/dev/null || exit 1
fi
fi
# End automatically added section
# Automatically added by dh_installinit/11.1.3ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -x "/etc/init.d/quotarpc" ]; then
update-rc.d quotarpc defaults >/dev/null
if [ -n "$2" ]; then
_dh_action=restart
else
_dh_action=start
fi
invoke-rc.d quotarpc $_dh_action || exit 1
fi
fi
# End automatically added section
exit 0
|