postinst is in boinc-client 7.9.3+dfsg-5.
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 | #!/bin/sh
# postinst script for boinc-client
set -e
# Source the debconf shell library.
. /usr/share/debconf/confmodule
BOINC_DIR=/var/lib/boinc-client
CONF_DIR=/etc/boinc-client
mv_conffile()
{
if [ ! -L "$BOINC_DIR/$1" ] && [ -f "$BOINC_DIR/$1" ]; then
mv -f "$BOINC_DIR/$1" "$CONF_DIR/$1"
fi
ln -sf "$CONF_DIR/$1" "$BOINC_DIR/$1"
}
ch_stat()
{
# Don't do anything if an override exists.
if ! dpkg-statoverride --list "$3" >/dev/null 2>&1 && [ -e "$3" ]; then
chmod "$1" "$3"
chown "$2" "$3"
fi
}
case "$1" in
configure)
# Create boinc group if it doesn't already exist.
if ! getent group boinc >/dev/null; then
addgroup --quiet --system boinc
fi
# Create boinc user if it doesn't already exist.
if ! getent passwd boinc >/dev/null; then
adduser --quiet --system --ingroup boinc --home $BOINC_DIR \
--gecos "BOINC core client" boinc
fi
# Assign boinc user to group video if not already the case
if ! getent group video | grep -q boinc; then
usermod -a -G video boinc || echo "Could not assign boinc user to group 'video'."
fi
# Make sure the /var/lib/boinc-client directory exists and
# is owned by the boinc user.
mkdir -p $BOINC_DIR
[ -x /sbin/restorecon ] && /sbin/restorecon $BOINC_DIR
chown -hR boinc:boinc $BOINC_DIR 2>/dev/null || true
# Move old configuration files to /etc/boinc-client/ and
# create symlinks for the BOINC core client.
mv_conffile cc_config.xml
mv_conffile global_prefs_override.xml
mv_conffile gui_rpc_auth.cfg
mv_conffile remote_hosts.cfg
# Set reasonable permissions for boinc-client's conffiles (see #407678
# and #458007) but only if no 'stat override' exists.
# cc_config.xml should be boinc:boinc and not root:boinc in order to avoid lp bug #1162596
# users should be able to change the boinc configuration by default
ch_stat 0664 boinc:boinc "$CONF_DIR/cc_config.xml"
ch_stat 0664 root:boinc "$CONF_DIR/global_prefs_override.xml"
ch_stat 0640 root:boinc "$CONF_DIR/gui_rpc_auth.cfg"
ch_stat 0644 root:boinc "$CONF_DIR/remote_hosts.cfg"
# Make a symlink to ca-certificates certs file. BOINC's original file
# is in curl/ca-bundle.crt (which is not in our tarball, because the
# export-boinc script removes the curl dir).
CA_FILE=/etc/ssl/certs/ca-certificates.crt
CA_LINK="$BOINC_DIR/ca-bundle.crt"
if [ ! -e $CA_LINK ] && [ -f $CA_FILE ]; then
ln -sf $CA_FILE $CA_LINK
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# Automatically added by dh_systemd_enable/11.1.6ubuntu1
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 'boinc-client.service' >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled 'boinc-client.service'; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable 'boinc-client.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 'boinc-client.service' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_installinit/11.1.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -x "/etc/init.d/boinc-client" ]; then
update-rc.d boinc-client defaults >/dev/null
invoke-rc.d boinc-client start || exit 1
fi
fi
# End automatically added section
exit 0
|