#! /bin/sh

fix_osd () {
    echo "removing outdated osd userspace files"
    osd_sh=/etc/init.d/osd.sh
    [ -f $osd_sh ] && rm $osd_sh || true

    osdd_sh=/etc/init.d/osdd.sh
    [ -f $osdd_sh ] && rm $osdd_sh || true

    osd_autostart=/etc/xdg/autostart/osd.desktop
    [ -f $osd_autostart ] && rm $osd_autostart || true

    osd_bin_dir=/usr/local/bin/osd
    [ -d $osd_bin_dir ] && rm -rf $osd_bin_dir || true
}

# on intial install, cleanup cruft from pre-mp osd
if [ "install" = "$1" ] && [ -z "$2" ]; then 
   fix_osd;
fi
