apple2pi/debian/postinst
2015-07-09 20:50:56 -07:00

148 lines
4.0 KiB
Bash
Executable File

#!/bin/sh
# postinst script for a2pi
#
# 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>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
configure)
#
# Update /boot partition files.
#
if [ "$(grep ttyAMA0 /boot/cmdline.txt)" != "" ] ; then
cp /boot/cmdline.txt /boot/cmdline.bak
sed -i 's/console=ttyAMA0,[0-9]* kgdboc=ttyAMA0,[0-9]* //g' /boot/cmdline.txt
fi
#
# Disable getty on built-in serial port.
#
ttyline=`grep ttyAMA0 /etc/inittab`
case "$ttyline" in
T0*)
mv /etc/inittab /etc/inittab.bak
sed 's/^T0/#T0/' /etc/inittab.bak > /etc/inittab
;;
*)
;;
esac
#
# Disable joystick as a mouse in X
#
if [ -d /usr/share/X11/xorg.conf.d ] ; then
cp /usr/share/a2pi/11-joy.conf /usr/share/X11/xorg.conf.d
fi
#
# Add default Pi user,pi, to groups fuse and input
#
addgroup pi fuse
# addgroup pi input # already there by default
#
# Allow other users (root) to access FUSE mount points
#
if [ "$(grep \#user_allow_other /etc/fuse.conf)" != "" ] ; then
mv /etc/fuse.conf /etc/fuse.conf.bak
sed 's/^#user_allow_other/user_allow_other/' /etc/fuse.conf.bak > /etc/fuse.conf
fi
#
# Set up PIDRIVEs
#
#if [ ! -s /usr/share/a2pi/A2VD1.PO ] ; then
if [ -e /usr/share/a2pi/A2VD1.PO ] || [ -L /usr/share/a2pi/A2VD1.PO ] ; then
rm /usr/share/a2pi/A2VD1.PO
fi
ln -s /usr/share/a2pi/A2PI-1.6.PO /usr/share/a2pi/A2VD1.PO
#fi
if [ ! -s /usr/share/a2pi/A2VD2.PO ] ; then
if [ -e /usr/share/a2pi/A2VD2.PO ] || [ -L /usrshare/a2pi/A2VD2.PO ] ; then
rm /usr/share/a2pi/A2VD2.PO
fi
ln -s /usr/share/a2pi/UTILS.PO /usr/share/a2pi/A2VD2.PO
fi
#
# Add schmenk.is-a-geek.com to apt sources
#
if [ "$(grep schmenk /etc/apt/sources.list)" = "" ] ; then
echo "deb http://schmenk.is-a-geek.com/raspbian wheezy contrib" >> /etc/apt/sources.list
fi
#
# Remove old install
#
if [ -f /usr/local/bin/a2pid ] ; then
rm /usr/local/bin/a2pid
fi
if [ -f /usr/local/bin/a2serclk ] ; then
rm /usr/local/bin/a2serclk
fi
if [ -f /usr/local/bin/a2mon ] ; then
rm /usr/local/bin/a2mon
fi
if [ -f /usr/local/bin/dskread ] ; then
rm /usr/local/bin/dskread
fi
if [ -f /usr/local/bin/dskwrite ] ; then
rm /usr/local/bin/dskwrite
fi
if [ -f /usr/local/bin/a2term ] ; then
rm /usr/local/bin/a2term
fi
if [ -f /usr/local/bin/fusea2pi ] ; then
rm /usr/local/bin/fusea2pi
fi
if [ -f /usr/local/bin/a2joy ] ; then
rm /usr/local/bin/a2joy
fi
if [ -f /usr/local/bin/a2joymou ] ; then
rm /usr/local/bin/a2joymou
fi
if [ -f /usr/local/bin/a2joypad ] ; then
rm /usr/local/bin/a2joypad
fi
if [ -f /usr/local/bin/a2mount ] ; then
rm /usr/local/bin/a2mount
fi
if [ -f /usr/local/bin/bload ] ; then
rm /usr/local/bin/bload
fi
if [ -f /usr/local/bin/brun ] ; then
rm /usr/local/bin/brun
fi
if [ -f /usr/local/sbin/a2pid ] ; then
rm /usr/local/sbin/a2pid
fi
if [ "$(grep a2pid /etc/rc.local)" != "" ] ; then
mv /etc/rc.local /etc/rc.local.old
sed -e '/^# Start Apple II Pi/d' -e '/a2pid/d' -e '/^wait 1/d' -e '/a2joy/'d /etc/rc.local.old > /etc/rc.local
rm /etc/rc.local.old
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0