postinst is in bumblebee 3.2.1-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 | #!/bin/sh
# postinst script for bumblebee
#
# see: dh_installdeb(1)
set -e
xconffile=/etc/bumblebee/xorg.conf.nouveau
# group that allows users to use Bumblebee
BB_GROUP=bumblebee
# add members of these groups automatically to group "bumblebee" for new
# installations
USE_GROUPS='adm sudo admin'
case "$1" in
configure)
# only add a group and members if the configured group does match the
# default group and if the group is missing
if grep -qx ServerGroup=$BB_GROUP /etc/bumblebee/bumblebee.conf &&
! getent group $BB_GROUP > /dev/null; then
groupadd --system $BB_GROUP
users=$(getent group $USE_GROUPS | cut -d: -f4 | tr , '\n' | sort -u)
echo "Adding members from group(s) '$USE_GROUPS' to '$BB_GROUP':"
echo $users
for user in $users; do
gpasswd -a $user $BB_GROUP
done
fi
# Raring specific issue
# Also, do not rely solely on dpkg-vendor (see LP: #1061769)
if (which dpkg-vendor >/dev/null && dpkg-vendor --derives-from Ubuntu) || \
[ -e /etc/dpkg/origins/ubuntu ]; then
# assume first device to be discrete in nvidia/nvidia
busid=$(lspci -d10de: -nn | grep '\[030[02]\]' | cut -d' ' -f1 | tr . : | head -1)
if [ -z "$busid" ]; then
echo "No Nvidia card found. If you really have an Optimus system,"
echo "try selecting the Optimus setup in BIOS and run:"
echo "sudo dpkg-reconfigure bumblebee"
else
echo "Selecting $busid as discrete nvidia card. If this is incorrect,"
echo "edit the BusID line in $xconffile ."
sed -i $xconffile -r -e "s/^([\t ]*)#([\t ]*BusID[\t ]*)\"[^\"]*\"$/\\1 \\2\"PCI\:$busid\"/"
fi
# Only for 3.2.1, remove busid.conf if still present.
if [ -e /etc/bumblebee/xorg.conf.d/busid.conf ]; then
echo "Deleting old /etc/bumblebee/xorg.conf.d/busid.conf"
rm /etc/bumblebee/xorg.conf.d/busid.conf
fi
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# Automatically added by dh_systemd_enable
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask bumblebeed.service >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled bumblebeed.service; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable bumblebeed.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 bumblebeed.service >/dev/null || true
fi
# End automatically added section
# Automatically added by dh_installinit
if [ -x "/etc/init.d/bumblebeed" ] || [ -e "/etc/init/bumblebeed.conf" ]; then
if [ ! -e "/etc/init/bumblebeed.conf" ]; then
update-rc.d bumblebeed defaults >/dev/null
fi
invoke-rc.d bumblebeed start || exit $?
fi
# End automatically added section
# Automatically added by dh_installinit
update-rc.d -f bumblebeed remove >/dev/null || exit $?
# End automatically added section
# Automatically added by dh_installmodules
if [ "$1" = configure ]; then
if [ -e "/etc/modprobe.d/bumblebee" ]; then
echo "Preserving user changes to /etc/modprobe.d/bumblebee.conf ..."
if [ -e "/etc/modprobe.d/bumblebee.conf" ]; then
mv -f "/etc/modprobe.d/bumblebee.conf" "/etc/modprobe.d/bumblebee.conf.dpkg-new"
fi
mv -f "/etc/modprobe.d/bumblebee" "/etc/modprobe.d/bumblebee.conf"
fi
fi
# End automatically added section
exit 0
|