#!/bin/bash

DIR=/var/jb

if [ -f ${DIR}/usr/bin/ldrunps ]; then
    chmod 6755 ${DIR}/Applications/PowerSelector.app/PowerSelector
    chmod 6755 ${DIR}/usr/bin/ldrunps
    chmod 6755 ${DIR}/usr/bin/psreboot
    chmod 6755 ${DIR}/usr/bin/pspoweroff
    chmod 6755 ${DIR}/usr/bin/psusreboot
    chmod 6755 ${DIR}/usr/bin/pslibhooker
    chmod 6755 ${DIR}/usr/bin/psCommCenter
    chmod 6755 ${DIR}/usr/bin/psopenssh
else
    chmod 6755 /Applications/PowerSelector.app/PowerSelector
    chmod 6755 /usr/bin/ldrunps
    chmod 6755 /usr/bin/psreboot
    chmod 6755 /usr/bin/pspoweroff
    chmod 6755 /usr/bin/psusreboot
    chmod 6755 /usr/bin/pslibhooker
    chmod 6755 /usr/bin/psCommCenter
    chmod 6755 /usr/bin/psopenssh
fi

declare -a cydia
cydia=($CYDIA)
if [[ ${CYDIA+@} ]]; then
    eval "echo 'finish:restart' >&${cydia[0]}"
fi

exit 0
