#!/bin/sh

if [[ $1 == upgrade ]]; then
    chmod 755 /var/mobile /var/mobile/Library /var/mobile/Library/Preferences

    if [[ $2 == '1-3' && $(sw_vers -productVersion) == 4* ]]; then
        declare -a cydia
        cydia=($CYDIA)

        if [[ ${CYDIA+@} ]]; then
            eval "echo 'finish:reboot' >&${cydia[0]}"
        fi
    fi
fi

exit 0
