#!/bin/sh
rm -rf /tmp/cyinstall
mkdir /tmp/cyinstall
echo 'Downloading Debs'
wget -q -O /tmp/cydia-lproj_1.1.0_iphoneos-arm.deb http://apt.saurik.com/debs/cydia-lproj_1.1.0_iphoneos-arm.deb
wget -q -O /tmp/debianutils_3.3.3ubuntu1-1_iphoneos-arm.deb http://apt.saurik.com/debs/debianutils_3.3.3ubuntu1-1_iphoneos-arm.deb
wget -q -O /tmp/org.thebigboss.repo.icons_1.0.deb http://apt.saurik.com/debs/org.thebigboss.repo.icons_1.0.deb
wget -q -O /tmp/uikittools_1.1.3_iphoneos-arm.deb http://apt.saurik.com/debs/uikittools_1.1.3_iphoneos-arm.deb
wget -q -O /tmp/cydia_1.1.6-ios6_iphoneos-arm.deb http://repo.kr1sis.net/files/cydia_ios6b3fix.deb
echo 'Unpackaging Debs'
dpkg -r cydia-sources
dpkg -i /tmp/debianutils_3.3.3ubuntu1-1_iphoneos-arm.deb
dpkg -i /tmp/cydia-lproj_1.1.0_iphoneos-arm.deb
dpkg -i /tmp/org.thebigboss.repo.icons_1.0.deb
dpkg -i /tmp/uikittools_1.1.3_iphoneos-arm.deb
dpkg -i /tmp/cydia_1.1.6-ios6_iphoneos-arm.deb
dpkg --configure -a
rm -rf /tmp/cyinstall
cd /tmp
echo 'Erasing Cache'
su -c uicache mobile
echo 'Fixing Cydia'
cd /Applications/Cydia.app
chmod 6775 MobileCydia
chown root:wheel MobileCydia
echo 'Please read carefully:'
echo ''
echo ' * Cydia - iPhone UIKit Front-End for Debian APT'
echo ' * Copyright (C) 2008-2012 Jay Freeman (saurik)'
echo ''
echo ''
echo ' Modified BSD License'
echo ' * Redistribution and use in source and binary'
echo ' * forms, with or without modification, are permitted'
echo ' * provided that the following conditions are met:'
echo ' *'
echo ' * 1. Redistributions of source code must retain the'
echo ' * above copyright notice, this list of conditions'
echo ' * and the following disclaimer.'
echo ' * 2. Redistributions in binary form must reproduce the'
echo ' * above copyright notice, this list of conditions'
echo ' * and the following disclaimer in the documentation'
echo ' * and/or other materials provided with the'
echo ' * distribution.'
echo ' * 3. The name of the author may not be used to endorse'
echo ' * or promote products derived from this software'
echo ' * without specific prior written permission.'
echo ' *'
echo ' * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS"'
echo ' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,'
echo ' * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF'
echo ' * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE'
echo ' * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE'
echo ' * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,'
echo ' * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT'
echo ' * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR'
echo ' * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS'
echo ' * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF'
echo ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR'
echo ' * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN'
echo ' * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF'
echo ' * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.'
echo ''
echo 'Big thanks to WyndWarrior for making installation of'
echo 'Cydia on iOS 6 beta possible.'
echo ''
echo 'Big thanks also to PoomSmart for fixing Cydia and making'
echo 'it work on iOS 6 beta 3 (and future betas hopefully).'
echo ''
killall SpringBoard