#!/bin/sh

# Patcher for R5.5
NEED_TO_RESTART_X=0
NEED_TO_REBOOT=0

# 2008/09/12) backup/restore updates & RRD updates
# 2008/09/14) makes the 6200 LE use the proper nVidia driver version
# 2008/10/12) more RRD updates
# 2008/10/12) Firefly remote detection fix
# 2008/10/12) fixed a duplicate tuner device setup bug
cd /
wget -c ftp://ftp.knoppmyth.net/R5/R5.5/R5.5.patches.tar.bz2
tar xjf R5.5.patches.tar.bz2

# 2008/09/15) acpid fix
update-rc.d acpid start 12 2 3 4 5 . stop 88 0 1 6 .

# 2008/09/15) update PCI IDs for newer hardware
update-pciids
NEED_TO_REBOOT=1

# 2008/09/15) fix logrotate
/bin/rm -f /etc/logrotate.d/hibernate-script

# Reboot if any of the above fixes will only take effect after
# a reboot.

if [ $NEED_TO_REBOOT -eq 1 ]; then
    echo "*** The KnoppMyth patcher has made some changes that
*** will not take effect until a reboot.  After the reboot, you
*** may be prompted to redo some steps.
*** Press ENTER to reboot."
    read CONTINUE;
    
    reboot;
fi

# Restart X if any of the above fixes will only take effect after
# X restarts.  This has the side-effect of re-running KnoppMyth-run.

if [ $NEED_TO_RESTART_X -eq 1 ]; then
    echo "*** The KnoppMyth patcher has made some changes to
*** running programs and needs to restart them.
*** You may be prompted to redo some steps.
*** Press ENTER to continue."
    read CONTINUE;
    
    pkill xinit;
fi
