#!/bin/sh
# cpanel - addonupdates/install                   Copyright(c) 2011 cPanel, Inc.
#                                                           All rights Reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cpanel license. Unauthorized copying is prohibited

wget -nv -O - 'http://pro.cpanel.net/activate/index.cgi?ip=mine' > /dev/null
/usr/local/cpanel/cpkeyclt

if [ -e pkg.tar.gz ]; then
    rm -f pkg.tar.gz
fi
    
if [ "`/usr/local/cpanel/cpanel -V | awk -F. '{print $1$2}'`" -lt 97 ]; then
        echo "Sorry, you must have cPanel 9.7.7 or later to use this feature"
	if [ -e "/var/cpanel/addonmoduleversions/addonupdates" ]; then
		echo -n "failed" > /var/cpanel/addonmoduleversions/addonupdates
	fi
        exit
fi

for file in `cat packing.lst`
do
    if [ -e /usr/local/${file}.bz2 ]; then
        rm -f /usr/local/${file}.bz2
    fi
done

CPARGS="-afv"

if [ "`uname -s`" = "FreeBSD" ]; then
   CPARGS="-Rpf"
fi
   
cp $CPARGS cpanel/* /usr/local/cpanel

