#!/bin/bash

WEBSERVER=ip.vom.server
apt-get install jesred squid

echo "url_rewrite_program /usr/lib/squid/jesred " >> /etc/squid/squid.conf

echo "regex ^http://feu01.ps3.update.playstation.net/update/ps3/list/eu/ps3-updatelist.txt http://$WEBSERVER/ps3-updatelist.txt " >> /etc/jesred.rules

echo "0.0.0.0/0" >> /etc/jesred.acl

cat <<EOF>/var/www/ps3-updatelist.txt
# EU
Dest=85;CompatibleSystemSoftwareVersion=3.1500-;
Dest=85;ImageVersion=0000948f;SystemSoftwareVersion=3.1500;CDN=http://deu01.ps3.update.playstation.net/update/ps3/image/eu/2009_1210_54ee80e14e479f8351a988eb9a472072/PS3UPDAT.PUP;CDN_Timeout=30;
EOF

/etc/init.d/squid restart