#!/bin/sh

if [ "$1" = install ]; then
dpkg-divert --package config-bear --divert /etc/X11/xorg.conf.orig --rename /etc/X11/xorg.conf
fi

if [ "$1" = upgrade ]; then

# Don't exit on error since its possible some upstart tasks do not
# need to be moved
set +e

# Restore upstart tasks to their state when installed so dpkg will find them
# in the same location and can properly update them.
update-upstart enable config-modules
update-upstart enable snd-modules
update-upstart disable psb-modules
update-upstart disable agp-modules
update-upstart disable atheros-modules
update-upstart disable broadcom-modules

# Attempt to restore xorg.conf.netbook to prevent dpkg from 
# complaining that it went missing during an upgrade. 
# Workaround for packaging problem in older versions of 
# config-bear
if [ "$2" ] && `dpkg --compare-versions "$2" lt 0.101.4`; then
    cp -a /etc/X11/xorg.conf /etc/X11/xorg.conf.netbook
fi

set -e

fi

#DEBHELPER#

